]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/sysconf.3
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man3 / sysconf.3
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.
11 .\"
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.
19 .\"
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
27 sysconf \- 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
35 POSIX allows an application to test at compile- or run-time
36 whether certain options are supported, or what the value is
37 of certain configurable constants or limits.
38 .LP
39 At compile time this is done by including
40 .I <unistd.h>
41 and/or
42 .I <limits.h>
43 and testing the value of certain macros.
44 .LP
45 At run time, one can ask for numerical values using the present function
46 .BR sysconf ().
47 On can ask for numerical values that may depend
48 on the filesystem a file is in using the calls
49 .BR fpathconf (3)
50 and
51 .BR pathconf (3).
52 One can ask for string values using
53 .BR confstr (3).
54 .LP
55 The values obtained from these functions are system configuration constants.
56 They 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
60 For options, typically, there is a constant
61 .B _POSIX_FOO
62 that may be defined in
63 .IR <unistd.h> .
64 If it is undefined, one should ask at run-time.
65 If it is defined to \-1, then the option is not supported.
66 If it is defined to 0, then relevant functions and headers exist,
67 but one has to ask at runtime what degree of support is available.
68 If it is defined to a value other than \-1 or 0, then the option is
69 supported.
70 Usually the value (such as 200112L) indicates the year and month
71 of the POSIX revision describing the option.
72 Glibc uses the value 1
73 to 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. (?)
76 The
77 .BR sysconf ()
78 argument will be
79 .BR _SC_FOO .
80 For a list of options, see
81 .BR posixoptions (7).
82 .LP
83 For variables or limits, typically, there is a constant
84 .BR _FOO ,
85 maybe defined in
86 .IR <limits.h> ,
87 or
88 .BR _POSIX_FOO ,
89 maybe defined in
90 .IR <unistd.h> .
91 The constant will not be defined if the limit is unspecified.
92 If the constant is defined, it gives a guaranteed value, and
93 more might actually be supported.
94 If an application wants to take advantage of values which may change
95 between systems, a call to
96 .BR sysconf ()
97 can be made.
98 The
99 .BR sysconf ()
100 argument will be
101 .BR _SC_FOO .
102 .SH "POSIX.1 VARIABLES"
103 We give the name of the variable, the name of the
104 .BR sysconf ()
105 parameter used to inquire about its value,
106 and a short description.
107 .LP
108 First, 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.
125 .\" Must be nonnegative.
126 .TP
127 .BR ARG_MAX " - " _SC_ARG_MAX
128 The maximum length of the arguments to the
129 .BR exec ()
130 family of functions.
131 Must not be less than _POSIX_ARG_MAX (4096).
132 .TP
133 .BR CHILD_MAX " - " _SC_CHILD_MAX
134 The max number of simultaneous processes per user ID.
135 Must not be less than _POSIX_CHILD_MAX (25).
136 .TP
137 .BR HOST_NAME_MAX " - " _SC_HOST_NAME_MAX
138 Max length of a hostname, not including the terminating null byte,
139 as returned by
140 .BR gethostname (2).
141 Must not be less than _POSIX_HOST_NAME_MAX (255).
142 .TP
143 .BR LOGIN_NAME_MAX " - " _SC_LOGIN_NAME_MAX
144 Maximum length of a login name, including the terminating null byte.
145 Must not be less than _POSIX_LOGIN_NAME_MAX (9).
146 .TP
147 .BR "" "clock ticks - " _SC_CLK_TCK
148 The number of clock ticks per second.
149 The corresponding variable is obsolete.
150 It was of course called
151 .BR CLK_TCK .
152 (Note: the macro
153 .B CLOCKS_PER_SEC
154 does not give information: it must equal 1000000.)
155 .TP
156 .BR OPEN_MAX " - " _SC_OPEN_MAX
157 The maximum number of files that a process can have open at any time.
158 Must not be less than _POSIX_OPEN_MAX (20).
159 .TP
160 .BR PAGESIZE " - " _SC_PAGESIZE
161 Size of a page in bytes.
162 Must not be less than 1.
163 (Some systems use PAGE_SIZE instead.)
164 .TP
165 .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
166 The number of repeated occurrences of a BRE permitted by
167 .BR regexec (3)
168 and
169 .BR regcomp (3).
170 Must not be less than _POSIX2_RE_DUP_MAX (255).
171 .TP
172 .BR STREAM_MAX " - " _SC_STREAM_MAX
173 The maximum number of streams that a process can have open at any
174 time.
175 If defined, it has the same value as the standard C macro
176 .BR FOPEN_MAX .
177 Must not be less than _POSIX_STREAM_MAX (8).
178 .TP
179 .BR SYMLOOP_MAX
180 The maximum number of symbolic links seen in a pathname before resolution
181 returns ELOOP.
182 Must not be less than _POSIX_SYMLOOP_MAX (8).
183 .TP
184 .BR TTY_NAME_MAX " - " _SC_TTY_NAME_MAX
185 The maximum length of terminal device name,
186 including the terminating null byte.
187 Must not be less than _POSIX_TTY_NAME_MAX (9).
188 .TP
189 .BR TZNAME_MAX " - " _SC_TZNAME_MAX
190 The maximum number of bytes in a timezone name.
191 Must not be less than _POSIX_TZNAME_MAX (6).
192 .TP
193 .BR _POSIX_VERSION " - " _SC_VERSION
194 indicates the year and month the POSIX.1 standard was approved in the
195 format
196 .BR YYYYMML ; the
197 value
198 .B 199009L
199 indicates the Sept. 1990 revision.
200 .SH "POSIX.2 VARIABLES"
201 Next, the POSIX.2 values, giving limits for utilities.
202 .TP
203 .BR BC_BASE_MAX " - " _SC_BC_BASE_MAX
204 indicates the maximum
205 .I obase
206 value accepted by the
207 .BR bc (1)
208 utility.
209 .TP
210 .BR BC_DIM_MAX " - " _SC_BC_DIM_MAX
211 indicates the maximum value of elements permitted in an array by
212 .BR bc (1).
213 .TP
214 .BR BC_SCALE_MAX " - " _SC_BC_SCALE_MAX
215 indicates the maximum
216 .I scale
217 value allowed by
218 .BR bc (1).
219 .TP
220 .BR BC_STRING_MAX " - " _SC_BC_STRING_MAX
221 indicates the maximum length of a string accepted by
222 .BR bc (1).
223 .TP
224 .BR COLL_WEIGHTS_MAX " - " _SC_COLL_WEIGHTS_MAX
225 indicates the maximum numbers of weights that can be assigned to an
226 entry of the
227 .B LC_COLLATE order
228 keyword in the locale definition file,
229 .TP
230 .BR EXPR_NEST_MAX " - " _SC_EXPR_NEST_MAX
231 is the maximum number of expressions which can be nested within
232 parentheses by
233 .BR expr (1).
234 .TP
235 .BR LINE_MAX " - " _SC_LINE_MAX
236 The maximum length of a utility's input line length, either from
237 standard input or from a file.
238 This includes length for a trailing
239 newline.
240 .TP
241 .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
242 The maximum number of repeated occurrences of a regular expression when
243 the interval notation
244 .B \e{m,n\e}
245 is used.
246 .TP
247 .BR POSIX2_VERSION " - " _SC_2_VERSION
248 indicates the version of the POSIX.2 standard in the format of
249 YYYYMML.
250 .TP
251 .BR POSIX2_C_DEV " - " _SC_2_C_DEV
252 indicates whether the POSIX.2 C language development facilities are
253 supported.
254 .TP
255 .BR POSIX2_FORT_DEV " - " _SC_2_FORT_DEV
256 indicates whether the POSIX.2 FORTRAN development utilities are
257 supported.
258 .TP
259 .BR POSIX2_FORT_RUN " - " _SC_2_FORT_RUN
260 indicates whether the POSIX.2 FORTRAN runtime utilities are supported.
261 .TP
262 .BR _POSIX2_LOCALEDEF " - " _SC_2_LOCALEDEF
263 indicates whether the POSIX.2 creation of locates via
264 .BR localedef (1)
265 is supported.
266 .TP
267 .BR POSIX2_SW_DEV " - " _SC_2_SW_DEV
268 indicates whether the POSIX.2 software development utilities option is
269 supported.
270 .PP
271 These values also exist, but may not be standard.
272 .TP
273 .BR "" " - " _SC_PHYS_PAGES
274 The number of pages of physical memory.
275 Note that it is possible
276 for the product of this value and the value of
277 .B _SC_PAGE_SIZE
278 to overflow.
279 .TP
280 .BR "" " - " _SC_AVPHYS_PAGES
281 The number of currently available pages of physical memory.
282 .SH "RETURN VALUE"
283 If
284 .I name
285 is invalid, \-1 is returned, and
286 .I errno
287 is set to
288 .BR EINVAL .
289 Otherwise, the value returned is the value of the system resource and
290 .I errno
291 is not changed.
292 In the case of options, a positive value is returned if a queried option
293 is available, and \-1 if it is not.
294 In the case of limits, \-1 means that there is no definite limit.
295 .SH "CONFORMING TO"
296 POSIX.1-2001.
297 .SH BUGS
298 It is difficult to use
299 .B ARG_MAX
300 because it is not specified how much of the argument space for
301 .BR exec ()
302 is consumed by the user's environment variables.
303 .PP
304 Some returned values may be huge; they are not suitable for allocating
305 memory.
306 .SH "SEE ALSO"
307 .BR bc (1),
308 .BR expr (1),
309 .BR locale (1),
310 .BR fpathconf (3),
311 .BR pathconf (3),
312 .BR posixoptions (7)