Skip Navigation Links | |
Exit Print View | |
man pages section 1: User Commands Oracle Solaris 11 Express 11/10 |
- get configuration values
/usr/bin/getconf [-v specification] system_var
/usr/bin/getconf [-v specification] path_var pathname
/usr/bin/getconf -a
/usr/xpg4/bin/getconf [-v specification] system_var
/usr/xpg4/bin/getconf [-v specification] path_var pathname
/usr/xpg4/bin/getconf -a
/usr/xpg6/bin/getconf [-v specification] system_var
/usr/xpg6/bin/getconf [-v specification] path_var pathname
/usr/xpg6/bin/getconf -a
getconf [-abdlpqrtw] [-c RE] [-n RE] [-s RE] [-v name][name [path [value]] ...]
In the first synopsis form, the getconf utility writes to the standard output the value of the variable specified by system_var, in accordance with specification if the -v option is used.
In the second synopsis form, getconf writes to the standard output the value of the variable specified by path_var for the path specified by pathname, in accordance with specification if the -v option is used.
In the third synopsis form, config writes to the standard output the names of the current system configuration variables.
The value of each configuration variable is determined as if it were obtained by calling the function from which it is defined to be available. The value reflects conditions in the current operating environment.
The getconf built-in in ksh93 is associated with the /bin and /usr/bin paths. It is invoked when getconf is executed without a pathname prefix and the pathname search finds a /bin/getconf or /usr/bin/getconf executable.
getconf displays the system configuration value for name. If name is a filesystem specific variable, the value is determined relative to path, or, the current directory, if path is omitted. If value is specified, getconf attempts to change the process local value to value. - can be used in place of path when it is not relevant. Only writable variables can be set. readonly variables cannot be changed.
The current value for name is written to the standard output. If name is valid but undefined, undefined is written to the standard output. If name is invalid or an error occurs in determining its value, a diagnostic is written to standard error and getconf exits with a non-zero exit status.
More than one variable can be set or queried by providing the name path value 3-tuple for each variable, specifying - for value when querying.
If no operands are specified, all known variables are written in name=value form to the standard output, one per line. Only one of --call, --name or --standard can be specified.
The following options are supported by /usr/bin/getconf, /usr/xpg4/bin/getconf, and /usr/xpg6/bin/getconf
Writes the names of the current system configuration variables to the standard output.
Gives the specification which governs the selection of values for configuration variables.
The following options are supported by the getconf built-in command in ksh93:
Call the native getconf -a.
List base variable name without call and standard prefixes.
Display variables with call prefix that matches RE. The call prefixes are:
CS
PC
SC
SI
XX
Constant value
Only display defined values when no operands are specified.
List variable names in lower case.
Display variables with names that match RE.
Display the named writable variables and values in a form that can be directly executed by ksh93(1) to set the values. If name is omitted, lists all writable variables.
Quote values ("...").
Display the named readonly variables in name=value form. If name is omitted, lists all readonly variables.
Display variables with standard prefix that matches RE. Use the --table option to view all standard prefixes, including local additions.
The standard prefixes available on all systems are:
AES AST C GNU POSIX SVID XBS5 XOPEN XPG
Display the internal table that contains the name, standard, standard section, and system call symbol prefix for each variable.
Display the named writable variables in name=value form. If name is omitted, lists all writable variables.
Call the native getconf -v name.
The following operands are supported by /usr/bin/getconf, /usr/xpg4/bin/getconf, and /usr/xpg6/bin/getconf:
A name of a configuration variable whose value is available from the pathconf(2) function. All of the values in the following table are supported:
|
A path name for which the variable specified by path_var is to be determined.
A name of a configuration variable whose value is available from confstr(3C) or sysconf(3C). All of the values in the following table are supported:
|
The symbol PATH also is recognized, yielding the same value as the confstr() name value CS_PATH.
See largefile(5) for the description of the behavior of /usr/bin/getconf when encountering files greater than or equal to 2 Gbyte ( 231 bytes).
Example 1 Writing the Value of a Variable
This example illustrates the value of {NGROUPS_MAX}:
example% getconf NGROUPS_MAX
Example 2 Writing the Value of a Variable for a Specific Directory
This example illustrates the value of NAME_MAX for a specific directory:
example% getconf NAME_MAX /usr
Example 3 Dealing with Unspecified Results
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
For example:
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.
See environ(5) for descriptions of the following environment variables that affect the execution of getconf: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
The following environment variable is supported by the ksh93 built-in getconf command:
Local writable values that are different from the default are stored in the _AST_FEATURES environment variable. The _AST_FEATURES value is a space-separated list of name path value 3-tuples, where name is the system configuration name, path is the corresponding path, - if no path is applicable, and value is the system configuration value.
The following exit values are returned:
The specified variable is valid and information about its current state was written successfully.
An error occurred.
See attributes(5) for descriptions of the following attributes:
|
|
The ksh93 built-in binding to /bin and /usr/bin is Volatile. The built-in command-line interface is Committed.
ksh93(1), sh(1), pathconf(2), sysinfo(2), confstr(3C), sysconf(3C), attributes(5), environ(5), largefile(5), standards(5)