isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |

getconf.html (18271B)


      1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved -->
      2 <!DOCTYPE HTML>
      3 <html lang="en">
      4 <head>
      5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0">
      6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 -->
      8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved -->
      9 <title>getconf</title>
     10 </head>
     11 <body bgcolor="white">
     12 <div class="NAVHEADER">
     13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
     14 <tr class="nav">
     15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/get.html" accesskey="P">&lt;&lt;&lt;
     16 Previous</a></td>
     17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
     18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/getopts.html" accesskey="N">Next
     19 &gt;&gt;&gt;</a></td>
     20 </tr>
     21 </table>
     22 <hr align="left" width="100%"></div>
     23 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     24 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     25 IEEE Std 1003.1-2024<br>
     26 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     27 <hr size="2" noshade>
     28 <a name="top" id="top"></a> <a name="getconf" id="getconf"></a> <a name="tag_20_52" id="tag_20_52"></a><!-- getconf -->
     29 <h4 class="mansect"><a name="tag_20_52_01" id="tag_20_52_01"></a>NAME</h4>
     30 <blockquote>getconf — get configuration values</blockquote>
     31 <h4 class="mansect"><a name="tag_20_52_02" id="tag_20_52_02"></a>SYNOPSIS</h4>
     32 <blockquote class="synopsis">
     33 <p><code><tt>getconf</tt> <b>[</b><tt>-v specification</tt><b>]</b> <i>system_var</i> <tt><br>
     34 <br>
     35 getconf</tt> <b>[</b><tt>-v specification</tt><b>]</b> <i>path_var pathname</i> <tt><br></tt></code></p>
     36 </blockquote>
     37 <h4 class="mansect"><a name="tag_20_52_03" id="tag_20_52_03"></a>DESCRIPTION</h4>
     38 <blockquote>
     39 <p>In the first synopsis form, the <i>getconf</i> utility shall write to the standard output the value of the variable specified by
     40 the <i>system_var</i> operand.</p>
     41 <p>In the second synopsis form, the <i>getconf</i> utility shall write to the standard output the value of the variable specified
     42 by the <i>path_var</i> operand for the path specified by the <i>pathname</i> operand.</p>
     43 <p>The value of each configuration variable shall be determined as if it were obtained by calling the function from which it is
     44 defined to be available by this volume of POSIX.1-2024 or by the System Interfaces volume of POSIX.1-2024 (see the OPERANDS
     45 section). The value shall reflect conditions in the current operating environment.</p>
     46 </blockquote>
     47 <h4 class="mansect"><a name="tag_20_52_04" id="tag_20_52_04"></a>OPTIONS</h4>
     48 <blockquote>
     49 <p>The <i>getconf</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     50 Guidelines</i></a> .</p>
     51 <p>The following option shall be supported:</p>
     52 <dl compact>
     53 <dd></dd>
     54 <dt><b>-v&nbsp;</b><i>specification</i></dt>
     55 <dd><br>
     56 Indicate a specific specification and version for which configuration variables shall be determined. If this option is not
     57 specified, the values returned correspond to an implementation default conforming compilation environment.
     58 <p>If the command:</p>
     59 <pre>
     60 <tt>getconf _POSIX_V8_ILP32_OFF32
     61 </tt></pre>
     62 <p>does not write <tt>"-1\n"</tt> or <tt>"undefined\n"</tt> to standard output, then commands of the form:</p>
     63 <pre>
     64 <tt>getconf -v POSIX_V8_ILP32_OFF32 ...
     65 </tt></pre>
     66 <p>determine values for configuration variables corresponding to the POSIX_V8_ILP32_OFF32 compilation environment specified in
     67 <a href="../utilities/c17.html#"><i>c17</i></a> , the EXTENDED DESCRIPTION.</p>
     68 <p>If the command:</p>
     69 <pre>
     70 <tt>getconf _POSIX_V8_ILP32_OFFBIG
     71 </tt></pre>
     72 <p>does not write <tt>"-1\n"</tt> or <tt>"undefined\n"</tt> to standard output, then commands of the form:</p>
     73 <pre>
     74 <tt>getconf -v POSIX_V8_ILP32_OFFBIG ...
     75 </tt></pre>
     76 <p>determine values for configuration variables corresponding to the POSIX_V8_ILP32_OFFBIG compilation environment specified in
     77 <a href="../utilities/c17.html#"><i>c17</i></a> , the EXTENDED DESCRIPTION.</p>
     78 <p>If the command:</p>
     79 <pre>
     80 <tt>getconf _POSIX_V8_LP64_OFF64
     81 </tt></pre>
     82 <p>does not write <tt>"-1\n"</tt> or <tt>"undefined\n"</tt> to standard output, then commands of the form:</p>
     83 <pre>
     84 <tt>getconf -v POSIX_V8_LP64_OFF64 ...
     85 </tt></pre>
     86 <p>determine values for configuration variables corresponding to the POSIX_V8_LP64_OFF64 compilation environment specified in
     87 <a href="../utilities/c17.html#"><i>c17</i></a> , the EXTENDED DESCRIPTION.</p>
     88 <p>If the command:</p>
     89 <pre>
     90 <tt>getconf _POSIX_V8_LPBIG_OFFBIG
     91 </tt></pre>
     92 <p>does not write <tt>"-1\n"</tt> or <tt>"undefined\n"</tt> to standard output, then commands of the form:</p>
     93 <pre>
     94 <tt>getconf -v POSIX_V8_LPBIG_OFFBIG ...
     95 </tt></pre>
     96 <p>determine values for configuration variables corresponding to the POSIX_V8_LPBIG_OFFBIG compilation environment specified in
     97 <a href="../utilities/c17.html#"><i>c17</i></a> , the EXTENDED DESCRIPTION.</p>
     98 </dd>
     99 </dl>
    100 </blockquote>
    101 <h4 class="mansect"><a name="tag_20_52_05" id="tag_20_52_05"></a>OPERANDS</h4>
    102 <blockquote>
    103 <p>The following operands shall be supported:</p>
    104 <dl compact>
    105 <dd></dd>
    106 <dt><i>path_var</i></dt>
    107 <dd>A name of a configuration variable. All of the variables in the Variable column of the table in the DESCRIPTION of the <a href=
    108 "../functions/fpathconf.html"><i>fpathconf</i>()</a> function defined in the System Interfaces volume of POSIX.1-2024, without the
    109 enclosing braces, shall be supported. The implementation may add other local variables.</dd>
    110 <dt><i>pathname</i></dt>
    111 <dd>A pathname for which the variable specified by <i>path_var</i> is to be determined.</dd>
    112 <dt><i>system_var</i></dt>
    113 <dd>A name of a configuration variable. All of the following variables shall be supported:
    114 <ul>
    115 <li>
    116 <p>The names, without the enclosing braces, in the Variable column of the table in the DESCRIPTION of the <a href=
    117 "../functions/sysconf.html"><i>sysconf</i>()</a> function in the System Interfaces volume of POSIX.1-2024, except for the entries
    118 corresponding to _SC_CLK_TCK, _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN, and
    119 _SC_NSIG.</p>
    120 <p>For compatibility with earlier versions, the following variable names shall also be supported: POSIX2_C_BIND POSIX2_C_DEV
    121 POSIX2_CHAR_TERM POSIX2_FORT_RUN POSIX2_LOCALEDEF POSIX2_SW_DEV POSIX2_UPE POSIX2_VERSION</p>
    122 <p>and shall be equivalent to the same name prefixed with an &lt;underscore&gt;. This requirement may be removed in a future
    123 version.</p>
    124 </li>
    125 <li>
    126 <p>The names NPROCESSORS_CONF and NPROCESSORS_ONLN. The values of these configuration variables shall be determined as if they were
    127 obtained by calling the function <a href="../functions/sysconf.html"><i>sysconf</i>()</a> with the argument _SC_NPROCESSORS_CONF or
    128 _SC_NPROCESSORS_ONLN, respectively.</p>
    129 </li>
    130 <li>
    131 <p>The names of the symbolic constants used as the <i>name</i> argument of the <a href=
    132 "../functions/confstr.html"><i>confstr</i>()</a> function in the System Interfaces volume of POSIX.1-2024, without the _CS_
    133 prefix.</p>
    134 </li>
    135 <li>
    136 <p>The names of the symbolic constants listed under the headings &quot;Maximum Values&quot; and &quot;Minimum Values&quot; in the description of
    137 the <a href="../basedefs/limits.h.html"><i>&lt;limits.h&gt;</i></a> header in the Base Definitions volume of POSIX.1-2024, without
    138 the enclosing braces.</p>
    139 <p>For compatibility with earlier versions, the following variable names shall also be supported: POSIX2_BC_BASE_MAX
    140 POSIX2_BC_DIM_MAX POSIX2_BC_SCALE_MAX POSIX2_BC_STRING_MAX POSIX2_COLL_WEIGHTS_MAX POSIX2_EXPR_NEST_MAX POSIX2_LINE_MAX
    141 POSIX2_RE_DUP_MAX</p>
    142 <p>and shall be equivalent to the same name prefixed with an &lt;underscore&gt;. This requirement may be removed in a future
    143 version.</p>
    144 </li>
    145 </ul>
    146 <p>The implementation may add other local values.</p>
    147 </dd>
    148 </dl>
    149 </blockquote>
    150 <h4 class="mansect"><a name="tag_20_52_06" id="tag_20_52_06"></a>STDIN</h4>
    151 <blockquote>
    152 <p>Not used.</p>
    153 </blockquote>
    154 <h4 class="mansect"><a name="tag_20_52_07" id="tag_20_52_07"></a>INPUT FILES</h4>
    155 <blockquote>
    156 <p>None.</p>
    157 </blockquote>
    158 <h4 class="mansect"><a name="tag_20_52_08" id="tag_20_52_08"></a>ENVIRONMENT VARIABLES</h4>
    159 <blockquote>
    160 <p>The following environment variables shall affect the execution of <i>getconf</i>:</p>
    161 <dl compact>
    162 <dd></dd>
    163 <dt><i>LANG</i></dt>
    164 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
    165 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
    166 variables used to determine the values of locale categories.)</dd>
    167 <dt><i>LC_ALL</i></dt>
    168 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    169 <dt><i>LC_CTYPE</i></dt>
    170 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    171 opposed to multi-byte characters in arguments).</dd>
    172 <dt><i>LC_MESSAGES</i></dt>
    173 <dd><br>
    174 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
    175 <dt><i>NLSPATH</i></dt>
    176 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    177 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
    178 "0"></dd>
    179 </dl>
    180 </blockquote>
    181 <h4 class="mansect"><a name="tag_20_52_09" id="tag_20_52_09"></a>ASYNCHRONOUS EVENTS</h4>
    182 <blockquote>
    183 <p>Default.</p>
    184 </blockquote>
    185 <h4 class="mansect"><a name="tag_20_52_10" id="tag_20_52_10"></a>STDOUT</h4>
    186 <blockquote>
    187 <p>If the specified variable is defined on the system and its value is described to be available from the <a href=
    188 "../functions/confstr.html"><i>confstr</i>()</a> function defined in the System Interfaces volume of POSIX.1-2024, its value shall
    189 be written in the following format:</p>
    190 <pre>
    191 <tt>"%s\n", &lt;</tt><i>value</i><tt>&gt;
    192 </tt></pre>
    193 <p>Otherwise, if the specified variable is defined on the system, its value shall be written in the following format:</p>
    194 <pre>
    195 <tt>"%d\n", &lt;</tt><i>value</i><tt>&gt;
    196 </tt></pre>
    197 <p>If the specified variable is valid, but is undefined on the system, <i>getconf</i> shall write using the following format:</p>
    198 <pre>
    199 <tt>"undefined\n"
    200 </tt></pre>
    201 <p>If the variable name is invalid or an error occurs, nothing shall be written to standard output.</p>
    202 </blockquote>
    203 <h4 class="mansect"><a name="tag_20_52_11" id="tag_20_52_11"></a>STDERR</h4>
    204 <blockquote>
    205 <p>The standard error shall be used only for diagnostic messages.</p>
    206 </blockquote>
    207 <h4 class="mansect"><a name="tag_20_52_12" id="tag_20_52_12"></a>OUTPUT FILES</h4>
    208 <blockquote>
    209 <p>None.</p>
    210 </blockquote>
    211 <h4 class="mansect"><a name="tag_20_52_13" id="tag_20_52_13"></a>EXTENDED DESCRIPTION</h4>
    212 <blockquote>
    213 <p>None.</p>
    214 </blockquote>
    215 <h4 class="mansect"><a name="tag_20_52_14" id="tag_20_52_14"></a>EXIT STATUS</h4>
    216 <blockquote>
    217 <p>The following exit values shall be returned:</p>
    218 <dl compact>
    219 <dd></dd>
    220 <dt>&nbsp;0</dt>
    221 <dd>The specified variable is valid and information about its current state was written successfully.</dd>
    222 <dt>&gt;0</dt>
    223 <dd>An error occurred.</dd>
    224 </dl>
    225 </blockquote>
    226 <h4 class="mansect"><a name="tag_20_52_15" id="tag_20_52_15"></a>CONSEQUENCES OF ERRORS</h4>
    227 <blockquote>
    228 <p>Default.</p>
    229 </blockquote>
    230 <hr>
    231 <div class="box"><em>The following sections are informative.</em></div>
    232 <h4 class="mansect"><a name="tag_20_52_16" id="tag_20_52_16"></a>APPLICATION USAGE</h4>
    233 <blockquote>
    234 <p>None.</p>
    235 </blockquote>
    236 <h4 class="mansect"><a name="tag_20_52_17" id="tag_20_52_17"></a>EXAMPLES</h4>
    237 <blockquote>
    238 <p>The following example illustrates the value of {NGROUPS_MAX}:</p>
    239 <pre>
    240 <tt>getconf NGROUPS_MAX
    241 </tt></pre>
    242 <p>The following example illustrates the value of {NAME_MAX} for a specific directory:</p>
    243 <pre>
    244 <tt>getconf NAME_MAX /usr
    245 </tt></pre>
    246 <p>The following example shows how to deal more carefully with results that might be unspecified:</p>
    247 <pre>
    248 <tt>if value=$(getconf PATH_MAX /usr); then
    249     if [ "$value" = "undefined" ]; then
    250         echo PATH_MAX in /usr is indeterminate.
    251     else
    252         echo PATH_MAX in /usr is $value.
    253     fi
    254 else
    255     echo Error in getconf.
    256 fi
    257 </tt></pre></blockquote>
    258 <h4 class="mansect"><a name="tag_20_52_18" id="tag_20_52_18"></a>RATIONALE</h4>
    259 <blockquote>
    260 <p>The original need for this utility, and for the <a href="../functions/confstr.html"><i>confstr</i>()</a> function, was to
    261 provide a way of finding the configuration-defined default value for the <i>PATH</i> environment variable. Since <i>PATH</i> can be
    262 modified by the user to include directories that could contain utilities replacing the standard utilities, shell scripts need a way
    263 to determine the system-supplied <i>PATH</i> environment variable value that contains the correct search path for the standard
    264 utilities. It was later suggested that access to the other variables described in this volume of POSIX.1-2024 could also be useful
    265 to applications.</p>
    266 <p>This functionality of <i>getconf</i> would not be adequately subsumed by another command such as:</p>
    267 <pre>
    268 <tt>grep </tt><i>var</i><tt> /etc/conf
    269 </tt></pre>
    270 <p>because such a strategy would provide correct values for neither those variables that can vary at runtime, nor those that can
    271 vary depending on the path.</p>
    272 <p>Early proposal versions of <i>getconf</i> specified exit status 1 when the specified variable was valid, but not defined on the
    273 system. The output string <tt>"undefined"</tt> is now used to specify this case with exit code 0 because so many things depend on
    274 an exit code of zero when an invoked utility is successful.</p>
    275 </blockquote>
    276 <h4 class="mansect"><a name="tag_20_52_19" id="tag_20_52_19"></a>FUTURE DIRECTIONS</h4>
    277 <blockquote>
    278 <p>None.</p>
    279 </blockquote>
    280 <h4 class="mansect"><a name="tag_20_52_20" id="tag_20_52_20"></a>SEE ALSO</h4>
    281 <blockquote>
    282 <p><a href="../utilities/c17.html#"><i>c17</i></a></p>
    283 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href=
    284 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a> , <a href=
    285 "../basedefs/limits.h.html"><i>&lt;limits.h&gt;</i></a></p>
    286 <p>XSH <a href="../functions/confstr.html#"><i>confstr</i></a> , <a href="../functions/fpathconf.html#"><i>fpathconf</i></a> ,
    287 <a href="../functions/sysconf.html#"><i>sysconf</i></a> , <a href="../functions/system.html#"><i>system</i></a></p>
    288 </blockquote>
    289 <h4 class="mansect"><a name="tag_20_52_21" id="tag_20_52_21"></a>CHANGE HISTORY</h4>
    290 <blockquote>
    291 <p>First released in Issue 4.</p>
    292 </blockquote>
    293 <h4 class="mansect"><a name="tag_20_52_22" id="tag_20_52_22"></a>Issue 5</h4>
    294 <blockquote>
    295 <p>In the OPERANDS section:</p>
    296 <ul>
    297 <li>
    298 <p>{NL_MAX} is changed to {NL_NMAX}.</p>
    299 </li>
    300 <li>
    301 <p>Entries beginning NL_ are deleted from the list of standard configuration variables.</p>
    302 </li>
    303 <li>
    304 <p>The list of variables previously marked UX is merged with the list marked EX.</p>
    305 </li>
    306 <li>
    307 <p>Operands are added to support new Option Groups.</p>
    308 </li>
    309 <li>
    310 <p>Operands are added so that <i>getconf</i> can determine supported programming environments.</p>
    311 </li>
    312 </ul>
    313 </blockquote>
    314 <h4 class="mansect"><a name="tag_20_52_23" id="tag_20_52_23"></a>Issue 6</h4>
    315 <blockquote>
    316 <p>The Open Group Corrigendum U029/4 is applied, correcting the example command in the last paragraph of the OPTIONS section.</p>
    317 <p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
    318 <ul>
    319 <li>
    320 <p>Operands are added to determine supported programming environments.</p>
    321 </li>
    322 </ul>
    323 <p>This reference page is updated for alignment with the ISO/IEC&nbsp;9899:1999 standard. Specifically, new macros for <i>c99</i>
    324 programming environments are introduced.</p>
    325 <p>XSI marked <i>system_var</i> (XBS5_*) values are marked LEGACY.</p>
    326 <p>IEEE&nbsp;Std&nbsp;1003.1-2001/Cor&nbsp;1-2002, item XCU/TC1/D6/27 is applied, correcting the descriptions of <i>path_var</i>
    327 and <i>system_var</i> in the OPERANDS section.</p>
    328 </blockquote>
    329 <h4 class="mansect"><a name="tag_20_52_24" id="tag_20_52_24"></a>Issue 7</h4>
    330 <blockquote>
    331 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    332 <p>The EXAMPLES section is corrected.<br></p>
    333 <p>POSIX.1-2008, Technical Corrigendum 1, XCU/TC1-2008/0091 [125] is applied.</p>
    334 </blockquote>
    335 <h4 class="mansect"><a name="tag_20_52_25" id="tag_20_52_25"></a>Issue 8</h4>
    336 <blockquote>
    337 <p>Austin Group Defect 339 is applied, adding the <i>system_var</i> names NPROCESSORS_CONF and NPROCESSORS_ONLN.</p>
    338 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    339 <p>Austin Group Defect 1330 is applied, removing obsolescent interfaces and changing &quot;_V7_&quot; to &quot;_V8_&quot;.</p>
    340 </blockquote>
    341 <div class="box"><em>End of informative text.</em></div>
    342 <hr>
    343 <p>&nbsp;</p>
    344 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    345 <hr size="2" noshade>
    346 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    347 POSIX™ is a Trademark of The IEEE.<br>
    348 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    349 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    350 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    351 ]</font></center>
    352 <hr size="2" noshade>
    353 <div class="NAVHEADER">
    354 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    355 <tr class="nav">
    356 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/get.html" accesskey="P">&lt;&lt;&lt;
    357 Previous</a></td>
    358 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    359 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/getopts.html" accesskey="N">Next
    360 &gt;&gt;&gt;</a></td>
    361 </tr>
    362 </table>
    363 <hr align="left" width="100%"></div>
    364 </body>
    365 </html>