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       confstr(): _POSIX_C_SOURCE >= 2 || _XOPEN_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 bytes if necessary, with a  null
37       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 The value of name is invalid.
56

ATTRIBUTES

58       For   an   explanation   of   the  terms  used  in  this  section,  see
59       attributes(7).
60
61       ┌──────────┬───────────────┬─────────┐
62Interface Attribute     Value   
63       ├──────────┼───────────────┼─────────┤
64confstr() │ Thread safety │ MT-Safe │
65       └──────────┴───────────────┴─────────┘

CONFORMING TO

67       POSIX.1-2001, POSIX.1-2008.
68

EXAMPLE

70       The following code fragment determines  the  path  where  to  find  the
71       POSIX.2 system utilities:
72
73           char *pathbuf;
74           size_t n;
75
76           n = confstr(_CS_PATH, NULL, (size_t) 0);
77           pathbuf = malloc(n);
78           if (pathbuf == NULL)
79               abort();
80           confstr(_CS_PATH, pathbuf, n);
81

SEE ALSO

83       getconf(1), sh(1), exec(3), fpathconf(3), pathconf(3), sysconf(3), sys‐
84       tem(3)
85

COLOPHON

87       This page is part of release 5.02 of the Linux  man-pages  project.   A
88       description  of  the project, information about reporting bugs, and the
89       latest    version    of    this    page,    can     be     found     at
90       https://www.kernel.org/doc/man-pages/.
91
92
93
94GNU                               2019-03-06                        CONFSTR(3)
Impressum