NAME
getconf — get
configuration values
SYNOPSIS
getconf |
[-v specification] system_var |
getconf |
[-v specification] path_var pathname |
DESCRIPTION
In the first synopsis form, the getconf
utility will write to the standard output the value of the variable
specified by the system_var operand.
In the second synopsis form, the
getconf utility will write to the standard output
the value of the variable specified by the
path_var operand
for the path specified by the
pathname
operand.
The value of each configuration variable will be determined as if it were obtained by calling the function from which it is defined to be available by this standard or by the XSH specification (see the OPERANDS section). The value will reflect conditions in the current operating environment.
OPTIONS
The getconf utility supports the XBD
specification,
Utility
Syntax Guidelines . The following option is supported:
- -v specification
- Indicate a specific specification and version for which configuration
variables are to be determined. If this option is not specified, the
values returned will correspond to an implementation default XBS5
conforming compilation environment. If the command:
does not write "-1\n" or "undefined\n" to standard output, then commands of the form:
getconf _XBS5_ILP32_OFF32
will determine values for configuration variables corresponding to the XBS5_ILP32_OFF32 compilation environment specified in c89(1) , EXTENDED DESCRIPTION. If the command:getconf -v XBS5_ILP32_OFF32 ...
does not write "-1\n" or "undefined\n" to standard output, then commands of the form:getconf _XBS5_ILP32_OFFBIG
will determine values for configuration variables corresponding to the XBS5_ILP32_OFFBIG compilation environment specified in c89(1) , EXTENDED DESCRIPTION. If the command:getconf -v XBS5_ILP32_OFFBIG ...
does not write "-1\n" or "undefined\n" to standard output, then commands of the form:getconf _XBS5_LP64_OFF64
will determine values for configuration variables corresponding to the XBS5_LP64_OFF64 compilation environment specified in c89(1) , EXTENDED DESCRIPTION. If the command:getconf -v XBS5_LP64_OFF64 ...
does not write "-1\n" or "undefined\n" to standard output, then commands of the form:getconf _XBS5_LPBIG_OFFBIG
will determine values for configuration variables corresponding to the XBS5_LPBIG_OFFBIG compilation environment specified in c89(1) , EXTENDED DESCRIPTION.getconf -v XBS5_LPBIG_OFFBIG
OPERANDS
The following operands are supported:
- path_var
- A name of a configuration variable. All of the variables in the XSH specification, pathconf(3) , DESCRIPTION are supported and the implementation may add other local variables.
- pathname
- A pathname for which the variable specified by path_var is to be determined.
- system_var
- A name of a configuration variable. All of the variables in the XSH
specification, confstr(3) and
sysconf(3) , DESCRIPTIONs are supported and the
implementation may add other local values: When the symbol listed in the
first column of the following table is used as the system_var operand,
getconfwill yield the same value as confstr(3) when called with the value in the second column:system_var confstr() Name Value PATH _CS_PATH XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILPBIG_OFF32_LINTFLAGS XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
STDIN
Not used.
INPUT FILES
None.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of
getconf :
LANG- Provide a default value for the internationalisation variables that are
unset or null. If
LANGis unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL- If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH- Determine the location of message catalogues for the processing of LC_MESSAGES .
ASYNCHRONOUS EVENTS
Default.
STDOUT
If the specified variable is defined on the system and its value
is described to be available from the XSH specification
confstr(3) function, its value will be written in the
following format: "%s\n", <
value
>
Otherwise, if the specified variable is defined on the system, its value will be written in the following format:
"%d\n", <value>
If the specified variable is valid, but is undefined on the
system, getconf will write using the following
format: "undefined\n"
If the variable name is invalid or an error occurs, nothing will be written to standard output.
STDERR
Used only for diagnostic messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
None.
EXIT STATUS
The following exit values are returned:
CONSEQUENCES OF ERRORS
Default.
APPLICATION USAGE
None.
EXAMPLES
This example illustrates the value of {NGROUPS_MAX}:
getconf NGROUPS_MAX
getconf NAME_MAX /usr
This example shows how to deal more carefully with results that might be unspecified:
if value=$(getconf PATH_MAX /usr); then
if [ "$value" = "undefined" ]; then
echo PATH_MAX in /usr is infinite.
else
echo PATH_MAX in /usr is $value.
fi
else
echo Error in getconf.
fi
Note that:
sysconf(_SC_POSIX_C_BIND); and:
system("getconf POSIX2_C_BIND"); in a C
program could give different answers. The
sysconf() call
supplies a value that corresponds to the conditions when the program was
either compiled or executed, depending on the implementation; the
system()
call to getconf always supplies a value
corresponding to conditions when the program is executed.
FUTURE DIRECTIONS
None.
SEE ALSO
c89(1) and the XSH specification description of confstr(3) , pathconf(3) , sysconf(3) .