]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/confstr.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / confstr.3
CommitLineData
bf5a7247 1.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
fea681da 2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
c08df37a 24.\"
fea681da 25.\" Modified Sat Jul 24 19:53:02 1993 by Rik Faith (faith@cs.unc.edu)
0ff49055 26.\"
c13182ef 27.\" FIXME Many more values for 'name' are supported, some of which
0ff49055
MK
28.\" are documented under 'info confstr'.
29.\" See <bits/confname.h> for the rest.
30.\" These should all be added to this page.
31.\" See also the POSIX.1-2001 specification of confstr()
bea08fec 32.\"
4b8c67d9 33.TH CONFSTR 3 2017-09-15 "GNU" "Linux Programmer's Manual"
fea681da
MK
34.SH NAME
35confstr \- get configuration dependent string variables
36.SH SYNOPSIS
37.nf
fea681da 38.B #include <unistd.h>
68e4db0a 39.PP
fea681da
MK
40.BI "size_t confstr(int " "name" ", char *" buf ", size_t " len );
41.fi
68e4db0a 42.PP
cc4615cc
MK
43.in -4n
44Feature Test Macro Requirements for glibc (see
45.BR feature_test_macros (7)):
46.in
68e4db0a 47.PP
e313308d
MK
48.BR confstr ():
49_POSIX_C_SOURCE\ >=\ 2 || _XOPEN_SOURCE
fea681da 50.SH DESCRIPTION
63aa9df0 51.BR confstr ()
fea681da
MK
52gets the value of configuration-dependent string variables.
53.PP
54The
55.I name
56argument is the system variable to be queried.
57The following variables are supported:
58.TP
5984622e
MK
59.BR _CS_GNU_LIBC_VERSION " (GNU C library only; since glibc 2.3.2)"
60A string which identifies the GNU C library version on this system
d1f84ed7 61(e.g., "glibc 2.3.4").
5984622e
MK
62.TP
63.BR _CS_GNU_LIBPTHREAD_VERSION " (GNU C library only; since glibc 2.3.2)"
64A string which identifies the POSIX implementation supplied by this
d1f84ed7 65C library (e.g., "NPTL 2.3.4" or "linuxthreads-0.10").
5984622e 66.TP
fea681da
MK
67.B _CS_PATH
68A value for the
69.B PATH
70variable which indicates where all the POSIX.2 standard utilities can
71be found.
72.PP
73If
74.I buf
c13182ef 75is not NULL and
fea681da
MK
76.I len
77is not zero,
63aa9df0 78.BR confstr ()
fea681da
MK
79copies the value of the string to
80.I buf
81truncated to
82.I len \- 1
a00b7454 83bytes if necessary, with a null byte (\(aq\\0\(aq) as terminator.
fea681da 84This can be detected by comparing the return value of
63aa9df0 85.BR confstr ()
fea681da
MK
86against
87.IR len .
88.PP
89If
90.I len
91is zero and
92.I buf
8478ee02 93is NULL,
63aa9df0 94.BR confstr ()
fea681da 95just returns the value as defined below.
47297adb 96.SH RETURN VALUE
fea681da
MK
97If
98.I name
4f43f21f 99is a valid configuration variable,
63aa9df0 100.BR confstr ()
c13182ef 101returns the number of bytes (including the terminating null byte)
4f43f21f
MK
102that would be required to hold the entire value of that variable.
103This value may be greater than
104.IR len ,
105which means that the value in
106.I buf
107is truncated.
847e0d88 108.PP
4f43f21f 109If
c13182ef
MK
110.I name
111is a valid configuration variable,
4f43f21f 112but that variable does not have a value, then
01a81d11 113.BR confstr ()
fea681da 114returns 0.
4f43f21f
MK
115If
116.I name
117does not correspond to a valid configuration variable,
118.BR confstr ()
119returns 0, and
120.I errno
c13182ef 121is set to
4f43f21f
MK
122.BR EINVAL .
123.SH ERRORS
01a81d11 124.TP
0daa9e92 125.B EINVAL
078ac12d 126The value of
4f43f21f
MK
127.I name
128is invalid.
a2fac97f
MS
129.SH ATTRIBUTES
130For an explanation of the terms used in this section, see
131.BR attributes (7).
132.TS
133allbox;
134lb lb lb
135l l l.
136Interface Attribute Value
137T{
138.BR confstr ()
139T} Thread safety MT-Safe
140.TE
47297adb 141.SH CONFORMING TO
3e4b12f4 142POSIX.1-2001, POSIX.1-2008.
9b336505 143.SH EXAMPLE
fea681da
MK
144The following code fragment determines the path where to find
145the POSIX.2 system utilities:
e646a1ba 146.PP
088a639b 147.in +4n
e646a1ba 148.EX
6cd17cde
MK
149char *pathbuf;
150size_t n;
fea681da 151
06f38b2f 152n = confstr(_CS_PATH, NULL, (size_t) 0);
6cd17cde
MK
153pathbuf = malloc(n);
154if (pathbuf == NULL)
155 abort();
fea681da 156confstr(_CS_PATH, pathbuf, n);
b8302363 157.EE
e646a1ba 158.in
47297adb 159.SH SEE ALSO
7117b535 160.BR getconf (1),
fea681da
MK
161.BR sh (1),
162.BR exec (3),
95e77601
MK
163.BR fpathconf (3),
164.BR pathconf (3),
165.BR sysconf (3),
cc4615cc 166.BR system (3)