Modern POSIX systems (such as Linux) have a binary
getconf
which can access the system calls
sysconf
, pathconf
and 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.
> res <- getAll()
R> head(res)
R
key value type1 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
> tail(res)
R
key value type315 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:
> getConfig("_NPROCESSORS_CONF")
R1] 8
[> getConfig("LEVEL1_ICACHE_SIZE")
R1] 32768
[> getConfig("GNU_LIBC_VERSION")
R1] "glibc 2.23"
[> R
The package is on CRAN and can be installed from every mirror via
install.packages("RcppGetconf")
It contains two useful functions right now. It currently builds cleanly on Linux and OS X; reports from other builds would (and PRs where needed) would be greatly appreciated.
Dirk Eddelbuettel
GPL (>= 2)