📄 library_27.html
字号:
<DD>Inquire about the parameter corresponding to <CODE>CLOCKS_PER_SEC</CODE>;
see section <A HREF="library_19.html#SEC311" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_19.html#SEC311">Basic CPU Time Inquiry</A>.
<P>
<DT><CODE>_SC_2_C_DEV</CODE>
<DD>Inquire about whether the system has the POSIX.2 C compiler command,
<CODE>c89</CODE>.
<P>
<DT><CODE>_SC_2_FORT_DEV</CODE>
<DD>Inquire about whether the system has the POSIX.2 Fortran compiler
command, <CODE>fort77</CODE>.
<P>
<DT><CODE>_SC_2_FORT_RUN</CODE>
<DD>Inquire about whether the system has the POSIX.2 <CODE>asa</CODE> command to
interpret Fortran carriage control.
<P>
<DT><CODE>_SC_2_LOCALEDEF</CODE>
<DD>Inquire about whether the system has the POSIX.2 <CODE>localedef</CODE>
command.
<P>
<DT><CODE>_SC_2_SW_DEV</CODE>
<DD>Inquire about whether the system has the POSIX.2 commands <CODE>ar</CODE>,
<CODE>make</CODE>, and <CODE>strip</CODE>.
<P>
<DT><CODE>_SC_BC_BASE_MAX</CODE>
<DD>Inquire about the maximum value of <CODE>obase</CODE> in the <CODE>bc</CODE>
utility.
<P>
<DT><CODE>_SC_BC_DIM_MAX</CODE>
<DD>Inquire about the maximum size of an array in the <CODE>bc</CODE>
utility.
<P>
<DT><CODE>_SC_BC_SCALE_MAX</CODE>
<DD>Inquire about the maximum value of <CODE>scale</CODE> in the <CODE>bc</CODE>
utility.
<P>
<DT><CODE>_SC_BC_STRING_MAX</CODE>
<DD>Inquire about the maximum size of a string constant in the
<CODE>bc</CODE> utility.
<P>
<DT><CODE>_SC_COLL_WEIGHTS_MAX</CODE>
<DD>Inquire about the maximum number of weights that can necessarily
be used in defining the collating sequence for a locale.
<P>
<DT><CODE>_SC_EXPR_NEST_MAX</CODE>
<DD>Inquire about the maximum number of expressions nested within
parentheses when using the <CODE>expr</CODE> utility.
<P>
<DT><CODE>_SC_LINE_MAX</CODE>
<DD>Inquire about the maximum size of a text line that the POSIX.2 text
utilities can handle.
<P>
<DT><CODE>_SC_VERSION</CODE>
<DD>Inquire about the version number of POSIX.1 that the library and kernel
support.
<P>
<DT><CODE>_SC_2_VERSION</CODE>
<DD>Inquire about the version number of POSIX.2 that the system utilities
support.
</DL>
<P>
<H3><A NAME="SEC461" HREF="library_toc.html#SEC461" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC461">Examples of <CODE>sysconf</CODE></A></H3>
<P>
We recommend that you first test for a macro definition for the
parameter you are interested in, and call <CODE>sysconf</CODE> only if the
macro is not defined. For example, here is how to test whether job
control is supported:
<P>
<PRE>
int
have_job_control (void)
{
#ifdef _POSIX_JOB_CONTROL
return 1;
#else
int value = sysconf (_SC_JOB_CONTROL);
if (value < 0)
/* If the system is that badly wedged,
there's no use trying to go on. */
fatal (strerror (errno));
return value;
#endif
}
</PRE>
<P>
Here is how to get the value of a numeric limit:
<P>
<PRE>
int
get_child_max ()
{
#ifdef CHILD_MAX
return CHILD_MAX;
#else
int value = sysconf (_SC_CHILD_MAX);
if (value < 0)
fatal (strerror (errno));
return value;
#endif
}
</PRE>
<P>
<H2><A NAME="SEC462" HREF="library_toc.html#SEC462" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC462">Minimum Values for General Capacity Limits</A></H2>
<P>
Here are the names for the POSIX minimum upper bounds for the system
limit parameters. The significance of these values is that you can
safely push to these limits without checking whether the particular
system you are using can go that far.
<P>
<DL COMPACT>
<DT><CODE>_POSIX_ARG_MAX</CODE>
<DD>The value of this macro is the most restrictive limit permitted by POSIX
for the maximum combined length of the <VAR>argv</VAR> and <VAR>environ</VAR>
arguments that can be passed to the <CODE>exec</CODE> functions.
Its value is <CODE>4096</CODE>.
<P>
<DT><CODE>_POSIX_CHILD_MAX</CODE>
<DD>The value of this macro is the most restrictive limit permitted by POSIX
for the maximum number of simultaneous processes per real user ID. Its
value is <CODE>6</CODE>.
<P>
<DT><CODE>_POSIX_NGROUPS_MAX</CODE>
<DD>The value of this macro is the most restrictive limit permitted by POSIX
for the maximum number of supplementary group IDs per process. Its
value is <CODE>0</CODE>.
<P>
<DT><CODE>_POSIX_OPEN_MAX</CODE>
<DD>The value of this macro is the most restrictive limit permitted by POSIX
for the maximum number of files that a single process can have open
simultaneously. Its value is <CODE>16</CODE>.
<P>
<DT><CODE>_POSIX_SSIZE_MAX</CODE>
<DD>The value of this macro is the most restrictive limit permitted by POSIX
for the maximum value that can be stored in an object of type
<CODE>ssize_t</CODE>. Its value is <CODE>32767</CODE>.
<P>
<DT><CODE>_POSIX_STREAM_MAX</CODE>
<DD>The value of this macro is the most restrictive limit permitted by POSIX
for the maximum number of streams that a single process can have open
simultaneously. Its value is <CODE>8</CODE>.
<P>
<DT><CODE>_POSIX_TZNAME_MAX</CODE>
<DD>The value of this macro is the most restrictive limit permitted by POSIX
for the maximum length of a time zone name. Its value is <CODE>3</CODE>.
<P>
<DT><CODE>_POSIX2_RE_DUP_MAX</CODE>
<DD>The value of this macro is the most restrictive limit permitted by POSIX
for the numbers used in the <SAMP>`\{<VAR>min</VAR>,<VAR>max</VAR>\}'</SAMP> construct
in a regular expression. Its value is <CODE>255</CODE>.
</DL>
<P>
<H2><A NAME="SEC463" HREF="library_toc.html#SEC463" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC463">Limits on File System Capacity</A></H2>
<P>
The POSIX.1 standard specifies a number of parameters that describe the
limitations of the file system. It's possible for the system to have a
fixed, uniform limit for a parameter, but this isn't the usual case. On
most systems, it's possible for different file systems (and, for some
parameters, even different files) to have different maximum limits. For
example, this is very likely if you use NFS to mount some of the file
systems from other machines.
<A NAME="IDX1887"></A>
<P>
Each of the following macros 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>pathconf</CODE> or <CODE>fpathconf</CODE> to
find out the limit that applies to a particular file. See section <A HREF="library_27.html#SEC466" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC466">Using <CODE>pathconf</CODE></A>.
<P>
Each parameter 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#SEC465" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_27.html#SEC465">Minimum Values for File System Limits</A>.
<A NAME="IDX1888"></A>
<P>
<A NAME="IDX1889"></A>
<U>Macro:</U> int <B>LINK_MAX</B><P>
The uniform system limit (if any) for the number of names for a given
file. See section <A HREF="library_13.html#SEC195" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_13.html#SEC195">Hard Links</A>.
<P>
<A NAME="IDX1890"></A>
<P>
<A NAME="IDX1891"></A>
<U>Macro:</U> int <B>MAX_CANON</B><P>
The uniform system limit (if any) for the amount of text in a line of
input when input editing is enabled. See section <A HREF="library_16.html#SEC271" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC271">Two Styles of Input: Canonical or Not</A>.
<P>
<A NAME="IDX1892"></A>
<U>Macro:</U> int <B>MAX_INPUT</B><P>
The uniform system limit (if any) for the total number of characters
typed ahead as input. See section <A HREF="library_16.html#SEC270" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC270">I/O Queues</A>.
<P>
<A NAME="IDX1893"></A>
<P>
<A NAME="IDX1894"></A>
<U>Macro:</U> int <B>NAME_MAX</B><P>
The uniform system limit (if any) for the length of a file name component.
<P>
<A NAME="IDX1895"></A>
<U>Macro:</U> int <B>PATH_MAX</B><P>
The uniform system limit (if any) for the length of an entire file name (that
is, the argument given to system calls such as <CODE>open</CODE>).
<P>
<A NAME="IDX1896"></A>
<P>
<A NAME="IDX1897"></A>
<U>Macro:</U> int <B>PIPE_BUF</B><P>
The uniform system limit (if any) for the number of bytes that can be
written atomically to a pipe. If multiple processes are writing to the
same pipe simultaneously, output from different processes might be
interleaved in chunks of this size. See section <A HREF="library_14.html#SEC211" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_14.html#SEC211">Pipes and FIFOs</A>.
<P>
These are alternative macro names for some of the same information.
<P>
<A NAME="IDX1898"></A>
<U>Macro:</U> int <B>MAXNAMLEN</B><P>
This is the BSD name for <CODE>NAME_MAX</CODE>. It is defined in
<TT>`dirent.h'</TT>.
<P>
<A NAME="IDX1899"></A>
<U>Macro:</U> int <B>FILENAME_MAX</B><P>
The value of this macro is an integer constant expression that
represents the maximum length of a file name string. It is defined in
<TT>`stdio.h'</TT>.
<P>
Unlike <CODE>PATH_MAX</CODE>, this macro is defined even if there is no actual
limit imposed. In such a case, its value is typically a very large
number. <STRONG>This is always the case on the GNU system.</STRONG>
<P>
<STRONG>Usage Note:</STRONG> Don't use <CODE>FILENAME_MAX</CODE> as the size of an
array in which to store a file name! You can't possibly make an array
that big! Use dynamic allocation (see section <A HREF="library_3.html#SEC18" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_3.html#SEC18">Memory Allocation</A>) instead.
<P>
<H2><A NAME="SEC464" HREF="library_toc.html#SEC464" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC464">Optional Features in File Support</A></H2>
<P>
POSIX defines certain system-specific options in the system calls for
operating on files. Some systems support these options and others do
not. 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. They can
also vary between file systems on a single machine.
<A NAME="IDX1900"></A>
<P>
This section describes the macros you can test to determine whether a
particular option is supported on your machine. If a given macro is
defined in <TT>`unistd.h'</TT>, then its value says whether the
corresponding feature is supported. (A value of <CODE>-1</CODE> indicates no;
any other value indicates yes.) If the macro is undefined, it means
particular files may or may not support the feature.
<P>
Since all the machines that support the GNU C library also support NFS,
one can never make a general statement about whether all file systems
support the <CODE>_POSIX_CHOWN_RESTRICTED</CODE> and <CODE>_POSIX_NO_TRUNC</CODE>
features. So these names are never defined as macros in the GNU C
library.
<P>
<A NAME="IDX1901"></A>
<U>Macro:</U> int <B>_POSIX_CHOWN_RESTRICTED</B><P>
If this option is in effect, the <CODE>chown</CODE> function is restricted so
that the only changes permitted to nonprivileged processes is to change
the group owner of a file to either be the effective group ID of the
process, or one of its supplementary group IDs. See section <A HREF="library_13.html#SEC204" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_13.html#SEC204">File Owner</A>.
<P>
<A NAME="IDX1902"></A>
<U>Macro:</U> int <B>_POSIX_NO_TRUNC</B><P>
If this option is in effect, file name components longer than
<CODE>NAME_MAX</CODE> generate an <CODE>ENAMETOOLONG</CODE> error. Otherwise, file
name components that are too long are silently truncated.
<P>
<A NAME="IDX1903"></A>
<U>Macro:</U> unsigned char <B>_POSIX_VDISABLE</B><P>
This option is only meaningful for files that are terminal devices.
If it is enabled, then handling for special control characters can
be disabled individually. See section <A HREF="library_16.html#SEC281" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC281">Special Characters</A>.
<P>
<A NAME="IDX1904"></A>
<P>
If one of these macros is undefined, that means that the option might be
in effect for some files and not for others. To inquire about a
particular file, call <CODE>pathconf</CODE> or <CODE>fpathconf</CODE>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -