1CONFSTR(3)                 Linux Programmer's Manual                CONFSTR(3)
2
3
4

NAME

6       confstr - get configuration dependent string variables
7

SYNOPSIS

9       #include <unistd.h>
10
11       size_t confstr(int name, char *buf, size_t len);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       getcwd(): _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE || _POSIX_SOURCE
16

DESCRIPTION

18       confstr() gets the value of configuration-dependent string variables.
19
20       The  name argument is the system variable to be queried.  The following
21       variables are supported:
22
23       _CS_GNU_LIBC_VERSION (GNU C library only; since glibc 2.3.2)
24              A string which identifies the GNU C library version on this sys‐
25              tem (e.g, "glibc 2.3.4").
26
27       _CS_GNU_LIBPTHREAD_VERSION (GNU C library only; since glibc 2.3.2)
28              A  string  which identifies the POSIX implementation supplied by
29              this C library (e.g, "NPTL 2.3.4" or "linuxthreads-0.10").
30
31       _CS_PATH
32              A value for the PATH variable  which  indicates  where  all  the
33              POSIX.2 standard utilities can be found.
34
35       If  buf  is not NULL and len is not zero, confstr() copies the value of
36       the string to buf truncated to len - 1 characters if necessary, with  a
37       null  byte ('\0') as terminator.  This can be detected by comparing the
38       return value of confstr() against len.
39
40       If len is zero and buf is NULL, confstr() just  returns  the  value  as
41       defined below.
42

RETURN VALUE

44       If name is a valid configuration variable, confstr() returns the number
45       of bytes (including the terminating null byte) that would  be  required
46       to  hold  the entire value of that variable.  This value may be greater
47       than len, which means that the value in buf is truncated.
48
49       If name is a valid configuration variable, but that variable  does  not
50       have a value, then confstr() returns 0.  If name does not correspond to
51       a valid configuration variable, confstr() returns 0, and errno  is  set
52       to EINVAL.
53

ERRORS

55       EINVAL If the value of name is invalid.
56

CONFORMING TO

58       POSIX.1-2001.
59

EXAMPLE

61       The  following  code  fragment  determines  the  path where to find the
62       POSIX.2 system utilities:
63
64           char *pathbuf;
65           size_t n;
66
67           n = confstr(_CS_PATH,NULL,(size_t) 0);
68           pathbuf = malloc(n);
69           if (pathbuf == NULL)
70               abort();
71           confstr(_CS_PATH, pathbuf, n);
72

SEE ALSO

74       sh(1), exec(3), system(3)
75

COLOPHON

77       This page is part of release 3.22 of the Linux  man-pages  project.   A
78       description  of  the project, and information about reporting bugs, can
79       be found at http://www.kernel.org/doc/man-pages/.
80
81
82
83GNU                               2008-08-29                        CONFSTR(3)
Impressum