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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       getconf - get configuration values
13

SYNOPSIS

15       getconf [ -v specification ] system_var
16
17       getconf [ -v specification ] path_var pathname
18
19

DESCRIPTION

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

OPTIONS

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

OPERANDS

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

STDIN

180       Not used.
181

INPUT FILES

183       None.
184

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

213       Default.
214

STDOUT

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

STDERR

240       The standard error shall be used only for diagnostic messages.
241

OUTPUT FILES

243       None.
244

EXTENDED DESCRIPTION

246       None.
247

EXIT STATUS

249       The following exit values shall be returned:
250
251        0     The specified variable is valid and information about  its  cur‐
252              rent state was written successfully.
253
254       >0     An error occurred.
255
256

CONSEQUENCES OF ERRORS

258       Default.
259
260       The following sections are informative.
261

APPLICATION USAGE

263       None.
264

EXAMPLES

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

RATIONALE

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

FUTURE DIRECTIONS

335       None.
336

SEE ALSO

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