1GETCONF(P)                 POSIX Programmer's Manual                GETCONF(P)
2
3
4

NAME

6       getconf - get configuration values
7

SYNOPSIS

9       getconf [ -v specification ] system_var
10
11       getconf [ -v specification ] path_var pathname
12
13

DESCRIPTION

15       In  the  first  synopsis  form,  the getconf utility shall write to the
16       standard output the value of the variable specified by  the  system_var
17       operand.
18
19       In  the  second  synopsis  form, the getconf utility shall write to the
20       standard output the value of the variable specified by the path_var op‐
21       erand for the path specified by the pathname operand.
22
23       The  value  of each configuration variable shall be determined as if it
24       were obtained by calling the function from which it is  defined  to  be
25       available  by  this  volume  of  IEEE Std 1003.1-2001  or by the System
26       Interfaces volume of IEEE Std 1003.1-2001 (see the  OPERANDS  section).
27       The  value  shall  reflect conditions in the current operating environ‐
28       ment.
29

OPTIONS

31       The getconf utility shall conform to the  Base  Definitions  volume  of
32       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
33
34       The following option shall be supported:
35
36       -v  specification
37
38              Indicate a specific specification and version for which configu‐
39              ration variables shall be determined.  If  this  option  is  not
40              specified,  the  values returned correspond to an implementation
41              default conforming compilation environment.
42
43       If the command:
44
45
46              getconf _POSIX_V6_ILP32_OFF32
47
48       does not write "-1\n" or "undefined\n" to standard  output,  then  com‐
49       mands of the form:
50
51
52              getconf -v POSIX_V6_ILP32_OFF32 ...
53
54       determine  values  for  configuration  variables  corresponding  to the
55       POSIX_V6_ILP32_OFF32 compilation environment specified  in  c99  ,  the
56       EXTENDED DESCRIPTION.
57
58       If the command:
59
60
61              getconf _POSIX_V6_ILP32_OFFBIG
62
63       does  not  write  "-1\n" or "undefined\n" to standard output, then com‐
64       mands of the form:
65
66
67              getconf -v POSIX_V6_ILP32_OFFBIG ...
68
69       determine values  for  configuration  variables  corresponding  to  the
70       POSIX_V6_ILP32_OFFBIG  compilation  environment  specified in c99 , the
71       EXTENDED DESCRIPTION.
72
73       If the command:
74
75
76              getconf _POSIX_V6_LP64_OFF64
77
78       does not write "-1\n" or "undefined\n" to standard  output,  then  com‐
79       mands of the form:
80
81
82              getconf -v POSIX_V6_LP64_OFF64 ...
83
84       determine  values  for  configuration  variables  corresponding  to the
85       POSIX_V6_LP64_OFF64 compilation environment  specified  in  c99  ,  the
86       EXTENDED DESCRIPTION.
87
88       If the command:
89
90
91              getconf _POSIX_V6_LPBIG_OFFBIG
92
93       does  not  write  "-1\n" or "undefined\n" to standard output, then com‐
94       mands of the form:
95
96
97              getconf -v POSIX_V6_LPBIG_OFFBIG ...
98
99       determine values  for  configuration  variables  corresponding  to  the
100       POSIX_V6_LPBIG_OFFBIG  compilation  environment  specified in c99 , the
101       EXTENDED DESCRIPTION.
102
103

OPERANDS

105       The following operands shall be supported:
106
107       path_var
108              A name of a configuration variable. All of the variables in  the
109              Variable  column  of  the table in the DESCRIPTION of the fpath‐
110              conf() function defined  in  the  System  Interfaces  volume  of
111              IEEE Std 1003.1-2001,  without  the  enclosing  braces, shall be
112              supported.  The implementation may add other local variables.
113
114       pathname
115              A pathname for which the variable specified by path_var is to be
116              determined.
117
118       system_var
119              A  name  of a configuration variable. All of the following vari‐
120              ables shall be supported:
121
122               * The names in the Variable column of the table in the DESCRIP‐
123                 TION  of the sysconf() function in the System Interfaces vol‐
124                 ume of IEEE Std 1003.1-2001, except for  the  entries  corre‐
125                 sponding    to    _SC_CLK_TCK,    _SC_GETGR_R_SIZE_MAX,   and
126                 _SC_GETPW_R_SIZE_MAX, without the enclosing braces.
127
128              For compatibility with earlier versions, the following  variable
129              names shall also be supported:
130
131
132                     POSIX2_C_BIND
133                     POSIX2_C_DEV
134                     POSIX2_CHAR_TERM
135                     POSIX2_FORT_DEV
136                     POSIX2_FORT_RUN
137                     POSIX2_LOCALEDEF
138                     POSIX2_SW_DEV
139                     POSIX2_UPE
140                     POSIX2_VERSION
141
142              and shall be equivalent to the same name prefixed with an under‐
143              score.  This requirement may be removed in a future version.
144
145               * The names of the symbolic constants used as the name argument
146                 of  the confstr() function in the System Interfaces volume of
147                 IEEE Std 1003.1-2001, without the _CS_ prefix.
148
149               * The names of the symbolic constants listed under the headings
150                 ``Maximum  Values'' and ``Minimum Values'' in the description
151                 of the <limits.h> header in the Base  Definitions  volume  of
152                 IEEE Std 1003.1-2001, without the enclosing braces.
153
154              For  compatibility with earlier versions, the following variable
155              names shall also be supported:
156
157
158                     POSIX2_BC_BASE_MAX
159                     POSIX2_BC_DIM_MAX
160                     POSIX2_BC_SCALE_MAX
161                     POSIX2_BC_STRING_MAX
162                     POSIX2_COLL_WEIGHTS_MAX
163                     POSIX2_EXPR_NEST_MAX
164                     POSIX2_LINE_MAX
165                     POSIX2_RE_DUP_MAX
166
167              and shall be equivalent to the same name prefixed with an under‐
168              score.  This requirement may be removed in a future version.
169
170       The implementation may add other local values.
171
172

STDIN

174       Not used.
175

INPUT FILES

177       None.
178

ENVIRONMENT VARIABLES

180       The  following environment variables shall affect the execution of get‐
181       conf:
182
183       LANG   Provide a default value for the  internationalization  variables
184              that  are  unset  or  null.  (See the Base Definitions volume of
185              IEEE Std 1003.1-2001, Section  8.2,  Internationalization  Vari‐
186              ables  for the precedence of internationalization variables used
187              to determine the values of locale categories.)
188
189       LC_ALL If set to a non-empty string value, override the values  of  all
190              the other internationalization variables.
191
192       LC_CTYPE
193              Determine  the  locale  for  the  interpretation of sequences of
194              bytes of text data as characters (for  example,  single-byte  as
195              opposed to multi-byte characters in arguments).
196
197       LC_MESSAGES
198              Determine  the  locale  that should be used to affect the format
199              and contents of diagnostic messages written to standard error.
200
201       NLSPATH
202              Determine the location of message catalogs for the processing of
203              LC_MESSAGES .
204
205

ASYNCHRONOUS EVENTS

207       Default.
208

STDOUT

210       If  the  specified  variable  is defined on the system and its value is
211       described to be available from the confstr() function  defined  in  the
212       System  Interfaces  volume  of IEEE Std 1003.1-2001, its value shall be
213       written in the following format:
214
215
216              "%s\n", <value>
217
218       Otherwise, if the specified variable is  defined  on  the  system,  its
219       value shall be written in the following format:
220
221
222              "%d\n", <value>
223
224       If  the  specified  variable  is valid, but is undefined on the system,
225       getconf shall write using the following format:
226
227
228              "undefined\n"
229
230       If the variable name is invalid or an error occurs,  nothing  shall  be
231       written to standard output.
232

STDERR

234       The standard error shall be used only for diagnostic messages.
235

OUTPUT FILES

237       None.
238

EXTENDED DESCRIPTION

240       None.
241

EXIT STATUS

243       The following exit values shall be returned:
244
245        0     The  specified  variable is valid and information about its cur‐
246              rent state was written successfully.
247
248       >0     An error occurred.
249
250

CONSEQUENCES OF ERRORS

252       Default.
253
254       The following sections are informative.
255

APPLICATION USAGE

257       None.
258

EXAMPLES

260       The following example illustrates the value of {NGROUPS_MAX}:
261
262
263              getconf NGROUPS_MAX
264
265       The following example illustrates the value of {NAME_MAX}  for  a  spe‐
266       cific directory:
267
268
269              getconf NAME_MAX /usr
270
271       The  following  example  shows  how to deal more carefully with results
272       that might be unspecified:
273
274
275              if value=$(getconf PATH_MAX /usr); then
276                  if [ "$value" = "undefined" ]; then
277                      echo PATH_MAX in /usr is infinite.
278                  else
279                      echo PATH_MAX in /usr is $value.
280                  fi
281              else
282                  echo Error in getconf.
283              fi
284
285       Note that:
286
287
288              sysconf(_SC_POSIX_C_BIND);
289
290       and:
291
292
293              system("getconf POSIX2_C_BIND");
294
295       in a C program could give different answers. The  sysconf()  call  sup‐
296       plies  a  value that corresponds to the conditions when the program was
297       either compiled or executed, depending on the implementation; the  sys‐
298       tem()  call  to getconf always supplies a value corresponding to condi‐
299       tions when the program is executed.
300

RATIONALE

302       The original need for this utility, and for the confstr() function, was
303       to provide a way of finding the configuration-defined default value for
304       the PATH environment variable. Since PATH can be modified by  the  user
305       to include directories that could contain utilities replacing the stan‐
306       dard utilities, shell scripts need a way to determine  the  system-sup‐
307       plied  PATH environment variable value that contains the correct search
308       path for the standard utilities. It was later suggested that access  to
309       the  other  variables  described in this volume of IEEE Std 1003.1-2001
310       could also be useful to applications.
311
312       This functionality of getconf  would  not  be  adequately  subsumed  by
313       another command such as:
314
315
316              grep var /etc/conf
317
318       because  such a strategy would provide correct values for neither those
319       variables that can vary at runtime, nor those that can  vary  depending
320       on the path.
321
322       Early  proposal  versions  of  getconf specified exit status 1 when the
323       specified variable was valid, but not defined on the system. The output
324       string  "undefined"  is  now used to specify this case with exit code 0
325       because so many things depend on an exit code of zero when  an  invoked
326       utility is successful.
327

FUTURE DIRECTIONS

329       None.
330

SEE ALSO

332       c99  , the Base Definitions volume of IEEE Std 1003.1-2001, <limits.h>,
333       the System Interfaces volume of IEEE Std 1003.1-2001, confstr(),  path‐
334       conf(), sysconf(), system()
335
337       Portions  of  this text are reprinted and reproduced in electronic form
338       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
339       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
340       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
341       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
342       event of any discrepancy between this version and the original IEEE and
343       The  Open Group Standard, the original IEEE and The Open Group Standard
344       is the referee document. The original Standard can be  obtained  online
345       at http://www.opengroup.org/unix/online.html .
346
347
348
349IEEE/The Open Group                  2003                           GETCONF(P)
Impressum