Rcpp Interface for Querying System Configuration Variables
Modern POSIX systems (such as Linux) have a binary
getconf which can access the system calls
confstr. This package brings the values back to R.
This package requires access to these system calls, and definitions of its data structures in the system header files. We have used it exclusively on Linux and OS X so far. It should (or could) work on other POSIX-based operating systems, and contributions to make it build more widely would be very welcome.
The first function corresponds to
getconf -a and provides all values which can be retried -- currently 320 on my systems.
R> res <- getAll() R> head(res) key value type 1 LINK_MAX 65000 path 2 _POSIX_LINK_MAX 65000 path 3 MAX_CANON 255 path 4 _POSIX_MAX_CANON 255 path 5 MAX_INPUT 255 path 6 _POSIX_MAX_INPUT 255 path R> tail(res) key value type 315 LEVEL4_CACHE_ASSOC 0 sys 316 LEVEL4_CACHE_LINESIZE 0 sys 317 IPV6 200809 sys 318 RAW_SOCKETS 200809 sys 319 _POSIX_IPV6 200809 sys 320 _POSIX_RAW_SOCKETS 200809 sys R>
The second example provides read access to individual settings:
R> getConfig("_NPROCESSORS_CONF")  8 R> getConfig("LEVEL1_ICACHE_SIZE")  32768 R> getConfig("GNU_LIBC_VERSION")  "glibc 2.23" R>
Fairly new, builds and runs reliably. Could do with OS X porting help.
The package is on CRAN and can be installed from every mirror via
GPL (>= 2)