575 lines
13 KiB
HTML
575 lines
13 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SYSCONF</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SYSCONF</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2019-05-09<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sysconf - get configuration information at run time
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/unistd.h">unistd.h</A>></B>
|
|
|
|
<B>long sysconf(int </B><I>name</I><B>);</B>
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
POSIX allows an application to test at compile or run time
|
|
whether certain options are supported, or what the value is
|
|
of certain configurable constants or limits.
|
|
<P>
|
|
|
|
At compile time this is done by including
|
|
<I><<A HREF="file:///usr/include/unistd.h">unistd.h</A>></I>
|
|
|
|
and/or
|
|
<I><<A HREF="file:///usr/include/limits.h">limits.h</A>></I>
|
|
|
|
and testing the value of certain macros.
|
|
<P>
|
|
|
|
At run time, one can ask for numerical values using the present function
|
|
<B>sysconf</B>().
|
|
|
|
One can ask for numerical values that may depend
|
|
on the filesystem in which a file resides using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fpathconf">fpathconf</A></B>(3)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pathconf">pathconf</A></B>(3).
|
|
|
|
One can ask for string values using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+confstr">confstr</A></B>(3).
|
|
|
|
<P>
|
|
|
|
The values obtained from these functions are system configuration constants.
|
|
They do not change during the lifetime of a process.
|
|
|
|
|
|
<P>
|
|
|
|
For options, typically, there is a constant
|
|
<B>_POSIX_FOO</B>
|
|
|
|
that may be defined in
|
|
<I><<A HREF="file:///usr/include/unistd.h">unistd.h</A>></I>.
|
|
|
|
If it is undefined, one should ask at run time.
|
|
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 run time what degree of support is available.
|
|
If it is defined to a value other than -1 or 0, then the option is
|
|
supported.
|
|
Usually the value (such as 200112L) indicates the year and month
|
|
of the POSIX revision describing the option.
|
|
Glibc uses the value 1
|
|
to indicate support as long as the POSIX revision has not been published yet.
|
|
|
|
|
|
The
|
|
<B>sysconf</B>()
|
|
|
|
argument will be
|
|
<B>_SC_FOO</B>.
|
|
|
|
For a list of options, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+posixoptions">posixoptions</A></B>(7).
|
|
|
|
<P>
|
|
|
|
For variables or limits, typically, there is a constant
|
|
<B>_FOO</B>,
|
|
|
|
maybe defined in
|
|
<I><<A HREF="file:///usr/include/limits.h">limits.h</A>></I>,
|
|
|
|
or
|
|
<B>_POSIX_FOO</B>,
|
|
|
|
maybe defined in
|
|
<I><<A HREF="file:///usr/include/unistd.h">unistd.h</A>></I>.
|
|
|
|
The constant will not be defined if the limit is unspecified.
|
|
If the constant is defined, it gives a guaranteed value, and
|
|
a greater value might actually be supported.
|
|
If an application wants to take advantage of values which may change
|
|
between systems, a call to
|
|
<B>sysconf</B>()
|
|
|
|
can be made.
|
|
The
|
|
<B>sysconf</B>()
|
|
|
|
argument will be
|
|
<B>_SC_FOO</B>.
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H3>POSIX.1 variables</H3>
|
|
|
|
We give the name of the variable, the name of the
|
|
<B>sysconf</B>()
|
|
|
|
argument used to inquire about its value,
|
|
and a short description.
|
|
<P>
|
|
|
|
First, the POSIX.1 compatible values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>ARG_MAX</B> - <B>_SC_ARG_MAX</B>
|
|
|
|
<DD>
|
|
The maximum length of the arguments to the
|
|
<B><A HREF="/cgi-bin/man/man2html?3+exec">exec</A></B>(3)
|
|
|
|
family of functions.
|
|
Must not be less than
|
|
<B>_POSIX_ARG_MAX</B>
|
|
|
|
(4096).
|
|
<DT id="2"><B>CHILD_MAX</B> - <B>_SC_CHILD_MAX</B>
|
|
|
|
<DD>
|
|
The maximum number of simultaneous processes per user ID.
|
|
Must not be less than
|
|
<B>_POSIX_CHILD_MAX</B>
|
|
|
|
(25).
|
|
<DT id="3"><B>HOST_NAME_MAX</B> - <B>_SC_HOST_NAME_MAX</B>
|
|
|
|
<DD>
|
|
Maximum length of a hostname, not including the terminating null byte,
|
|
as returned by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+gethostname">gethostname</A></B>(2).
|
|
|
|
Must not be less than
|
|
<B>_POSIX_HOST_NAME_MAX</B>
|
|
|
|
(255).
|
|
<DT id="4"><B>LOGIN_NAME_MAX</B> - <B>_SC_LOGIN_NAME_MAX</B>
|
|
|
|
<DD>
|
|
Maximum length of a login name, including the terminating null byte.
|
|
Must not be less than
|
|
<B>_POSIX_LOGIN_NAME_MAX</B>
|
|
|
|
(9).
|
|
<DT id="5"><B>NGROUPS_MAX</B> - <B>_SC_NGROUPS_MAX</B>
|
|
|
|
<DD>
|
|
Maximum number of supplementary group IDs.
|
|
<DT id="6"><B></B>clock ticks - <B>_SC_CLK_TCK</B>
|
|
|
|
<DD>
|
|
The number of clock ticks per second.
|
|
The corresponding variable is obsolete.
|
|
It was of course called
|
|
<B>CLK_TCK</B>.
|
|
|
|
(Note: the macro
|
|
<B>CLOCKS_PER_SEC</B>
|
|
|
|
does not give information: it must equal 1000000.)
|
|
<DT id="7"><B>OPEN_MAX</B> - <B>_SC_OPEN_MAX</B>
|
|
|
|
<DD>
|
|
The maximum number of files that a process can have open at any time.
|
|
Must not be less than
|
|
<B>_POSIX_OPEN_MAX</B>
|
|
|
|
(20).
|
|
<DT id="8"><B>PAGESIZE</B> - <B>_SC_PAGESIZE</B>
|
|
|
|
<DD>
|
|
Size of a page in bytes.
|
|
Must not be less than 1.
|
|
<DT id="9"><B>PAGE_SIZE</B> - <B>_SC_PAGE_SIZE</B>
|
|
|
|
<DD>
|
|
A synonym for
|
|
<B>PAGESIZE</B>/<B>_SC_PAGESIZE</B>.
|
|
|
|
(Both
|
|
<B>PAGESIZE</B>
|
|
|
|
and
|
|
<B>PAGE_SIZE</B>
|
|
|
|
are specified in POSIX.)
|
|
<DT id="10"><B>RE_DUP_MAX</B> - <B>_SC_RE_DUP_MAX</B>
|
|
|
|
<DD>
|
|
The number of repeated occurrences of a BRE permitted by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+regexec">regexec</A></B>(3)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+regcomp">regcomp</A></B>(3).
|
|
|
|
Must not be less than
|
|
<B>_POSIX2_RE_DUP_MAX</B>
|
|
|
|
(255).
|
|
<DT id="11"><B>STREAM_MAX</B> - <B>_SC_STREAM_MAX</B>
|
|
|
|
<DD>
|
|
The maximum number of streams that a process can have open at any
|
|
time.
|
|
If defined, it has the same value as the standard C macro
|
|
<B>FOPEN_MAX</B>.
|
|
|
|
Must not be less than
|
|
<B>_POSIX_STREAM_MAX</B>
|
|
|
|
(8).
|
|
<DT id="12"><B>SYMLOOP_MAX</B> - <B>_SC_SYMLOOP_MAX</B>
|
|
|
|
<DD>
|
|
The maximum number of symbolic links seen in a pathname before resolution
|
|
returns
|
|
<B>ELOOP</B>.
|
|
|
|
Must not be less than
|
|
<B>_POSIX_SYMLOOP_MAX</B>
|
|
|
|
(8).
|
|
<DT id="13"><B>TTY_NAME_MAX</B> - <B>_SC_TTY_NAME_MAX</B>
|
|
|
|
<DD>
|
|
The maximum length of terminal device name,
|
|
including the terminating null byte.
|
|
Must not be less than
|
|
<B>_POSIX_TTY_NAME_MAX</B>
|
|
|
|
(9).
|
|
<DT id="14"><B>TZNAME_MAX</B> - <B>_SC_TZNAME_MAX</B>
|
|
|
|
<DD>
|
|
The maximum number of bytes in a timezone name.
|
|
Must not be less than
|
|
<B>_POSIX_TZNAME_MAX</B>
|
|
|
|
(6).
|
|
<DT id="15"><B>_POSIX_VERSION</B> - <B>_SC_VERSION</B>
|
|
|
|
<DD>
|
|
indicates the year and month the POSIX.1 standard was approved in the
|
|
format
|
|
<B>YYYYMML</B>;
|
|
|
|
the value
|
|
<B>199009L</B>
|
|
|
|
indicates the Sept. 1990 revision.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H3>POSIX.2 variables</H3>
|
|
|
|
Next, the POSIX.2 values, giving limits for utilities.
|
|
<DL COMPACT>
|
|
<DT id="16"><B>BC_BASE_MAX</B> - <B>_SC_BC_BASE_MAX</B>
|
|
|
|
<DD>
|
|
indicates the maximum
|
|
<I>obase</I>
|
|
|
|
value accepted by the
|
|
<B><A HREF="/cgi-bin/man/man2html?1+bc">bc</A></B>(1)
|
|
|
|
utility.
|
|
<DT id="17"><B>BC_DIM_MAX</B> - <B>_SC_BC_DIM_MAX</B>
|
|
|
|
<DD>
|
|
indicates the maximum value of elements permitted in an array by
|
|
<B><A HREF="/cgi-bin/man/man2html?1+bc">bc</A></B>(1).
|
|
|
|
<DT id="18"><B>BC_SCALE_MAX</B> - <B>_SC_BC_SCALE_MAX</B>
|
|
|
|
<DD>
|
|
indicates the maximum
|
|
<I>scale</I>
|
|
|
|
value allowed by
|
|
<B><A HREF="/cgi-bin/man/man2html?1+bc">bc</A></B>(1).
|
|
|
|
<DT id="19"><B>BC_STRING_MAX</B> - <B>_SC_BC_STRING_MAX</B>
|
|
|
|
<DD>
|
|
indicates the maximum length of a string accepted by
|
|
<B><A HREF="/cgi-bin/man/man2html?1+bc">bc</A></B>(1).
|
|
|
|
<DT id="20"><B>COLL_WEIGHTS_MAX</B> - <B>_SC_COLL_WEIGHTS_MAX</B>
|
|
|
|
<DD>
|
|
indicates the maximum numbers of weights that can be assigned to an
|
|
entry of the
|
|
<B>LC_COLLATE order</B>
|
|
|
|
keyword in the locale definition file,
|
|
<DT id="21"><B>EXPR_NEST_MAX</B> - <B>_SC_EXPR_NEST_MAX</B>
|
|
|
|
<DD>
|
|
is the maximum number of expressions which can be nested within
|
|
parentheses by
|
|
<B><A HREF="/cgi-bin/man/man2html?1+expr">expr</A></B>(1).
|
|
|
|
<DT id="22"><B>LINE_MAX</B> - <B>_SC_LINE_MAX</B>
|
|
|
|
<DD>
|
|
The maximum length of a utility's input line, either from
|
|
standard input or from a file.
|
|
This includes space for a trailing
|
|
newline.
|
|
<DT id="23"><B>RE_DUP_MAX</B> - <B>_SC_RE_DUP_MAX</B>
|
|
|
|
<DD>
|
|
The maximum number of repeated occurrences of a regular expression when
|
|
the interval notation
|
|
<B>\{m,n\}</B>
|
|
|
|
is used.
|
|
<DT id="24"><B>POSIX2_VERSION</B> - <B>_SC_2_VERSION</B>
|
|
|
|
<DD>
|
|
indicates the version of the POSIX.2 standard in the format of
|
|
YYYYMML.
|
|
<DT id="25"><B>POSIX2_C_DEV</B> - <B>_SC_2_C_DEV</B>
|
|
|
|
<DD>
|
|
indicates whether the POSIX.2 C language development facilities are
|
|
supported.
|
|
<DT id="26"><B>POSIX2_FORT_DEV</B> - <B>_SC_2_FORT_DEV</B>
|
|
|
|
<DD>
|
|
indicates whether the POSIX.2 FORTRAN development utilities are
|
|
supported.
|
|
<DT id="27"><B>POSIX2_FORT_RUN</B> - <B>_SC_2_FORT_RUN</B>
|
|
|
|
<DD>
|
|
indicates whether the POSIX.2 FORTRAN run-time utilities are supported.
|
|
<DT id="28"><B>_POSIX2_LOCALEDEF</B> - <B>_SC_2_LOCALEDEF</B>
|
|
|
|
<DD>
|
|
indicates whether the POSIX.2 creation of locates via
|
|
<B><A HREF="/cgi-bin/man/man2html?1+localedef">localedef</A></B>(1)
|
|
|
|
is supported.
|
|
<DT id="29"><B>POSIX2_SW_DEV</B> - <B>_SC_2_SW_DEV</B>
|
|
|
|
<DD>
|
|
indicates whether the POSIX.2 software development utilities option is
|
|
supported.
|
|
</DL>
|
|
<P>
|
|
|
|
These values also exist, but may not be standard.
|
|
<DL COMPACT>
|
|
<DT id="30"><B></B> - <B>_SC_PHYS_PAGES</B>
|
|
|
|
<DD>
|
|
The number of pages of physical memory.
|
|
Note that it is possible
|
|
for the product of this value and the value of
|
|
<B>_SC_PAGESIZE</B>
|
|
|
|
to overflow.
|
|
<DT id="31"><B></B> - <B>_SC_AVPHYS_PAGES</B>
|
|
|
|
<DD>
|
|
The number of currently available pages of physical memory.
|
|
<DT id="32"><B></B> - <B>_SC_NPROCESSORS_CONF</B>
|
|
|
|
<DD>
|
|
The number of processors configured.
|
|
See also
|
|
<B><A HREF="/cgi-bin/man/man2html?3+get_nprocs_conf">get_nprocs_conf</A></B>(3).
|
|
|
|
<DT id="33"><B></B> - <B>_SC_NPROCESSORS_ONLN</B>
|
|
|
|
<DD>
|
|
The number of processors currently online (available).
|
|
See also
|
|
<B><A HREF="/cgi-bin/man/man2html?3+get_nprocs_conf">get_nprocs_conf</A></B>(3).
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
The return value of
|
|
<B>sysconf</B>()
|
|
|
|
is one of the following:
|
|
<DL COMPACT>
|
|
<DT id="34">*<DD>
|
|
On error, -1 is returned and
|
|
<I>errno</I>
|
|
|
|
is set to indicate the cause of the error
|
|
(for example,
|
|
<B>EINVAL</B>,
|
|
|
|
indicating that
|
|
<I>name</I>
|
|
|
|
is invalid).
|
|
<DT id="35">*<DD>
|
|
If
|
|
<I>name</I>
|
|
|
|
corresponds to a maximum or minimum limit, and that limit is indeterminate,
|
|
-1 is returned and
|
|
<I>errno</I>
|
|
|
|
is not changed.
|
|
(To distinguish an indeterminate limit from an error, set
|
|
<I>errno</I>
|
|
|
|
to zero before the call, and then check whether
|
|
<I>errno</I>
|
|
|
|
is nonzero when -1 is returned.)
|
|
<DT id="36">*<DD>
|
|
If
|
|
<I>name</I>
|
|
|
|
corresponds to an option,
|
|
a positive value is returned if the option is supported,
|
|
and -1 is returned if the option is not supported.
|
|
<DT id="37">*<DD>
|
|
Otherwise,
|
|
the current value of the option or limit is returned.
|
|
This value will not be more restrictive than
|
|
the corresponding value that was described to the application in
|
|
<I><<A HREF="file:///usr/include/unistd.h">unistd.h</A>></I>
|
|
|
|
or
|
|
<I><<A HREF="file:///usr/include/limits.h">limits.h</A>></I>
|
|
|
|
when the application was compiled.
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="38"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
<I>name</I>
|
|
|
|
is invalid.
|
|
</DL>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>sysconf</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe env<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
It is difficult to use
|
|
<B>ARG_MAX</B>
|
|
|
|
because it is not specified how much of the argument space for
|
|
<B><A HREF="/cgi-bin/man/man2html?3+exec">exec</A></B>(3)
|
|
|
|
is consumed by the user's environment variables.
|
|
<P>
|
|
|
|
Some returned values may be huge; they are not suitable for allocating
|
|
memory.
|
|
<A NAME="lbAL"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+bc">bc</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+expr">expr</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+getconf">getconf</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+locale">locale</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+confstr">confstr</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fpathconf">fpathconf</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pathconf">pathconf</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+posixoptions">posixoptions</A></B>(7)
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="39"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="40"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="41"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="42"><A HREF="#lbAE">POSIX.1 variables</A><DD>
|
|
<DT id="43"><A HREF="#lbAF">POSIX.2 variables</A><DD>
|
|
</DL>
|
|
<DT id="44"><A HREF="#lbAG">RETURN VALUE</A><DD>
|
|
<DT id="45"><A HREF="#lbAH">ERRORS</A><DD>
|
|
<DT id="46"><A HREF="#lbAI">ATTRIBUTES</A><DD>
|
|
<DT id="47"><A HREF="#lbAJ">CONFORMING TO</A><DD>
|
|
<DT id="48"><A HREF="#lbAK">BUGS</A><DD>
|
|
<DT id="49"><A HREF="#lbAL">SEE ALSO</A><DD>
|
|
<DT id="50"><A HREF="#lbAM">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:58 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|