1GETCONF(1P) POSIX Programmer's Manual GETCONF(1P)
2
3
4
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
11
13 getconf — get configuration values
14
16 getconf [−v specification] system_var
17
18 getconf [−v specification] path_var pathname
19
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 POSIX.1‐2008 or by the System Interfaces
32 volume of POSIX.1‐2008 (see the OPERANDS section). The value shall
33 reflect conditions in the current operating environment.
34
36 The getconf utility shall conform to the Base Definitions volume of
37 POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
38
39 The following option shall be supported:
40
41 −v specification
42 Indicate a specific specification and version for which con‐
43 figuration variables shall be determined. If this option is
44 not specified, the values returned correspond to an implemen‐
45 tation default conforming compilation environment.
46
47 If the command:
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 getconf −v POSIX_V7_ILP32_OFF32 ...
55
56 determine values for configuration variables corresponding to
57 the POSIX_V7_ILP32_OFF32 compilation environment specified in
58 c99, the EXTENDED DESCRIPTION.
59
60 If the command:
61
62 getconf _POSIX_V7_ILP32_OFFBIG
63
64 does not write "−1\n" or "undefined\n" to standard output,
65 then commands of the form:
66
67 getconf −v POSIX_V7_ILP32_OFFBIG ...
68
69 determine values for configuration variables corresponding to
70 the POSIX_V7_ILP32_OFFBIG compilation environment specified
71 in c99, the EXTENDED DESCRIPTION.
72
73 If the command:
74
75 getconf _POSIX_V7_LP64_OFF64
76
77 does not write "−1\n" or "undefined\n" to standard output,
78 then commands of the form:
79
80 getconf −v POSIX_V7_LP64_OFF64 ...
81
82 determine values for configuration variables corresponding to
83 the POSIX_V7_LP64_OFF64 compilation environment specified in
84 c99, the EXTENDED DESCRIPTION.
85
86 If the command:
87
88 getconf _POSIX_V7_LPBIG_OFFBIG
89
90 does not write "−1\n" or "undefined\n" to standard output,
91 then commands of the form:
92
93 getconf −v POSIX_V7_LPBIG_OFFBIG ...
94
95 determine values for configuration variables corresponding to
96 the POSIX_V7_LPBIG_OFFBIG compilation environment specified
97 in c99, the EXTENDED DESCRIPTION.
98
100 The following operands shall be supported:
101
102 path_var A name of a configuration variable. All of the variables in
103 the Variable column of the table in the DESCRIPTION of the
104 fpathconf() function defined in the System Interfaces volume
105 of POSIX.1‐2008, without the enclosing braces, shall be sup‐
106 ported. The implementation may add other local variables.
107
108 pathname A pathname for which the variable specified by path_var is to
109 be determined.
110
111 system_var
112 A name of a configuration variable. All of the following
113 variables shall be supported:
114
115 * The names in the Variable column of the table in the
116 DESCRIPTION of the sysconf() function in the System
117 Interfaces volume of POSIX.1‐2008, except for the entries
118 corresponding to _SC_CLK_TCK, _SC_GETGR_R_SIZE_MAX, and
119 _SC_GETPW_R_SIZE_MAX, without the enclosing braces.
120
121 For compatibility with earlier versions, the following
122 variable names shall also be supported: POSIX2_C_BIND
123 POSIX2_C_DEV POSIX2_CHAR_TERM POSIX2_FORT_DEV
124 POSIX2_FORT_RUN POSIX2_LOCALEDEF POSIX2_SW_DEV POSIX2_UPE
125 POSIX2_VERSION
126
127 and shall be equivalent to the same name prefixed with an
128 <underscore>. This requirement may be removed in a
129 future version.
130
131 * The names of the symbolic constants used as the name
132 argument of the confstr() function in the System Inter‐
133 faces volume of POSIX.1‐2008, without the _CS_ prefix.
134
135 * The names of the symbolic constants listed under the
136 headings ``Maximum Values'' and ``Minimum Values'' in the
137 description of the <limits.h> header in the Base Defini‐
138 tions volume of POSIX.1‐2008, without the enclosing
139 braces.
140
141 For compatibility with earlier versions, the following
142 variable names shall also be supported:
143 POSIX2_BC_BASE_MAX POSIX2_BC_DIM_MAX POSIX2_BC_SCALE_MAX
144 POSIX2_BC_STRING_MAX POSIX2_COLL_WEIGHTS_MAX
145 POSIX2_EXPR_NEST_MAX POSIX2_LINE_MAX POSIX2_RE_DUP_MAX
146
147 and shall be equivalent to the same name prefixed with an
148 <underscore>. This requirement may be removed in a
149 future version.
150
151 The implementation may add other local values.
152
154 Not used.
155
157 None.
158
160 The following environment variables shall affect the execution of get‐
161 conf:
162
163 LANG Provide a default value for the internationalization vari‐
164 ables that are unset or null. (See the Base Definitions vol‐
165 ume of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
166 ables for the precedence of internationalization variables
167 used to determine the values of locale categories.)
168
169 LC_ALL If set to a non-empty string value, override the values of
170 all the other internationalization variables.
171
172 LC_CTYPE Determine the locale for the interpretation of sequences of
173 bytes of text data as characters (for example, single-byte as
174 opposed to multi-byte characters in arguments).
175
176 LC_MESSAGES
177 Determine the locale that should be used to affect the format
178 and contents of diagnostic messages written to standard
179 error.
180
181 NLSPATH Determine the location of message catalogs for the processing
182 of LC_MESSAGES.
183
185 Default.
186
188 If the specified variable is defined on the system and its value is
189 described to be available from the confstr() function defined in the
190 System Interfaces volume of POSIX.1‐2008, its value shall be written in
191 the following format:
192
193 "%s\n", <value>
194
195 Otherwise, if the specified variable is defined on the system, its
196 value shall be written in the following format:
197
198 "%d\n", <value>
199
200 If the specified variable is valid, but is undefined on the system,
201 getconf shall write using the following format:
202
203 "undefined\n"
204
205 If the variable name is invalid or an error occurs, nothing shall be
206 written to standard output.
207
209 The standard error shall be used only for diagnostic messages.
210
212 None.
213
215 None.
216
218 The following exit values shall be returned:
219
220 0 The specified variable is valid and information about its current
221 state was written successfully.
222
223 >0 An error occurred.
224
226 Default.
227
228 The following sections are informative.
229
231 None.
232
234 The following example illustrates the value of {NGROUPS_MAX}:
235
236 getconf NGROUPS_MAX
237
238 The following example illustrates the value of {NAME_MAX} for a spe‐
239 cific directory:
240
241 getconf NAME_MAX /usr
242
243 The following example shows how to deal more carefully with results
244 that might be unspecified:
245
246 if value=$(getconf PATH_MAX /usr); then
247 if [ "$value" = "undefined" ]; then
248 echo PATH_MAX in /usr is indeterminate.
249 else
250 echo PATH_MAX in /usr is $value.
251 fi
252 else
253 echo Error in getconf.
254 fi
255
257 The original need for this utility, and for the confstr() function, was
258 to provide a way of finding the configuration-defined default value for
259 the PATH environment variable. Since PATH can be modified by the user
260 to include directories that could contain utilities replacing the stan‐
261 dard utilities, shell scripts need a way to determine the system-sup‐
262 plied PATH environment variable value that contains the correct search
263 path for the standard utilities. It was later suggested that access to
264 the other variables described in this volume of POSIX.1‐2008 could also
265 be useful to applications.
266
267 This functionality of getconf would not be adequately subsumed by
268 another command such as:
269
270 grep var /etc/conf
271
272 because such a strategy would provide correct values for neither those
273 variables that can vary at runtime, nor those that can vary depending
274 on the path.
275
276 Early proposal versions of getconf specified exit status 1 when the
277 specified variable was valid, but not defined on the system. The output
278 string "undefined" is now used to specify this case with exit code 0
279 because so many things depend on an exit code of zero when an invoked
280 utility is successful.
281
283 None.
284
286 c99
287
288 The Base Definitions volume of POSIX.1‐2008, Chapter 8, Environment
289 Variables, Section 12.2, Utility Syntax Guidelines, <limits.h>
290
291 The System Interfaces volume of POSIX.1‐2008, confstr(), fpathconf(),
292 sysconf(), system()
293
295 Portions of this text are reprinted and reproduced in electronic form
296 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
297 -- Portable Operating System Interface (POSIX), The Open Group Base
298 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
299 cal and Electronics Engineers, Inc and The Open Group. (This is
300 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
301 event of any discrepancy between this version and the original IEEE and
302 The Open Group Standard, the original IEEE and The Open Group Standard
303 is the referee document. The original Standard can be obtained online
304 at http://www.unix.org/online.html .
305
306 Any typographical or formatting errors that appear in this page are
307 most likely to have been introduced during the conversion of the source
308 files to man page format. To report such errors, see https://www.ker‐
309 nel.org/doc/man-pages/reporting_bugs.html .
310
311
312
313IEEE/The Open Group 2013 GETCONF(1P)