⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 library_27.html

📁 Linux程序员的工作手册
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<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 compilercommand, <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 tointerpret 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 necessarilybe 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 withinparentheses 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 textutilities can handle.<P><DT><CODE>_SC_VERSION</CODE><DD>Inquire about the version number of POSIX.1 that the library and kernelsupport.<P><DT><CODE>_SC_2_VERSION</CODE><DD>Inquire about the version number of POSIX.2 that the system utilitiessupport.</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 theparameter you are interested in, and call <CODE>sysconf</CODE> only if themacro is not defined.  For example, here is how to test whether jobcontrol is supported:<P><PRE>inthave_job_control (void){#ifdef _POSIX_JOB_CONTROL  return 1;#else  int value = sysconf (_SC_JOB_CONTROL);  if (value &#60; 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>intget_child_max (){#ifdef CHILD_MAX  return CHILD_MAX;#else  int value = sysconf (_SC_CHILD_MAX);  if (value &#60; 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 systemlimit parameters.  The significance of these values is that you cansafely push to these limits without checking whether the particularsystem 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 POSIXfor 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 POSIXfor the maximum number of simultaneous processes per real user ID.  Itsvalue is <CODE>6</CODE>.<P><DT><CODE>_POSIX_NGROUPS_MAX</CODE><DD>The value of this macro is the most restrictive limit permitted by POSIXfor the maximum number of supplementary group IDs per process.  Itsvalue is <CODE>0</CODE>.<P><DT><CODE>_POSIX_OPEN_MAX</CODE><DD>The value of this macro is the most restrictive limit permitted by POSIXfor the maximum number of files that a single process can have opensimultaneously.  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 POSIXfor 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 POSIXfor the maximum number of streams that a single process can have opensimultaneously.  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 POSIXfor 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 POSIXfor the numbers used in the <SAMP>`\{<VAR>min</VAR>,<VAR>max</VAR>\}'</SAMP> constructin 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 thelimitations of the file system.  It's possible for the system to have afixed, uniform limit for a parameter, but this isn't the usual case.  Onmost systems, it's possible for different file systems (and, for someparameters, even different files) to have different maximum limits.  Forexample, this is very likely if you use NFS to mount some of the filesystems from other machines.<A NAME="IDX1887"></A><P>Each of the following macros is defined in <TT>`limits.h'</TT> only if thesystem has a fixed, uniform limit for the parameter in question.  If thesystem allows different file systems or files to have different limits,then the macro is undefined; use <CODE>pathconf</CODE> or <CODE>fpathconf</CODE> tofind 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 tohave 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 givenfile.  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 ofinput 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 characterstyped 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 (thatis, 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 bewritten atomically to a pipe.  If multiple processes are writing to thesame pipe simultaneously, output from different processes might beinterleaved 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 thatrepresents 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 actuallimit imposed.  In such a case, its value is typically a very largenumber.  <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 anarray in which to store a file name!  You can't possibly make an arraythat 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 foroperating on files.  Some systems support these options and others donot.  Since these options are provided in the kernel, not in thelibrary, simply using the GNU C library does not guarantee any of thesefeatures is supported; it depends on the system you are using.  They canalso vary between file systems on a single machine.<A NAME="IDX1900"></A><P>This section describes the macros you can test to determine whether aparticular option is supported on your machine.  If a given macro isdefined in <TT>`unistd.h'</TT>, then its value says whether thecorresponding feature is supported.  (A value of <CODE>-1</CODE> indicates no;any other value indicates yes.)  If the macro is undefined, it meansparticular 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 systemssupport the <CODE>_POSIX_CHOWN_RESTRICTED</CODE> and <CODE>_POSIX_NO_TRUNC</CODE>features.  So these names are never defined as macros in the GNU Clibrary.<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 sothat the only changes permitted to nonprivileged processes is to change the group owner of a file to either be the effective group ID of theprocess, 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, filename 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 canbe 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 bein effect for some files and not for others.  To inquire about aparticular file, call <CODE>pathconf</CODE> or <CODE>fpathconf</CODE>.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -