]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sysconf.3
Fix redundant formatting macros
[thirdparty/man-pages.git] / man3 / sysconf.3
CommitLineData
fea681da
MK
1.\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
c13182ef 11.\"
fea681da
MK
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\" License.
23.\" Modified Sat Jul 24 17:51:42 1993 by Rik Faith (faith@cs.unc.edu)
24.\" Modified Tue Aug 17 11:42:20 1999 by Ariel Scolnicov (ariels@compugen.co.il)
25.TH SYSCONF 3 1993-04-18 "GNU" "Linux Programmer's Manual"
26.SH NAME
27sysconf \- Get configuration information at runtime
28.SH SYNOPSIS
29.nf
30.B #include <unistd.h>
31.sp
32.BI "long sysconf(int " "name" );
33.fi
34.SH DESCRIPTION
35POSIX allows an application to test at compile- or run-time
36whether certain options are supported, or what the value is
37of certain configurable constants or limits.
38.LP
39At compile time this is done by including
40.I <unistd.h>
41and/or
42.I <limits.h>
43and testing the value of certain macros.
44.LP
45At run time, one can ask for numerical values using the present function
46.BR sysconf ().
47On can ask for numerical values that may depend
48on the filesystem a file is in using the calls
49.BR fpathconf (3)
50and
51.BR pathconf (3).
52One can ask for string values using
53.BR confstr (3).
54.LP
55The values obtained from these functions are system configuration constants.
56They do not change during the lifetime of a process.
57.\" except that sysconf(_SC_OPEN_MAX) may change answer after a call
58.\" to setrlimit( ) which changes the RLIMIT_NOFILE soft limit
59.LP
60For options, typically, there is a constant
61.B _POSIX_FOO
62that may be defined in
63.IR <unistd.h> .
64If it is undefined, one should ask at run-time.
65If it is defined to \-1, then the option is not supported.
66If it is defined to 0, then relevant functions and headers exist,
67but one has to ask at runtime what degree of support is available.
68If it is defined to a value other than \-1 or 0, then the option is
c13182ef
MK
69supported.
70Usually the value (such as 200112L) indicates the year and month
71of the POSIX revision describing the option.
72Glibc uses the value 1
fea681da
MK
73to indicate support as long as the POSIX revision has not been published yet.
74.\" and 999 to indicate support for options no longer present in the latest
75.\" standard. (?)
76The
63aa9df0 77.BR sysconf ()
fea681da
MK
78argument will be
79.BR _SC_FOO .
80For a list of options, see
81.BR posixoptions (7).
82.LP
83For variables or limits, typically, there is a constant
84.BR _FOO ,
85maybe defined in
86.IR <limits.h> ,
87or
88.BR _POSIX_FOO ,
89maybe defined in
90.IR <unistd.h> .
91The constant will not be defined if the limit is unspecified.
92If the constant is defined, it gives a guaranteed value, and
93more might actually be supported.
94If an application wants to take advantage of values which may change
95between systems, a call to
63aa9df0 96.BR sysconf ()
fea681da 97can be made.
c13182ef 98The
4a225b7a 99.BR sysconf ()
fea681da
MK
100argument will be
101.BR _SC_FOO .
8af1ba10 102.SS "POSIX.1 Variables"
fea681da 103We give the name of the variable, the name of the
63aa9df0 104.BR sysconf ()
fea681da
MK
105parameter used to inquire about its value,
106and a short description.
107.LP
108First, the POSIX.1 compatible values.
109.\" [for the moment: only the things that are unconditionally present]
110.\" .TP
111.\" .BR AIO_LISTIO_MAX " - " _SC_AIO_LISTIO_MAX
112.\" (if _POSIX_ASYNCHRONOUS_IO)
113.\" Maximum number of I/O operations in a single list I/O call.
114.\" Must not be less than _POSIX_AIO_LISTIO_MAX.
115.\" .TP
116.\" .BR AIO_MAX " - " _SC_AIO_MAX
117.\" (if _POSIX_ASYNCHRONOUS_IO)
118.\" Maximum number of outstanding asynchronous I/O operations.
119.\" Must not be less than _POSIX_AIO_MAX.
120.\" .TP
121.\" .BR AIO_PRIO_DELTA_MAX " - " _SC_AIO_PRIO_DELTA_MAX
122.\" (if _POSIX_ASYNCHRONOUS_IO)
123.\" The maximum amount by which a process can decrease its
124.\" asynchronous I/O priority level from its own scheduling priority.
f94498ee 125.\" Must be non-negative.
fea681da
MK
126.TP
127.BR ARG_MAX " - " _SC_ARG_MAX
128The maximum length of the arguments to the
3a72373c 129.BR exec (3)
fea681da 130family of functions.
8c4f34f8
MK
131Must not be less than
132.B _POSIX_ARG_MAX
133(4096).
fea681da
MK
134.TP
135.BR CHILD_MAX " - " _SC_CHILD_MAX
357cf3fe 136The max number of simultaneous processes per user ID.
8c4f34f8
MK
137Must not be less than
138.B _POSIX_CHILD_MAX
139(25).
fea681da
MK
140.TP
141.BR HOST_NAME_MAX " - " _SC_HOST_NAME_MAX
c13182ef 142Max length of a hostname, not including the terminating null byte,
28d88c17 143as returned by
fea681da 144.BR gethostname (2).
8c4f34f8
MK
145Must not be less than
146.B _POSIX_HOST_NAME_MAX
147(255).
fea681da
MK
148.TP
149.BR LOGIN_NAME_MAX " - " _SC_LOGIN_NAME_MAX
28d88c17 150Maximum length of a login name, including the terminating null byte.
8c4f34f8
MK
151Must not be less than
152.B _POSIX_LOGIN_NAME_MAX
153(9).
fea681da
MK
154.TP
155.BR "" "clock ticks - " _SC_CLK_TCK
156The number of clock ticks per second.
c13182ef
MK
157The corresponding variable is obsolete.
158It was of course called
fea681da
MK
159.BR CLK_TCK .
160(Note: the macro
161.B CLOCKS_PER_SEC
162does not give information: it must equal 1000000.)
163.TP
164.BR OPEN_MAX " - " _SC_OPEN_MAX
165The maximum number of files that a process can have open at any time.
8c4f34f8
MK
166Must not be less than
167.B _POSIX_OPEN_MAX
168(20).
fea681da
MK
169.TP
170.BR PAGESIZE " - " _SC_PAGESIZE
c13182ef
MK
171Size of a page in bytes.
172Must not be less than 1.
fea681da
MK
173(Some systems use PAGE_SIZE instead.)
174.TP
175.BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
176The number of repeated occurrences of a BRE permitted by
177.BR regexec (3)
178and
179.BR regcomp (3).
8c4f34f8
MK
180Must not be less than
181.B _POSIX2_RE_DUP_MAX
182(255).
fea681da
MK
183.TP
184.BR STREAM_MAX " - " _SC_STREAM_MAX
185The maximum number of streams that a process can have open at any
c13182ef
MK
186time.
187If defined, it has the same value as the standard C macro
fea681da 188.BR FOPEN_MAX .
8c4f34f8
MK
189Must not be less than
190.B _POSIX_STREAM_MAX
191(8).
fea681da 192.TP
0daa9e92 193.B SYMLOOP_MAX
fea681da 194The maximum number of symbolic links seen in a pathname before resolution
097585ed
MK
195returns
196.BR ELOOP .
8c4f34f8
MK
197Must not be less than
198.B _POSIX_SYMLOOP_MAX
199(8).
fea681da
MK
200.TP
201.BR TTY_NAME_MAX " - " _SC_TTY_NAME_MAX
c13182ef 202The maximum length of terminal device name,
28d88c17 203including the terminating null byte.
8c4f34f8 204Must not be less than
0daa9e92 205.B _POSIX_TTY_NAME_MAX
8c4f34f8 206(9).
fea681da
MK
207.TP
208.BR TZNAME_MAX " - " _SC_TZNAME_MAX
209The maximum number of bytes in a timezone name.
8c4f34f8 210Must not be less than
0daa9e92 211.B _POSIX_TZNAME_MAX
8c4f34f8 212(6).
fea681da
MK
213.TP
214.BR _POSIX_VERSION " - " _SC_VERSION
215indicates the year and month the POSIX.1 standard was approved in the
216format
217.BR YYYYMML ; the
218value
219.B 199009L
220indicates the Sept. 1990 revision.
8af1ba10 221.SS "POSIX.2 Variables"
fea681da
MK
222Next, the POSIX.2 values, giving limits for utilities.
223.TP
224.BR BC_BASE_MAX " - " _SC_BC_BASE_MAX
225indicates the maximum
226.I obase
227value accepted by the
228.BR bc (1)
229utility.
230.TP
231.BR BC_DIM_MAX " - " _SC_BC_DIM_MAX
232indicates the maximum value of elements permitted in an array by
233.BR bc (1).
234.TP
235.BR BC_SCALE_MAX " - " _SC_BC_SCALE_MAX
236indicates the maximum
237.I scale
238value allowed by
239.BR bc (1).
240.TP
241.BR BC_STRING_MAX " - " _SC_BC_STRING_MAX
242indicates the maximum length of a string accepted by
243.BR bc (1).
244.TP
245.BR COLL_WEIGHTS_MAX " - " _SC_COLL_WEIGHTS_MAX
246indicates the maximum numbers of weights that can be assigned to an
247entry of the
248.B LC_COLLATE order
249keyword in the locale definition file,
250.TP
251.BR EXPR_NEST_MAX " - " _SC_EXPR_NEST_MAX
252is the maximum number of expressions which can be nested within
253parentheses by
254.BR expr (1).
255.TP
256.BR LINE_MAX " - " _SC_LINE_MAX
257The maximum length of a utility's input line length, either from
c13182ef
MK
258standard input or from a file.
259This includes length for a trailing
fea681da
MK
260newline.
261.TP
262.BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
263The maximum number of repeated occurrences of a regular expression when
264the interval notation
265.B \e{m,n\e}
266is used.
267.TP
268.BR POSIX2_VERSION " - " _SC_2_VERSION
269indicates the version of the POSIX.2 standard in the format of
270YYYYMML.
271.TP
961abb97 272.BR POSIX2_C_DEV " - " _SC_2_C_DEV
fea681da
MK
273indicates whether the POSIX.2 C language development facilities are
274supported.
275.TP
50a0922f 276.BR POSIX2_FORT_DEV " - " _SC_2_FORT_DEV
fea681da
MK
277indicates whether the POSIX.2 FORTRAN development utilities are
278supported.
279.TP
280.BR POSIX2_FORT_RUN " - " _SC_2_FORT_RUN
281indicates whether the POSIX.2 FORTRAN runtime utilities are supported.
282.TP
283.BR _POSIX2_LOCALEDEF " - " _SC_2_LOCALEDEF
284indicates whether the POSIX.2 creation of locates via
285.BR localedef (1)
286is supported.
287.TP
288.BR POSIX2_SW_DEV " - " _SC_2_SW_DEV
289indicates whether the POSIX.2 software development utilities option is
290supported.
291.PP
292These values also exist, but may not be standard.
293.TP
294.BR "" " - " _SC_PHYS_PAGES
c13182ef
MK
295The number of pages of physical memory.
296Note that it is possible
fea681da
MK
297for the product of this value and the value of
298.B _SC_PAGE_SIZE
299to overflow.
300.TP
301.BR "" " - " _SC_AVPHYS_PAGES
302The number of currently available pages of physical memory.
303.SH "RETURN VALUE"
304If
305.I name
306is invalid, \-1 is returned, and
307.I errno
308is set to
309.BR EINVAL .
310Otherwise, the value returned is the value of the system resource and
311.I errno
312is not changed.
313In the case of options, a positive value is returned if a queried option
314is available, and \-1 if it is not.
315In the case of limits, \-1 means that there is no definite limit.
316.SH "CONFORMING TO"
68e1685c 317POSIX.1-2001.
fea681da
MK
318.SH BUGS
319It is difficult to use
320.B ARG_MAX
321because it is not specified how much of the argument space for
3a72373c 322.BR exec (3)
fea681da
MK
323is consumed by the user's environment variables.
324.PP
325Some returned values may be huge; they are not suitable for allocating
326memory.
327.SH "SEE ALSO"
328.BR bc (1),
329.BR expr (1),
ceff5191 330.BR getconf (1),
fea681da
MK
331.BR locale (1),
332.BR fpathconf (3),
333.BR pathconf (3),
334.BR posixoptions (7)