2008-07-08 14:32:54 +00:00
|
|
|
.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\" License.
|
|
|
|
.\" Modified Sat Jul 24 17:51:42 1993 by Rik Faith (faith@cs.unc.edu)
|
|
|
|
.\" Modified Tue Aug 17 11:42:20 1999 by Ariel Scolnicov (ariels@compugen.co.il)
|
2007-11-29 21:16:50 +00:00
|
|
|
.TH SYSCONF 3 2007-12-12 "GNU" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
sysconf \- Get configuration information at runtime
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <unistd.h>
|
|
|
|
.sp
|
|
|
|
.BI "long sysconf(int " "name" );
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
2008-03-19 08:46:32 +00:00
|
|
|
POSIX allows an application to test at compile or run time
|
2004-11-03 13:51:07 +00:00
|
|
|
whether certain options are supported, or what the value is
|
|
|
|
of certain configurable constants or limits.
|
|
|
|
.LP
|
|
|
|
At compile time this is done by including
|
|
|
|
.I <unistd.h>
|
|
|
|
and/or
|
|
|
|
.I <limits.h>
|
|
|
|
and testing the value of certain macros.
|
|
|
|
.LP
|
|
|
|
At run time, one can ask for numerical values using the present function
|
|
|
|
.BR sysconf ().
|
2010-05-22 03:27:11 +00:00
|
|
|
One can ask for numerical values that may depend
|
2008-03-19 07:26:08 +00:00
|
|
|
on the file system a file is in using the calls
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR fpathconf (3)
|
|
|
|
and
|
|
|
|
.BR pathconf (3).
|
|
|
|
One can ask for string values using
|
|
|
|
.BR confstr (3).
|
|
|
|
.LP
|
|
|
|
The values obtained from these functions are system configuration constants.
|
|
|
|
They do not change during the lifetime of a process.
|
|
|
|
.\" except that sysconf(_SC_OPEN_MAX) may change answer after a call
|
2008-07-01 14:15:13 +00:00
|
|
|
.\" to setrlimit( ) which changes the RLIMIT_NOFILE soft limit
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
For options, typically, there is a constant
|
|
|
|
.B _POSIX_FOO
|
|
|
|
that may be defined in
|
|
|
|
.IR <unistd.h> .
|
2008-03-19 08:46:32 +00:00
|
|
|
If it is undefined, one should ask at run time.
|
2004-11-03 13:51:07 +00:00
|
|
|
If it is defined to \-1, then the option is not supported.
|
|
|
|
If it is defined to 0, then relevant functions and headers exist,
|
|
|
|
but one has to ask at runtime what degree of support is available.
|
|
|
|
If it is defined to a value other than \-1 or 0, then the option is
|
2007-04-12 22:42:49 +00:00
|
|
|
supported.
|
|
|
|
Usually the value (such as 200112L) indicates the year and month
|
|
|
|
of the POSIX revision describing the option.
|
|
|
|
Glibc uses the value 1
|
2004-11-03 13:51:07 +00:00
|
|
|
to indicate support as long as the POSIX revision has not been published yet.
|
|
|
|
.\" and 999 to indicate support for options no longer present in the latest
|
|
|
|
.\" standard. (?)
|
|
|
|
The
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR sysconf ()
|
2004-11-03 13:51:07 +00:00
|
|
|
argument will be
|
|
|
|
.BR _SC_FOO .
|
|
|
|
For a list of options, see
|
|
|
|
.BR posixoptions (7).
|
|
|
|
.LP
|
|
|
|
For variables or limits, typically, there is a constant
|
|
|
|
.BR _FOO ,
|
|
|
|
maybe defined in
|
|
|
|
.IR <limits.h> ,
|
|
|
|
or
|
|
|
|
.BR _POSIX_FOO ,
|
|
|
|
maybe defined in
|
|
|
|
.IR <unistd.h> .
|
|
|
|
The constant will not be defined if the limit is unspecified.
|
|
|
|
If the constant is defined, it gives a guaranteed value, and
|
2008-07-14 14:26:50 +00:00
|
|
|
a greater value might actually be supported.
|
2004-11-03 13:51:07 +00:00
|
|
|
If an application wants to take advantage of values which may change
|
|
|
|
between systems, a call to
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR sysconf ()
|
2004-11-03 13:51:07 +00:00
|
|
|
can be made.
|
2007-04-12 22:42:49 +00:00
|
|
|
The
|
2005-10-19 14:16:57 +00:00
|
|
|
.BR sysconf ()
|
2004-11-03 13:51:07 +00:00
|
|
|
argument will be
|
|
|
|
.BR _SC_FOO .
|
2007-05-16 17:35:34 +00:00
|
|
|
.SS "POSIX.1 Variables"
|
2004-11-03 13:51:07 +00:00
|
|
|
We give the name of the variable, the name of the
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR sysconf ()
|
2008-07-10 20:53:08 +00:00
|
|
|
argument used to inquire about its value,
|
2004-11-03 13:51:07 +00:00
|
|
|
and a short description.
|
|
|
|
.LP
|
|
|
|
First, the POSIX.1 compatible values.
|
|
|
|
.\" [for the moment: only the things that are unconditionally present]
|
|
|
|
.\" .TP
|
|
|
|
.\" .BR AIO_LISTIO_MAX " - " _SC_AIO_LISTIO_MAX
|
|
|
|
.\" (if _POSIX_ASYNCHRONOUS_IO)
|
|
|
|
.\" Maximum number of I/O operations in a single list I/O call.
|
|
|
|
.\" Must not be less than _POSIX_AIO_LISTIO_MAX.
|
|
|
|
.\" .TP
|
|
|
|
.\" .BR AIO_MAX " - " _SC_AIO_MAX
|
|
|
|
.\" (if _POSIX_ASYNCHRONOUS_IO)
|
|
|
|
.\" Maximum number of outstanding asynchronous I/O operations.
|
|
|
|
.\" Must not be less than _POSIX_AIO_MAX.
|
|
|
|
.\" .TP
|
|
|
|
.\" .BR AIO_PRIO_DELTA_MAX " - " _SC_AIO_PRIO_DELTA_MAX
|
|
|
|
.\" (if _POSIX_ASYNCHRONOUS_IO)
|
|
|
|
.\" The maximum amount by which a process can decrease its
|
|
|
|
.\" asynchronous I/O priority level from its own scheduling priority.
|
_syscall.2, accept.2, epoll_create.2, inotify_add_watch.2, ioctl.2, msgget.2, msgop.2, open.2, prctl.2, sched_setscheduler.2, semctl.2, semget.2, swapon.2, addseverity.3, cacosh.3, csqrt.3, dirfd.3, drand48.3, fputws.3, mq_send.3, posix_openpt.3, puts.3, sched_getcpu.3, shm_open.3, sqrt.3, sysconf.3, tgamma.3, ulimit.3, credentials.7, svipc.7: Global fix: s/non-negative/nonnegative/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:44:48 +00:00
|
|
|
.\" Must be nonnegative.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR ARG_MAX " - " _SC_ARG_MAX
|
|
|
|
The maximum length of the arguments to the
|
2007-05-21 22:14:09 +00:00
|
|
|
.BR exec (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
family of functions.
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
|
|
|
.B _POSIX_ARG_MAX
|
|
|
|
(4096).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR CHILD_MAX " - " _SC_CHILD_MAX
|
2005-07-18 16:02:32 +00:00
|
|
|
The max number of simultaneous processes per user ID.
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
|
|
|
.B _POSIX_CHILD_MAX
|
|
|
|
(25).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR HOST_NAME_MAX " - " _SC_HOST_NAME_MAX
|
2007-04-12 22:42:49 +00:00
|
|
|
Max length of a hostname, not including the terminating null byte,
|
2006-01-13 02:09:44 +00:00
|
|
|
as returned by
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR gethostname (2).
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
|
|
|
.B _POSIX_HOST_NAME_MAX
|
|
|
|
(255).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR LOGIN_NAME_MAX " - " _SC_LOGIN_NAME_MAX
|
2006-01-13 02:09:44 +00:00
|
|
|
Maximum length of a login name, including the terminating null byte.
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
|
|
|
.B _POSIX_LOGIN_NAME_MAX
|
|
|
|
(9).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR "" "clock ticks - " _SC_CLK_TCK
|
|
|
|
The number of clock ticks per second.
|
2007-04-12 22:42:49 +00:00
|
|
|
The corresponding variable is obsolete.
|
|
|
|
It was of course called
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR CLK_TCK .
|
|
|
|
(Note: the macro
|
|
|
|
.B CLOCKS_PER_SEC
|
|
|
|
does not give information: it must equal 1000000.)
|
|
|
|
.TP
|
|
|
|
.BR OPEN_MAX " - " _SC_OPEN_MAX
|
|
|
|
The maximum number of files that a process can have open at any time.
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
|
|
|
.B _POSIX_OPEN_MAX
|
|
|
|
(20).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR PAGESIZE " - " _SC_PAGESIZE
|
2007-04-12 22:42:49 +00:00
|
|
|
Size of a page in bytes.
|
|
|
|
Must not be less than 1.
|
2004-11-03 13:51:07 +00:00
|
|
|
(Some systems use PAGE_SIZE instead.)
|
|
|
|
.TP
|
|
|
|
.BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
|
|
|
|
The number of repeated occurrences of a BRE permitted by
|
|
|
|
.BR regexec (3)
|
|
|
|
and
|
|
|
|
.BR regcomp (3).
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
|
|
|
.B _POSIX2_RE_DUP_MAX
|
|
|
|
(255).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR STREAM_MAX " - " _SC_STREAM_MAX
|
|
|
|
The maximum number of streams that a process can have open at any
|
2007-04-12 22:42:49 +00:00
|
|
|
time.
|
|
|
|
If defined, it has the same value as the standard C macro
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR FOPEN_MAX .
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
|
|
|
.B _POSIX_STREAM_MAX
|
|
|
|
(8).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2007-09-20 16:26:31 +00:00
|
|
|
.B SYMLOOP_MAX
|
2004-11-03 13:51:07 +00:00
|
|
|
The maximum number of symbolic links seen in a pathname before resolution
|
2007-06-22 20:40:07 +00:00
|
|
|
returns
|
|
|
|
.BR ELOOP .
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
|
|
|
.B _POSIX_SYMLOOP_MAX
|
|
|
|
(8).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR TTY_NAME_MAX " - " _SC_TTY_NAME_MAX
|
2007-04-12 22:42:49 +00:00
|
|
|
The maximum length of terminal device name,
|
2006-01-13 02:09:44 +00:00
|
|
|
including the terminating null byte.
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
2007-09-20 16:26:31 +00:00
|
|
|
.B _POSIX_TTY_NAME_MAX
|
2007-07-08 16:21:19 +00:00
|
|
|
(9).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR TZNAME_MAX " - " _SC_TZNAME_MAX
|
|
|
|
The maximum number of bytes in a timezone name.
|
2007-07-08 16:21:19 +00:00
|
|
|
Must not be less than
|
2007-09-20 16:26:31 +00:00
|
|
|
.B _POSIX_TZNAME_MAX
|
2007-07-08 16:21:19 +00:00
|
|
|
(6).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR _POSIX_VERSION " - " _SC_VERSION
|
|
|
|
indicates the year and month the POSIX.1 standard was approved in the
|
|
|
|
format
|
2007-12-10 15:03:27 +00:00
|
|
|
.BR YYYYMML ;
|
|
|
|
the value
|
2004-11-03 13:51:07 +00:00
|
|
|
.B 199009L
|
|
|
|
indicates the Sept. 1990 revision.
|
2007-05-16 17:35:34 +00:00
|
|
|
.SS "POSIX.2 Variables"
|
2004-11-03 13:51:07 +00:00
|
|
|
Next, the POSIX.2 values, giving limits for utilities.
|
|
|
|
.TP
|
|
|
|
.BR BC_BASE_MAX " - " _SC_BC_BASE_MAX
|
|
|
|
indicates the maximum
|
|
|
|
.I obase
|
|
|
|
value accepted by the
|
|
|
|
.BR bc (1)
|
|
|
|
utility.
|
|
|
|
.TP
|
|
|
|
.BR BC_DIM_MAX " - " _SC_BC_DIM_MAX
|
|
|
|
indicates the maximum value of elements permitted in an array by
|
|
|
|
.BR bc (1).
|
|
|
|
.TP
|
|
|
|
.BR BC_SCALE_MAX " - " _SC_BC_SCALE_MAX
|
|
|
|
indicates the maximum
|
|
|
|
.I scale
|
|
|
|
value allowed by
|
|
|
|
.BR bc (1).
|
|
|
|
.TP
|
|
|
|
.BR BC_STRING_MAX " - " _SC_BC_STRING_MAX
|
|
|
|
indicates the maximum length of a string accepted by
|
|
|
|
.BR bc (1).
|
|
|
|
.TP
|
|
|
|
.BR COLL_WEIGHTS_MAX " - " _SC_COLL_WEIGHTS_MAX
|
|
|
|
indicates the maximum numbers of weights that can be assigned to an
|
|
|
|
entry of the
|
|
|
|
.B LC_COLLATE order
|
|
|
|
keyword in the locale definition file,
|
|
|
|
.TP
|
|
|
|
.BR EXPR_NEST_MAX " - " _SC_EXPR_NEST_MAX
|
|
|
|
is the maximum number of expressions which can be nested within
|
|
|
|
parentheses by
|
|
|
|
.BR expr (1).
|
|
|
|
.TP
|
|
|
|
.BR LINE_MAX " - " _SC_LINE_MAX
|
|
|
|
The maximum length of a utility's input line length, either from
|
2007-04-12 22:42:49 +00:00
|
|
|
standard input or from a file.
|
|
|
|
This includes length for a trailing
|
2004-11-03 13:51:07 +00:00
|
|
|
newline.
|
|
|
|
.TP
|
|
|
|
.BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
|
|
|
|
The maximum number of repeated occurrences of a regular expression when
|
|
|
|
the interval notation
|
|
|
|
.B \e{m,n\e}
|
|
|
|
is used.
|
|
|
|
.TP
|
|
|
|
.BR POSIX2_VERSION " - " _SC_2_VERSION
|
|
|
|
indicates the version of the POSIX.2 standard in the format of
|
|
|
|
YYYYMML.
|
|
|
|
.TP
|
2005-06-21 11:30:37 +00:00
|
|
|
.BR POSIX2_C_DEV " - " _SC_2_C_DEV
|
2004-11-03 13:51:07 +00:00
|
|
|
indicates whether the POSIX.2 C language development facilities are
|
|
|
|
supported.
|
|
|
|
.TP
|
2004-12-20 10:45:56 +00:00
|
|
|
.BR POSIX2_FORT_DEV " - " _SC_2_FORT_DEV
|
2004-11-03 13:51:07 +00:00
|
|
|
indicates whether the POSIX.2 FORTRAN development utilities are
|
|
|
|
supported.
|
|
|
|
.TP
|
|
|
|
.BR POSIX2_FORT_RUN " - " _SC_2_FORT_RUN
|
|
|
|
indicates whether the POSIX.2 FORTRAN runtime utilities are supported.
|
|
|
|
.TP
|
|
|
|
.BR _POSIX2_LOCALEDEF " - " _SC_2_LOCALEDEF
|
|
|
|
indicates whether the POSIX.2 creation of locates via
|
|
|
|
.BR localedef (1)
|
|
|
|
is supported.
|
|
|
|
.TP
|
|
|
|
.BR POSIX2_SW_DEV " - " _SC_2_SW_DEV
|
|
|
|
indicates whether the POSIX.2 software development utilities option is
|
|
|
|
supported.
|
|
|
|
.PP
|
|
|
|
These values also exist, but may not be standard.
|
|
|
|
.TP
|
|
|
|
.BR "" " - " _SC_PHYS_PAGES
|
2007-04-12 22:42:49 +00:00
|
|
|
The number of pages of physical memory.
|
|
|
|
Note that it is possible
|
2004-11-03 13:51:07 +00:00
|
|
|
for the product of this value and the value of
|
|
|
|
.B _SC_PAGE_SIZE
|
|
|
|
to overflow.
|
|
|
|
.TP
|
|
|
|
.BR "" " - " _SC_AVPHYS_PAGES
|
|
|
|
The number of currently available pages of physical memory.
|
2007-11-29 21:16:50 +00:00
|
|
|
.TP
|
|
|
|
.BR "" " - " _SC_NPROCESSORS_CONF
|
|
|
|
The number of processors configured.
|
|
|
|
.TP
|
|
|
|
.BR "" " - " _SC_NPROCESSORS_ONLN
|
|
|
|
The number of processors currently online (available).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "RETURN VALUE"
|
|
|
|
If
|
|
|
|
.I name
|
|
|
|
is invalid, \-1 is returned, and
|
|
|
|
.I errno
|
|
|
|
is set to
|
|
|
|
.BR EINVAL .
|
|
|
|
Otherwise, the value returned is the value of the system resource and
|
|
|
|
.I errno
|
|
|
|
is not changed.
|
|
|
|
In the case of options, a positive value is returned if a queried option
|
|
|
|
is available, and \-1 if it is not.
|
|
|
|
In the case of limits, \-1 means that there is no definite limit.
|
|
|
|
.SH "CONFORMING TO"
|
2006-08-03 13:57:30 +00:00
|
|
|
POSIX.1-2001.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH BUGS
|
|
|
|
It is difficult to use
|
|
|
|
.B ARG_MAX
|
|
|
|
because it is not specified how much of the argument space for
|
2007-05-21 22:14:09 +00:00
|
|
|
.BR exec (3)
|
2004-11-03 13:51:07 +00:00
|
|
|
is consumed by the user's environment variables.
|
|
|
|
.PP
|
|
|
|
Some returned values may be huge; they are not suitable for allocating
|
|
|
|
memory.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR bc (1),
|
|
|
|
.BR expr (1),
|
2007-05-21 08:55:27 +00:00
|
|
|
.BR getconf (1),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR locale (1),
|
|
|
|
.BR fpathconf (3),
|
|
|
|
.BR pathconf (3),
|
|
|
|
.BR posixoptions (7)
|