?? library_27.html
字號:
<!-- This HTML file has been created by texi2html 1.27
from library.texinfo on 3 March 1994 -->
<TITLE>The GNU C Library - System Configuration Parameters</TITLE>
<P>Go to the <A HREF="library_26.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_26.html">previous</A>, <A HREF="library_28.html" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_28.html">next</A> section.<P>
<H1><A NAME="SEC454" HREF="library_toc.html#SEC454" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC454">System Configuration Parameters</A></H1>
<P>
The functions and macros listed in this chapter give information about
configuration parameters of the operating system--for example, capacity
limits, presence of optional POSIX features, and the default path for
executable files (see section <A HREF="library_27.html#SEC469" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC469">String-Valued Parameters</A>).
<P>
<A NAME="IDX1857"></A>
<A NAME="IDX1858"></A>
<A NAME="IDX1859"></A>
<H2><A NAME="SEC455" HREF="library_toc.html#SEC455" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC455">General Capacity Limits</A></H2>
<P>
The POSIX.1 and POSIX.2 standards specify a number of parameters that
describe capacity limitations of the system. These limits can be fixed
constants for a given operating system, or they can vary from machine to
machine. For example, some limit values may be configurable by the
system administrator, either at run time or by rebuilding the kernel,
and this should not require recompiling application programs.
<A NAME="IDX1860"></A>
<P>
Each of the following limit parameters has a macro that is defined in
<TT>`limits.h'</TT> only if the system has a fixed, uniform limit for the
parameter in question. If the system allows different file systems or
files to have different limits, then the macro is undefined; use
<CODE>sysconf</CODE> to find out the limit that applies at a particular time
on a particular machine. See section <A HREF="library_27.html#SEC458" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC458">Using <CODE>sysconf</CODE></A>.
<P>
Each of these parameters also has another macro, with a name starting
with <SAMP>`_POSIX'</SAMP>, which gives the lowest value that the limit is
allowed to have on <EM>any</EM> POSIX system. See section <A HREF="library_27.html#SEC462" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC462">Minimum Values for General Capacity Limits</A>.
<A NAME="IDX1861"></A>
<P>
<A NAME="IDX1862"></A>
<U>Macro:</U> int <B>ARG_MAX</B><P>
If defined, the unvarying maximum combined length of the <VAR>argv</VAR> and
<VAR>environ</VAR> arguments that can be passed to the <CODE>exec</CODE> functions.
<P>
<A NAME="IDX1863"></A>
<P>
<A NAME="IDX1864"></A>
<U>Macro:</U> int <B>CHILD_MAX</B><P>
If defined, the unvarying maximum number of processes that can exist
with the same real user ID at any one time.
<P>
<A NAME="IDX1865"></A>
<P>
<A NAME="IDX1866"></A>
<U>Macro:</U> int <B>OPEN_MAX</B><P>
If defined, the unvarying maximum number of files that a single process
can have open simultaneously.
<P>
<A NAME="IDX1867"></A>
<U>Macro:</U> int <B>STREAM_MAX</B><P>
If defined, the unvarying maximum number of streams that a single
process can have open simultaneously. See section <A HREF="library_11.html#SEC120" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_11.html#SEC120">Opening Streams</A>.
<P>
<A NAME="IDX1868"></A>
<P>
<A NAME="IDX1869"></A>
<U>Macro:</U> int <B>TZNAME_MAX</B><P>
If defined, the unvarying maximum length of a time zone name.
See section <A HREF="library_19.html#SEC319" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_19.html#SEC319">Functions and Variables for Time Zones</A>.
<P>
These limit macros are always defined in <TT>`limits.h'</TT>.
<A NAME="IDX1870"></A>
<P>
<A NAME="IDX1871"></A>
<U>Macro:</U> int <B>NGROUPS_MAX</B><P>
The maximum number of supplementary group IDs that one process can have.
<P>
The value of this macro is actually a lower bound for the maximum. That
is, you can count on being able to have that many supplementary group
IDs, but a particular machine might let you have even more. You can use
<CODE>sysconf</CODE> to see whether a particular machine will let you have
more (see section <A HREF="library_27.html#SEC458" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC458">Using <CODE>sysconf</CODE></A>).
<P>
<A NAME="IDX1872"></A>
<U>Macro:</U> int <B>SSIZE_MAX</B><P>
The largest value that can fit in an object of type <CODE>ssize_t</CODE>.
Effectively, this is the limit on the number of bytes that can be read
or written in a single operation.
<P>
This macro is defined in all POSIX systems because this limit is never
configurable.
<P>
<A NAME="IDX1873"></A>
<U>Macro:</U> int <B>RE_DUP_MAX</B><P>
The largest number of repetitions you are guaranteed is allowed in the
construct <SAMP>`\{<VAR>min</VAR>,<VAR>max</VAR>\}'</SAMP> in a regular expression.
<P>
The value of this macro is actually a lower bound for the maximum. That
is, you can count on being able to have that many supplementary group
IDs, but a particular machine might let you have even more. You can use
<CODE>sysconf</CODE> to see whether a particular machine will let you have
more (see section <A HREF="library_27.html#SEC458" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC458">Using <CODE>sysconf</CODE></A>). And even the value that <CODE>sysconf</CODE> tells
you is just a lower bound--larger values might work.
<P>
This macro is defined in all POSIX.2 systems, because POSIX.2 says it
should always be defined even if there is no specific imposed limit.
<P>
<A NAME="IDX1874"></A>
<A NAME="IDX1875"></A>
<H2><A NAME="SEC456" HREF="library_toc.html#SEC456" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC456">Overall System Options</A></H2>
<P>
POSIX defines certain system-specific options that not all POSIX systems
support. Since these options are provided in the kernel, not in the
library, simply using the GNU C library does not guarantee any of these
features is supported; it depends on the system you are using.
<A NAME="IDX1876"></A>
<P>
You can test for the availability of a given option using the macros in
this section, together with the function <CODE>sysconf</CODE>. The macros are
defined only if you include <TT>`unistd.h'</TT>.
<P>
For the following macros, if the macro is defined in <TT>`unistd.h'</TT>,
then the option is supported. Otherwise, the option may or may not be
supported; use <CODE>sysconf</CODE> to find out. See section <A HREF="library_27.html#SEC458" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC458">Using <CODE>sysconf</CODE></A>.
<P>
<A NAME="IDX1877"></A>
<U>Macro:</U> int <B>_POSIX_JOB_CONTROL</B><P>
If this symbol is defined, it indicates that the system supports job
control. Otherwise, the implementation behaves as if all processes
within a session belong to a single process group. See section <A HREF="library_24.html#SEC411" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html#SEC411">Job Control</A>.
<P>
<A NAME="IDX1878"></A>
<U>Macro:</U> int <B>_POSIX_SAVED_IDS</B><P>
If this symbol is defined, it indicates that the system remembers the
effective user and group IDs of a process before it executes an
executable file with the set-user-ID or set-group-ID bits set, and that
explicitly changing the effective user or group IDs back to these values
is permitted. If this option is not defined, then if a nonprivileged
process changes its effective user or group ID to the real user or group
ID of the process, it can't change it back again. See section <A HREF="library_25.html#SEC437" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_25.html#SEC437">Enabling and Disabling Setuid Access</A>.
<P>
For the following macros, if the macro is defined in <TT>`unistd.h'</TT>,
then its value indicates whether the option is supported. A value of
<CODE>-1</CODE> means no, and any other value means yes. If the macro is not
defined, then the option may or may not be supported; use <CODE>sysconf</CODE>
to find out. See section <A HREF="library_27.html#SEC458" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC458">Using <CODE>sysconf</CODE></A>.
<P>
<A NAME="IDX1879"></A>
<U>Macro:</U> int <B>_POSIX2_C_DEV</B><P>
If this symbol is defined, it indicates that the system has the POSIX.2
C compiler command, <CODE>c89</CODE>. The GNU C library always defines this
as <CODE>1</CODE>, on the assumption that you would not have installed it if
you didn't have a C compiler.
<P>
<A NAME="IDX1880"></A>
<U>Macro:</U> int <B>_POSIX2_FORT_DEV</B><P>
If this symbol is defined, it indicates that the system has the POSIX.2
Fortran compiler command, <CODE>fort77</CODE>. The GNU C library never
defines this, because we don't know what the system has.
<P>
<A NAME="IDX1881"></A>
<U>Macro:</U> int <B>_POSIX2_FORT_RUN</B><P>
If this symbol is defined, it indicates that the system has the POSIX.2
<CODE>asa</CODE> command to interpret Fortran carriage control. The GNU C
library never defines this, because we don't know what the system has.
<P>
<A NAME="IDX1882"></A>
<U>Macro:</U> int <B>_POSIX2_LOCALEDEF</B><P>
If this symbol is defined, it indicates that the system has the POSIX.2
<CODE>localedef</CODE> command. The GNU C library never defines this, because
we don't know what the system has.
<P>
<A NAME="IDX1883"></A>
<U>Macro:</U> int <B>_POSIX2_SW_DEV</B><P>
If this symbol is defined, it indicates that the system has the POSIX.2
commands <CODE>ar</CODE>, <CODE>make</CODE>, and <CODE>strip</CODE>. The GNU C library
always defines this as <CODE>1</CODE>, on the assumption that you had to have
<CODE>ar</CODE> and <CODE>make</CODE> to install the library, and it's unlikely that
<CODE>strip</CODE> would be absent when those are present.
<P>
<H2><A NAME="SEC457" HREF="library_toc.html#SEC457" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC457">Which Version of POSIX is Supported</A></H2>
<P>
<A NAME="IDX1884"></A>
<U>Macro:</U> long int <B>_POSIX_VERSION</B><P>
This constant represents the version of the POSIX.1 standard to which
the implementation conforms. For an implementation conforming to the
1990 POSIX.1 standard, the value is the integer <CODE>199009L</CODE>.
<P>
<CODE>_POSIX_VERSION</CODE> is always defined (in <TT>`unistd.h'</TT>) in any
POSIX system.
<P>
<STRONG>Usage Note:</STRONG> Don't try to test whether the system supports POSIX
by including <TT>`unistd.h'</TT> and then checking whether
<CODE>_POSIX_VERSION</CODE> is defined. On a non-POSIX system, this will
probably fail because there is no <TT>`unistd.h'</TT>. We do not know of
<EM>any</EM> way you can reliably test at compilation time whether your
target system supports POSIX or whether <TT>`unistd.h'</TT> exists.
<P>
The GNU C compiler predefines the symbol <CODE>__POSIX__</CODE> if the target
system is a POSIX system. Provided you do not use any other compilers
on POSIX systems, testing <CODE>defined (__POSIX__)</CODE> will reliably
detect such systems.
<P>
<A NAME="IDX1885"></A>
<U>Macro:</U> long int <B>_POSIX2_C_VERSION</B><P>
This constant represents the version of the POSIX.2 standard which the
library and system kernel support. We don't know what value this will
be for the first version of the POSIX.2 standard, because the value is
based on the year and month in which the standard is officially adopted.
<P>
The value of this symbol says nothing about the utilities installed on
the system.
<P>
<STRONG>Usage Note:</STRONG> You can use this macro to tell whether a POSIX.1
system library supports POSIX.2 as well. Any POSIX.1 system contains
<TT>`unistd.h'</TT>, so include that file and then test <CODE>defined
(_POSIX2_C_VERSION)</CODE>.
<P>
<H2><A NAME="SEC458" HREF="library_toc.html#SEC458" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC458">Using <CODE>sysconf</CODE></A></H2>
<P>
When your system has configurable system limits, you can use the
<CODE>sysconf</CODE> function to find out the value that applies to any
particular machine. The function and the associated <VAR>parameter</VAR>
constants are declared in the header file <TT>`unistd.h'</TT>.
<P>
<H3><A NAME="SEC459" HREF="library_toc.html#SEC459" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC459">Definition of <CODE>sysconf</CODE></A></H3>
<P>
<A NAME="IDX1886"></A>
<U>Function:</U> long int <B>sysconf</B> <I>(int <VAR>parameter</VAR>)</I><P>
This function is used to inquire about runtime system parameters. The
<VAR>parameter</VAR> argument should be one of the <SAMP>`_SC_'</SAMP> symbols listed
below.
<P>
The normal return value from <CODE>sysconf</CODE> is the value you requested.
A value of <CODE>-1</CODE> is returned both if the implementation does not
impose a limit, and in case of an error.
<P>
The following <CODE>errno</CODE> error conditions are defined for this function:
<P>
<DL COMPACT>
<DT><CODE>EINVAL</CODE>
<DD>The value of the <VAR>parameter</VAR> is invalid.
</DL>
<P>
<H3><A NAME="SEC460" HREF="library_toc.html#SEC460" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC460">Constants for <CODE>sysconf</CODE> Parameters</A></H3>
<P>
Here are the symbolic constants for use as the <VAR>parameter</VAR> argument
to <CODE>sysconf</CODE>. The values are all integer constants (more
specifically, enumeration type values).
<P>
<DL COMPACT>
<DT><CODE>_SC_ARG_MAX</CODE>
<DD>Inquire about the parameter corresponding to <CODE>ARG_MAX</CODE>.
<P>
<DT><CODE>_SC_CHILD_MAX</CODE>
<DD>Inquire about the parameter corresponding to <CODE>CHILD_MAX</CODE>.
<P>
<DT><CODE>_SC_OPEN_MAX</CODE>
<DD>Inquire about the parameter corresponding to <CODE>OPEN_MAX</CODE>.
<P>
<DT><CODE>_SC_STREAM_MAX</CODE>
<DD>Inquire about the parameter corresponding to <CODE>STREAM_MAX</CODE>.
<P>
<DT><CODE>_SC_TZNAME_MAX</CODE>
<DD>Inquire about the parameter corresponding to <CODE>TZNAME_MAX</CODE>.
<P>
<DT><CODE>_SC_NGROUPS_MAX</CODE>
<DD>Inquire about the parameter corresponding to <CODE>NGROUPS_MAX</CODE>.
<P>
<DT><CODE>_SC_JOB_CONTROL</CODE>
<DD>Inquire about the parameter corresponding to <CODE>_POSIX_JOB_CONTROL</CODE>.
<P>
<DT><CODE>_SC_SAVED_IDS</CODE>
<DD>Inquire about the parameter corresponding to <CODE>_POSIX_SAVED_IDS</CODE>.
<P>
<DT><CODE>_SC_VERSION</CODE>
<DD>Inquire about the parameter corresponding to <CODE>_POSIX_VERSION</CODE>.
<P>
<DT><CODE>_SC_CLK_TCK</CODE>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -