confstr(3) Library Functions Manual confstr(3) confstr - (libc -lc) #include size_t confstr(size_t size; int name, char buf[size], size_t size); glibc ( feature_test_macros(7)): confstr(): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE confstr() . name . : _CS_GNU_LIBC_VERSION ( GNU C glibc 2.3.2) GNU C ( "glibc 2.3.4"). _CS_GNU_LIBPTHREAD_VERSION ( GNU C glibc 2.3.2) POSIX C ( "NPTL 2.3.4" "linuxthreads-0.10"). _CS_PATH PATH POSIX.2 . If buf is not NULL and size is not zero, confstr() copies the value of the string to buf truncated to size - 1 bytes if necessary, with a null byte ('\0') as terminator. This can be detected by comparing the return value of confstr() against size. size buf NULL confstr() . name confstr() ( ) . size buf . name confstr() 0. name confstr() 0 errno EINVAL. EINVAL name . attributes(7). +------------+------------------------------------+--------------------+ || | | +------------+------------------------------------+--------------------+ |confstr() | | MT-Safe | +------------+------------------------------------+--------------------+ POSIX.1-2008. POSIX.1-2001. POSIX.2: char *pathbuf; size_t n; n = confstr(_CS_PATH, NULL, (size_t) 0); pathbuf = malloc(n); if (pathbuf == NULL) abort(); confstr(_CS_PATH, pathbuf, n); getconf(1), sh(1), exec(3), fpathconf(3), pathconf(3), sysconf(3), system(3) 3 . . : . 6.18 8 2026 confstr(3)