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

DESCRIPTION

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

OPTIONS

35       The getconf utility shall conform to the  Base  Definitions  volume  of
36       POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
37
38       The following option shall be supported:
39
40       -v specification
41                 Indicate  a specific specification and version for which con‐
42                 figuration variables shall be determined. If this  option  is
43                 not specified, the values returned correspond to an implemen‐
44                 tation default conforming compilation environment.
45
46                 If the command:
47
48
49                     getconf _POSIX_V7_ILP32_OFF32
50
51                 does not write "-1\n" or "undefined\n"  to  standard  output,
52                 then commands of the form:
53
54
55                     getconf -v POSIX_V7_ILP32_OFF32 ...
56
57                 determine values for configuration variables corresponding to
58                 the POSIX_V7_ILP32_OFF32 compilation environment specified in
59                 c99, the EXTENDED DESCRIPTION.
60
61                 If the command:
62
63
64                     getconf _POSIX_V7_ILP32_OFFBIG
65
66                 does  not  write  "-1\n" or "undefined\n" to standard output,
67                 then commands of the form:
68
69
70                     getconf -v POSIX_V7_ILP32_OFFBIG ...
71
72                 determine values for configuration variables corresponding to
73                 the  POSIX_V7_ILP32_OFFBIG  compilation environment specified
74                 in c99, the EXTENDED DESCRIPTION.
75
76                 If the command:
77
78
79                     getconf _POSIX_V7_LP64_OFF64
80
81                 does not write "-1\n" or "undefined\n"  to  standard  output,
82                 then commands of the form:
83
84
85                     getconf -v POSIX_V7_LP64_OFF64 ...
86
87                 determine values for configuration variables corresponding to
88                 the POSIX_V7_LP64_OFF64 compilation environment specified  in
89                 c99, the EXTENDED DESCRIPTION.
90
91                 If the command:
92
93
94                     getconf _POSIX_V7_LPBIG_OFFBIG
95
96                 does  not  write  "-1\n" or "undefined\n" to standard output,
97                 then commands of the form:
98
99
100                     getconf -v POSIX_V7_LPBIG_OFFBIG ...
101
102                 determine values for configuration variables corresponding to
103                 the  POSIX_V7_LPBIG_OFFBIG  compilation environment specified
104                 in c99, the EXTENDED DESCRIPTION.
105

OPERANDS

107       The following operands shall be supported:
108
109       path_var  A name of a configuration variable. All of the  variables  in
110                 the  Variable  column  of the table in the DESCRIPTION of the
111                 fpathconf() function defined in the System Interfaces  volume
112                 of  POSIX.1‐2017, without the enclosing braces, shall be sup‐
113                 ported. The implementation may add other local variables.
114
115       pathname  A pathname for which the variable specified by path_var is to
116                 be determined.
117
118       system_var
119                 A  name  of  a  configuration  variable. All of the following
120                 variables shall be supported:
121
122                  *  The names in the Variable column  of  the  table  in  the
123                     DESCRIPTION  of  the  sysconf()  function  in  the System
124                     Interfaces volume of POSIX.1‐2017, except for the entries
125                     corresponding  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
129                     variable  names  shall  also  be supported: POSIX2_C_BIND
130                     POSIX2_C_DEV       POSIX2_CHAR_TERM       POSIX2_FORT_DEV
131                     POSIX2_FORT_RUN POSIX2_LOCALEDEF POSIX2_SW_DEV POSIX2_UPE
132                     POSIX2_VERSION
133
134                     and shall be equivalent to the same name prefixed with an
135                     <underscore>.   This  requirement  may  be  removed  in a
136                     future version.
137
138                  *  The names of the symbolic  constants  used  as  the  name
139                     argument  of  the confstr() function in the System Inter‐
140                     faces volume of POSIX.1‐2017, without the _CS_ prefix.
141
142                  *  The names of the  symbolic  constants  listed  under  the
143                     headings ``Maximum Values'' and ``Minimum Values'' in the
144                     description of the <limits.h> header in the Base  Defini‐
145                     tions  volume  of  POSIX.1‐2017,  without  the  enclosing
146                     braces.
147
148                     For compatibility with earlier  versions,  the  following
149                     variable     names     shall     also    be    supported:
150                     POSIX2_BC_BASE_MAX POSIX2_BC_DIM_MAX  POSIX2_BC_SCALE_MAX
151                     POSIX2_BC_STRING_MAX              POSIX2_COLL_WEIGHTS_MAX
152                     POSIX2_EXPR_NEST_MAX POSIX2_LINE_MAX POSIX2_RE_DUP_MAX
153
154                     and shall be equivalent to the same name prefixed with an
155                     <underscore>.   This  requirement  may  be  removed  in a
156                     future version.
157
158                 The implementation may add other local values.
159

STDIN

161       Not used.
162

INPUT FILES

164       None.
165

ENVIRONMENT VARIABLES

167       The following environment variables shall affect the execution of  get‐
168       conf:
169
170       LANG      Provide  a  default  value for the internationalization vari‐
171                 ables that are unset or null. (See the Base Definitions  vol‐
172                 ume  of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
173                 ables for the precedence  of  internationalization  variables
174                 used to determine the values of locale categories.)
175
176       LC_ALL    If  set  to  a non-empty string value, override the values of
177                 all the other internationalization variables.
178
179       LC_CTYPE  Determine the locale for the interpretation of  sequences  of
180                 bytes of text data as characters (for example, single-byte as
181                 opposed to multi-byte characters in arguments).
182
183       LC_MESSAGES
184                 Determine the locale that should be used to affect the format
185                 and  contents  of  diagnostic  messages  written  to standard
186                 error.
187
188       NLSPATH   Determine the location of message catalogs for the processing
189                 of LC_MESSAGES.
190

ASYNCHRONOUS EVENTS

192       Default.
193

STDOUT

195       If  the  specified  variable  is defined on the system and its value is
196       described to be available from the confstr() function  defined  in  the
197       System Interfaces volume of POSIX.1‐2017, its value shall be written in
198       the following format:
199
200
201           "%s\n", <value>
202
203       Otherwise, if the specified variable is  defined  on  the  system,  its
204       value shall be written in the following format:
205
206
207           "%d\n", <value>
208
209       If  the  specified  variable  is valid, but is undefined on the system,
210       getconf shall write using the following format:
211
212
213           "undefined\n"
214
215       If the variable name is invalid or an error occurs,  nothing  shall  be
216       written to standard output.
217

STDERR

219       The standard error shall be used only for diagnostic messages.
220

OUTPUT FILES

222       None.
223

EXTENDED DESCRIPTION

225       None.
226

EXIT STATUS

228       The following exit values shall be returned:
229
230        0    The specified variable is valid and information about its current
231             state was written successfully.
232
233       >0    An error occurred.
234

CONSEQUENCES OF ERRORS

236       Default.
237
238       The following sections are informative.
239

APPLICATION USAGE

241       None.
242

EXAMPLES

244       The following example illustrates the value of {NGROUPS_MAX}:
245
246
247           getconf NGROUPS_MAX
248
249       The following example illustrates the value of {NAME_MAX}  for  a  spe‐
250       cific directory:
251
252
253           getconf NAME_MAX /usr
254
255       The  following  example  shows  how to deal more carefully with results
256       that might be unspecified:
257
258
259           if value=$(getconf PATH_MAX /usr); then
260               if [ "$value" = "undefined" ]; then
261                   echo PATH_MAX in /usr is indeterminate.
262               else
263                   echo PATH_MAX in /usr is $value.
264               fi
265           else
266               echo Error in getconf.
267           fi
268

RATIONALE

270       The original need for this utility, and for the confstr() function, was
271       to provide a way of finding the configuration-defined default value for
272       the PATH environment variable. Since PATH can be modified by  the  user
273       to include directories that could contain utilities replacing the stan‐
274       dard utilities, shell scripts need a way to determine  the  system-sup‐
275       plied  PATH environment variable value that contains the correct search
276       path for the standard utilities. It was later suggested that access  to
277       the other variables described in this volume of POSIX.1‐2017 could also
278       be useful to applications.
279
280       This functionality of getconf  would  not  be  adequately  subsumed  by
281       another command such as:
282
283
284           grep var /etc/conf
285
286       because  such a strategy would provide correct values for neither those
287       variables that can vary at runtime, nor those that can  vary  depending
288       on the path.
289
290       Early  proposal  versions  of  getconf specified exit status 1 when the
291       specified variable was valid, but not defined on the system. The output
292       string  "undefined"  is  now used to specify this case with exit code 0
293       because so many things depend on an exit code of zero when  an  invoked
294       utility is successful.
295

FUTURE DIRECTIONS

297       None.
298

SEE ALSO

300       c99
301
302       The  Base  Definitions  volume  of POSIX.1‐2017, Chapter 8, Environment
303       Variables, Section 12.2, Utility Syntax Guidelines, <limits.h>
304
305       The System Interfaces volume of POSIX.1‐2017,  confstr(),  fpathconf(),
306       sysconf(), system()
307
309       Portions  of  this text are reprinted and reproduced in electronic form
310       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
311       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
312       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
313       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
314       event of any discrepancy between this version and the original IEEE and
315       The  Open Group Standard, the original IEEE and The Open Group Standard
316       is the referee document. The original Standard can be  obtained  online
317       at http://www.opengroup.org/unix/online.html .
318
319       Any  typographical  or  formatting  errors that appear in this page are
320       most likely to have been introduced during the conversion of the source
321       files  to  man page format. To report such errors, see https://www.ker
322       nel.org/doc/man-pages/reporting_bugs.html .
323
324
325
326IEEE/The Open Group                  2017                          GETCONF(1P)
Impressum