📄 sysconf.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>sysconf</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_009_294"> </a>NAME</h4><blockquote>sysconf - get configurable system variables</blockquote><h4><a name = "tag_000_009_295"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="unistd.h.html">unistd.h</a>>long int sysconf(int <i>name</i>);</code></pre></blockquote><h4><a name = "tag_000_009_296"> </a>DESCRIPTION</h4><blockquote>The<i>sysconf()</i>function provides a method for the application to determinethe current value of a configurable system limit or option<i>(variable)</i>.<p>The<i>name</i>argument represents the system variable to be queried.The following table lists the minimal set of system variables from<i><a href="limits.h.html"><limits.h></a></i>,<i><a href="unistd.h.html"><unistd.h></a></i>or<i><a href="time.h.html"><time.h></a></i>(for CLK_TCK) that can be returned by<i>sysconf()</i>,and the symbolic constants, defined in<i><a href="unistd.h.html"><unistd.h></a></i>that are the corresponding values used for<i>name:</i><p><table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Variable</b><th align=center><b>Value of Name</b><tr valign=top><td align=left>ARG_MAX<td align=left>_SC_ARG_MAX<tr valign=top><td align=left>BC_BASE_MAX<td align=left>_SC_BC_BASE_MAX<tr valign=top><td align=left>BC_DIM_MAX<td align=left>_SC_BC_DIM_MAX<tr valign=top><td align=left>BC_SCALE_MAX<td align=left>_SC_BC_SCALE_MAX<tr valign=top><td align=left>BC_STRING_MAX<td align=left>_SC_BC_STRING_MAX<tr valign=top><td align=left>CHILD_MAX<td align=left>_SC_CHILD_MAX<tr valign=top><td align=left>CLK_TCK<td align=left>_SC_CLK_TCK<tr valign=top><td align=left>COLL_WEIGHTS_MAX<td align=left>_SC_COLL_WEIGHTS_MAX<tr valign=top><td align=left>EXPR_NEST_MAX<td align=left>_SC_EXPR_NEST_MAX<tr valign=top><td align=left>LINE_MAX<td align=left>_SC_LINE_MAX<tr valign=top><td align=left>NGROUPS_MAX<td align=left>_SC_NGROUPS_MAX<tr valign=top><td align=left>OPEN_MAX<td align=left>_SC_OPEN_MAX<tr valign=top><td align=left>PASS_MAX<td align=left>_SC_PASS_MAX (<b>LEGACY</b>)<tr valign=top><td align=left>_POSIX2_C_BIND<td align=left>_SC_2_C_BIND<tr valign=top><td align=left>_POSIX2_C_DEV<td align=left>_SC_2_C_DEV<tr valign=top><td align=left>_POSIX2_C_VERSION<td align=left>_SC_2_C_VERSION<tr valign=top><td align=left>_POSIX2_CHAR_TERM<td align=left>_SC_2_CHAR_TERM<tr valign=top><td align=left>_POSIX2_FORT_DEV<td align=left>_SC_2_FORT_DEV<tr valign=top><td align=left>_POSIX2_FORT_RUN<td align=left>_SC_2_FORT_RUN<tr valign=top><td align=left>_POSIX2_LOCALEDEF<td align=left>_SC_2_LOCALEDEF<tr valign=top><td align=left>_POSIX2_SW_DEV<td align=left>_SC_2_SW_DEV<tr valign=top><td align=left>_POSIX2_UPE<td align=left>_SC_2_UPE<tr valign=top><td align=left>_POSIX2_VERSION<td align=left>_SC_2_VERSION<tr valign=top><td align=left>_POSIX_JOB_CONTROL<td align=left>_SC_JOB_CONTROL<tr valign=top><td align=left>_POSIX_SAVED_IDS<td align=left>_SC_SAVED_IDS<tr valign=top><td align=left>_POSIX_VERSION<td align=left>_SC_VERSION<tr valign=top><td align=left>RE_DUP_MAX<td align=left>_SC_RE_DUP_MAX<tr valign=top><td align=left>STREAM_MAX<td align=left>_SC_STREAM_MAX<tr valign=top><td align=left>TZNAME_MAX<td align=left>_SC_TZNAME_MAX<tr valign=top><td align=left>_XOPEN_CRYPT<td align=left>_SC_XOPEN_CRYPT<tr valign=top><td align=left>_XOPEN_ENH_I18N<td align=left>_SC_XOPEN_ENH_I18N<tr valign=top><td align=left>_XOPEN_SHM<td align=left>_SC_XOPEN_SHM<tr valign=top><td align=left>_XOPEN_VERSION<td align=left>_SC_XOPEN_VERSION<tr valign=top><td align=left>_XOPEN_XCU_VERSION<td align=left>_SC_XOPEN_XCU_VERSION<tr valign=top><td align=left>_XOPEN_REALTIME<td align=left>_SC_XOPEN_REALTIME<tr valign=top><td align=left>_XOPEN_REALTIME_THREADS<td align=left>_SC_XOPEN_REALTIME_THREADS<tr valign=top><td align=left>_XOPEN_LEGACY<td align=left>_SC_XOPEN_LEGACY<tr valign=top><td align=left>ATEXIT_MAX<td align=left>_SC_ATEXIT_MAX<tr valign=top><td align=left>IOV_MAX<td align=left>_SC_IOV_MAX<tr valign=top><td align=left>PAGESIZE<td align=left>_SC_PAGESIZE<tr valign=top><td align=left>PAGE_SIZE<td align=left>_SC_PAGE_SIZE<tr valign=top><td align=left>_XOPEN_UNIX<td align=left>_SC_XOPEN_UNIX<tr valign=top><td align=left>_XBS5_ILP32_OFF32<td align=left>_SC_XBS5_ILP32_OFF32<tr valign=top><td align=left>_XBS5_ILP32_OFFBIG<td align=left>_SC_XBS5_ILP32_OFFBIG<tr valign=top><td align=left>_XBS5_LP64_OFF64<td align=left>_SC_XBS5_LP64_OFF64<tr valign=top><td align=left>_XBS5_LPBIG_OFFBIG<td align=left>_SC_XBS5_LPBIG_OFFBIG<tr valign=top><td align=left>AIO_LISTIO_MAX<td align=left>_SC_AIO_LISTIO_MAX<tr valign=top><td align=left>AIO_MAX<td align=left>_SC_AIO_MAX<tr valign=top><td align=left>AIO_PRIO_DELTA_MAX<td align=left>_SC_AIO_PRIO_DELTA_MAX<tr valign=top><td align=left>DELAYTIMER_MAX<td align=left>_SC_DELAYTIMER_MAX<tr valign=top><td align=left>MQ_OPEN_MAX<td align=left>_SC_MQ_OPEN_MAX<tr valign=top><td align=left>MQ_PRIO_MAX<td align=left>_SC_MQ_PRIO_MAX<tr valign=top><td align=left>RTSIG_MAX<td align=left>_SC_RTSIG_MAX<tr valign=top><td align=left>SEM_NSEMS_MAX<td align=left>_SC_SEM_NSEMS_MAX<tr valign=top><td align=left>SEM_VALUE_MAX<td align=left>_SC_SEM_VALUE_MAX<tr valign=top><td align=left>SIGQUEUE_MAX<td align=left>_SC_SIGQUEUE_MAX<tr valign=top><td align=left>TIMER_MAX<td align=left>_SC_TIMER_MAX<tr valign=top><td align=left>_POSIX_ASYNCHRONOUS_IO<td align=left>_SC_ASYNCHRONOUS_IO<tr valign=top><td align=left>_POSIX_FSYNC<td align=left>_SC_FSYNC<tr valign=top><td align=left>_POSIX_MAPPED_FILES<td align=left>_SC_MAPPED_FILES<tr valign=top><td align=left>_POSIX_MEMLOCK<td align=left>_SC_MEMLOCK<tr valign=top><td align=left>_POSIX_MEMLOCK_RANGE<td align=left>_SC_MEMLOCK_RANGE<tr valign=top><td align=left>_POSIX_MEMORY_PROTECTION<td align=left>_SC_MEMORY_PROTECTION<tr valign=top><td align=left>_POSIX_MESSAGE_PASSING<td align=left>_SC_MESSAGE_PASSING<tr valign=top><td align=left>_POSIX_PRIORITIZED_IO<td align=left>_SC_PRIORITIZED_IO<tr valign=top><td align=left>_POSIX_PRIORITY_SCHEDULING<td align=left>_SC_PRIORITY_SCHEDULING<tr valign=top><td align=left>_POSIX_REALTIME_SIGNALS<td align=left>_SC_REALTIME_SIGNALS<tr valign=top><td align=left>_POSIX_SEMAPHORES<td align=left>_SC_SEMAPHORES<tr valign=top><td align=left>_POSIX_SHARED_MEMORY_OBJECTS<td align=left>_SC_SHARED_MEMORY_OBJECTS<tr valign=top><td align=left>_POSIX_SYNCHRONIZED_IO<td align=left>_SC_SYNCHRONIZED_IO<tr valign=top><td align=left>_POSIX_TIMERS<td align=left>_SC_TIMERS<tr valign=top><td align=left> Maximum size of and data buffers <td align=left>_SC_GETGR_R_SIZE_MAX<tr valign=top><td align=left> Maximum size of and data buffers <td align=left>_SC_GETPW_R_SIZE_MAX<tr valign=top><td align=left>LOGIN_NAME_MAX<td align=left>_SC_LOGIN_NAME_MAX<tr valign=top><td align=left>PTHREAD_DESTRUCTOR_ITERATIONS<td align=left>_SC_THREAD_DESTRUCTOR_ITERATIONS<tr valign=top><td align=left>PTHREAD_KEYS_MAX<td align=left>_SC_THREAD_KEYS_MAX<tr valign=top><td align=left>PTHREAD_STACK_MIN<td align=left>_SC_THREAD_STACK_MIN<tr valign=top><td align=left>PTHREAD_THREADS_MAX<td align=left>_SC_THREAD_THREADS_MAX<tr valign=top><td align=left>TTY_NAME_MAX<td align=left>_SC_TTY_NAME_MAX<tr valign=top><td align=left>_POSIX_THREADS<td align=left>_SC_THREADS<tr valign=top><td align=left>_POSIX_THREAD_ATTR_STACKADDR<td align=left>_SC_THREAD_ATTR_STACKADDR<tr valign=top><td align=left>_POSIX_THREAD_ATTR_STACKSIZE<td align=left>_SC_THREAD_ATTR_STACKSIZE<tr valign=top><td align=left>_POSIX_THREAD_PRIORITY_SCHEDULING<td align=left>_SC_THREAD_PRIORITY_SCHEDULING<tr valign=top><td align=left>_POSIX_THREAD_PRIO_INHERIT<td align=left>_SC_THREAD_PRIO_INHERIT<tr valign=top><td align=left>_POSIX_THREAD_PRIO_PROTECT<td align=left>_SC_THREAD_PRIO_PROTECT<tr valign=top><td align=left>_POSIX_THREAD_PROCESS_SHARED<td align=left>_SC_THREAD_PROCESS_SHARED<tr valign=top><td align=left>_POSIX_THREAD_SAFE_FUNCTIONS<td align=left>_SC_THREAD_SAFE_FUNCTIONS</table></blockquote><h4><a name = "tag_000_009_297"> </a>RETURN VALUE</h4><blockquote>If<i>name</i>is an invalid value,<i>sysconf()</i>returns -1 and sets<i>errno</i>to indicate the error.If the variable corresponding to<i>name</i>is associated with functionality that is not supported bythe system,<i>sysconf()</i>returns -1 without changing the value of<i>errno</i>.<p>Otherwise,<i>sysconf()</i>returns the current variable value on the system.The value returned will not be more restrictive than thecorresponding value described to the application when itwas compiled with the implementation's<i><a href="limits.h.html"><limits.h></a></i>,<i><a href="unistd.h.html"><unistd.h></a></i>or<i><a href="time.h.html"><time.h></a></i>.The value will not change during the lifetime of the calling process.</blockquote><h4><a name = "tag_000_009_298"> </a>ERRORS</h4><blockquote>The<i>sysconf()</i>function will fail if:<dl compact><dt>[EINVAL]<dd>The value of the<i>name</i>argument is invalid.</dl></blockquote><h4><a name = "tag_000_009_299"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_009_300"> </a>APPLICATION USAGE</h4><blockquote>As -1 is a permissible return value in a successful situation,an application wishing to check for error situations should set<i>errno</i>to 0, then call<i>sysconf()</i>,and, if it returns -1, check to see if<i>errno</i>is non-zero.<p>If the value of:<pre><code>sysconf(_SC_2_VERSION)</code></pre>is not equal to the value of the{_POSIX2_VERSION}symbolic constant, the utilities available via<i><a href="system.html">system()</a></i>or<i><a href="popen.html">popen()</a></i>might not behave as described in the <b>XCU</b> specification.This would mean that the application is not running in an environmentthat conforms to the <b>XCU</b> specification.Some applications might be able to deal with this, others might not.However, the interfaces defined in this specificationwill continue to operate as specified, even if:<pre><code>sysconf(_SC_2_VERSION)</code></pre>reports that the utilities no longer perform as specified.</blockquote><h4><a name = "tag_000_009_301"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_009_302"> </a>SEE ALSO</h4><blockquote><i><a href="confstr.html">confstr()</a></i>,<i><a href="pathconf.html">pathconf()</a></i>,<i><a href="limits.h.html"><limits.h></a></i>,<i><a href="time.h.html"><time.h></a></i>,<i><a href="unistd.h.html"><unistd.h></a></i>,the <b>XCU</b> specification of <i>getconf</i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from the POSIX.1-1988 standard.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -