📄 getconf.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>getconf</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_001_014_852"> </a>NAME</h4><blockquote>getconf - get configuration values</blockquote><h4><a name = "tag_001_014_853"> </a>SYNOPSIS</h4><blockquote><pre><code>getconf <b>[</b> -v specification <b>]</b><i> system_var</i>getconf <b>[</b> -v specification <b>]</b><i> path_var pathname</i></code></pre></blockquote><h4><a name = "tag_001_014_854"> </a>DESCRIPTION</h4><blockquote>In the first synopsis form,the<i>getconf</i>utility will write to the standard outputthe value of the variablespecified by the<i>system_var</i>operand.<p>In the second synopsis form,the<i>getconf</i>utility will write to the standard outputthe value of the variablespecified by the<i>path_var</i>operand for the path specified by the<i>pathname</i>operand.<p>The value of each configuration variable will be determined as if itwere obtained by calling the function from which it is defined to beavailable by this standard or by the <b>XSH</b> specification (see the OPERANDS section).The value will reflect conditions in the current operating environment.</blockquote><h4><a name = "tag_001_014_855"> </a>OPTIONS</h4><blockquote>The<i>getconf</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b> </a> .The following option is supported:<dl compact><dt><b>-v </b><i>specification</i><dd>Indicate a specific specification and version for which configurationvariables are to be determined.If this option is not specified, the values returned will correspond toan implementation default XBS5 conforming compilation environment.If the command:<pre><code>getconf _XBS5_ILP32_OFF32</code></pre>does not write "-1\n" or "undefined\n" to standard output,then commands of the form:<pre><code>getconf -v XBS5_ILP32_OFF32 ...</code></pre>will determine values for configuration variables corresponding to theXBS5_ILP32_OFF32 compilation environment specified in<i><a href="c89.html">c89</a></i>,EXTENDED DESCRIPTION.If the command:<pre><code>getconf _XBS5_ILP32_OFFBIG</code></pre>does not write "-1\n" or "undefined\n" to standard output,then commands of the form:<pre><code>getconf -v XBS5_ILP32_OFFBIG ...</code></pre>will determine values for configuration variables corresponding to theXBS5_ILP32_OFFBIG compilation environment specified in<i><a href="c89.html">c89</a></i>,EXTENDED DESCRIPTION.If the command:<pre><code>getconf _XBS5_LP64_OFF64</code></pre>does not write "-1\n" or "undefined\n" to standard output,then commands of the form:<pre><code>getconf -v XBS5_LP64_OFF64 ...</code></pre>will determine values for configuration variables corresponding to theXBS5_LP64_OFF64 compilation environment specified in<i><a href="c89.html">c89</a></i>,EXTENDED DESCRIPTION.If the command:<pre><code>getconf _XBS5_LPBIG_OFFBIG</code></pre>does not write "-1\n" or "undefined\n" to standard output,then commands of the form:<pre><code>getconf -v XBS5_LPBIG_OFFBIG</code></pre>will determine values for configuration variables corresponding to theXBS5_LPBIG_OFFBIG compilation environment specified in<i><a href="c89.html">c89</a></i>,EXTENDED DESCRIPTION.</dl></blockquote><h4><a name = "tag_001_014_856"> </a>OPERANDS</h4><blockquote>The following operands are supported:<dl compact><dt><i>path_var</i><dd>A name of a configuration variable.All of the variables in the <b>XSH</b> specification,<i><a href="../xsh/pathconf.html">pathconf()</a></i>,DESCRIPTION are supportedand the implementation may add other local variables.<dt><i>pathname</i><dd>A pathname for which the variable specified by<i>path_var</i>is to be determined.<dt><i>system_var</i><dd>A name of a configuration variable.All of the variables in the <b>XSH</b> specification,<i><a href="../xsh/confstr.html">confstr()</a></i>and<i><a href="../xsh/sysconf.html">sysconf()</a></i>,DESCRIPTIONs are supportedand the implementation may add other local values:When the symbol listed in the first column of the following table isused as the<i>system_var</i>operand,<i>getconf</i>will yield the same value as<i><a href="../xsh/confstr.html">confstr()</a></i>when called with the value in the second column:<table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b><i>system_var</i></b><th align=center><b><i>confstr</i>() Name Value</b><tr valign=top><td align=left><i>PATH</i><td align=left>_CS_PATH<tr valign=top><td align=left><i>XBS5_ILP32_OFF32_CFLAGS</i><td align=left>_CS_XBS5_ILP32_OFF32_CFLAGS<tr valign=top><td align=left><i>XBS5_ILP32_OFF32_LDFLAGS</i><td align=left>_CS_XBS5_ILP32_OFF32_LDFLAGS<tr valign=top><td align=left><i>XBS5_ILP32_OFF32_LIBS</i><td align=left>_CS_XBS5_ILP32_OFF32_LIBS<tr valign=top><td align=left><i>XBS5_ILP32_OFF32_LINTFLAGS</i><td align=left>_CS_XBS5_ILP32_OFF32_LINTFLAGS<tr valign=top><td align=left><i>XBS5_ILP32_OFFBIG_CFLAGS</i><td align=left>_CS_XBS5_ILP32_OFFBIG_CFLAGS<tr valign=top><td align=left><i>XBS5_ILP32_OFFBIG_LDFLAGS</i><td align=left>_CS_XBS5_ILP32_OFFBIG_LDFLAGS<tr valign=top><td align=left><i>XBS5_ILP32_OFFBIG_LIBS</i><td align=left>_CS_XBS5_ILP32_OFFBIG_LIBS<tr valign=top><td align=left><i>XBS5_ILP32_OFFBIG_LINTFLAGS</i><td align=left>_CS_XBS5_ILPBIG_OFF32_LINTFLAGS<tr valign=top><td align=left><i>XBS5_LP64_OFF64_CFLAGS</i><td align=left>_CS_XBS5_LP64_OFF64_CFLAGS<tr valign=top><td align=left><i>XBS5_LP64_OFF64_LDFLAGS</i><td align=left>_CS_XBS5_LP64_OFF64_LDFLAGS<tr valign=top><td align=left><i>XBS5_LP64_OFF64_LIBS</i><td align=left>_CS_XBS5_LP64_OFF64_LIBS<tr valign=top><td align=left><i>XBS5_LP64_OFF64_LINTFLAGS</i><td align=left>_CS_XBS5_LP64_OFF64_LINTFLAGS<tr valign=top><td align=left><i>XBS5_LPBIG_OFFBIG_CFLAGS</i><td align=left>_CS_XBS5_LPBIG_OFFBIG_CFLAGS<tr valign=top><td align=left><i>XBS5_LPBIG_OFFBIG_LDFLAGS</i><td align=left>_CS_XBS5_LPBIG_OFFBIG_LDFLAGS<tr valign=top><td align=left><i>XBS5_LPBIG_OFFBIG_LIBS</i><td align=left>_CS_XBS5_LPBIG_OFFBIG_LIBS<tr valign=top><td align=left><i>XBS5_LPBIG_OFFBIG_LINTFLAGS</i><td align=left>_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS </table></dl></blockquote><h4><a name = "tag_001_014_857"> </a>STDIN</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_858"> </a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_859"> </a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>getconf</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i></dl></blockquote><h4><a name = "tag_001_014_860"> </a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.<br></blockquote><h4><a name = "tag_001_014_861"> </a>STDOUT</h4><blockquote>If the specified variable is defined on the system and itsvalue is described to be available from the <b>XSH</b> specification<i><a href="../xsh/confstr.html">confstr()</a></i>function,its value will be written in the following format:</b><code><pre></pre><tt>"%s\n"</tt>, <<i>value</i>></code><p>Otherwise,if the specified variable is defined on the system,its value will be written in the following format:<p><code><tt>"%d\n"</tt>, <<i>value</i>></code><p>If the specified variable is valid, but is undefined on the system,<i>getconf</i>will write using the following format:<pre><code>"undefined\n"</code></pre><p>If the variable name is invalid or an error occurs, nothingwill be written to standard output.</blockquote><h4><a name = "tag_001_014_862"> </a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_863"> </a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_864"> </a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_865"> </a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>The specified variable is valid and information about itscurrent state was written successfully.<dt>>0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_001_014_866"> </a>CONSEQUENCES OF ERRORS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_867"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_868"> </a>EXAMPLES</h4><blockquote>This example illustrates the value of{NGROUPS_MAX}:<pre><code>getconf NGROUPS_MAX</code></pre>This example illustrates the value of{NAME_MAX}for a specific directory:<pre><code>getconf NAME_MAX /usr</code></pre><br>This example shows how to deal more carefully with results that might beunspecified:<pre><code>if value=$(getconf PATH_MAX /usr); then if [ "$value" = "undefined" ]; then echo PATH_MAX in /usr is infinite. else echo PATH_MAX in /usr is $value. fielse echo Error in getconf.fi</code></pre><p>Note that:<pre><code>sysconf(_SC_POSIX_C_BIND);</code></pre>and:<pre><code>system("getconf POSIX2_C_BIND");</code></pre>in a C program could give different answers.The<i><a href="../xsh/sysconf.html">sysconf()</a></i>call suppliesa value that corresponds to the conditions when the program was eithercompiled or executed, depending on the implementation; the<i><a href="../xsh/system.html">system()</a></i>call to<i>getconf</i>always supplies a value corresponding to conditions when theprogram is executed.</blockquote><h4><a name = "tag_001_014_869"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_870"> </a>SEE ALSO</h4><blockquote><i><a href="c89.html">c89</a></i>and the <b>XSH</b> specification description of<i><a href="../xsh/confstr.html">confstr()</a></i>,<i><a href="../xsh/pathconf.html">pathconf()</a></i>,<i><a href="../xsh/sysconf.html">sysconf()</a></i>.</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 + -