GETCONF(1)                 POSIX Programmer's Manual                GETCONF(1)



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

NNAAMMEE
       getconf -- get configuration values

SSYYNNOOPPSSIISS
       getconf [[-v specification]] _s_y_s_t_e_m___v_a_r

       getconf [[-v specification]] _p_a_t_h___v_a_r _p_a_t_h_n_a_m_e

DDEESSCCRRIIPPTTIIOONN
       In the first synopsis form, the _g_e_t_c_o_n_f utility shall write to the
       standard output the value of the variable specified by the _s_y_s_t_e_m___v_a_r
       operand.

       In the second synopsis form, the _g_e_t_c_o_n_f utility shall write to the
       standard output the value of the variable specified by the _p_a_t_h___v_a_r
       operand for the path specified by the _p_a_t_h_n_a_m_e operand.

       The value of each configuration variable shall be determined as if it
       were obtained by calling the function from which it is defined to be
       available by this volume of POSIX.1-2017 or by the System Interfaces
       volume of POSIX.1-2017 (see the OPERANDS section). The value shall
       reflect conditions in the current operating environment.

OOPPTTIIOONNSS
       The _g_e_t_c_o_n_f utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s.

       The following option shall be supported:

       --vv _s_p_e_c_i_f_i_c_a_t_i_o_n
                 Indicate a specific specification and version for which
                 configuration variables shall be determined. If this option
                 is not specified, the values returned correspond to an
                 implementation default conforming compilation environment.

                 If the command:


                     getconf _POSIX_V7_ILP32_OFF32

                 does not write ""--11\\nn"" or ""uunnddeeffiinneedd\\nn"" to standard output,
                 then commands of the form:


                     getconf -v POSIX_V7_ILP32_OFF32 ...

                 determine values for configuration variables corresponding to
                 the POSIX_V7_ILP32_OFF32 compilation environment specified in
                 _c_9_9, the EXTENDED DESCRIPTION.

                 If the command:


                     getconf _POSIX_V7_ILP32_OFFBIG

                 does not write ""--11\\nn"" or ""uunnddeeffiinneedd\\nn"" to standard output,
                 then commands of the form:


                     getconf -v POSIX_V7_ILP32_OFFBIG ...

                 determine values for configuration variables corresponding to
                 the POSIX_V7_ILP32_OFFBIG compilation environment specified
                 in _c_9_9, the EXTENDED DESCRIPTION.

                 If the command:


                     getconf _POSIX_V7_LP64_OFF64

                 does not write ""--11\\nn"" or ""uunnddeeffiinneedd\\nn"" to standard output,
                 then commands of the form:


                     getconf -v POSIX_V7_LP64_OFF64 ...

                 determine values for configuration variables corresponding to
                 the POSIX_V7_LP64_OFF64 compilation environment specified in
                 _c_9_9, the EXTENDED DESCRIPTION.

                 If the command:


                     getconf _POSIX_V7_LPBIG_OFFBIG

                 does not write ""--11\\nn"" or ""uunnddeeffiinneedd\\nn"" to standard output,
                 then commands of the form:


                     getconf -v POSIX_V7_LPBIG_OFFBIG ...

                 determine values for configuration variables corresponding to
                 the POSIX_V7_LPBIG_OFFBIG compilation environment specified
                 in _c_9_9, the EXTENDED DESCRIPTION.

OOPPEERRAANNDDSS
       The following operands shall be supported:

       _p_a_t_h___v_a_r  A name of a configuration variable. All of the variables in
                 the Variable column of the table in the DESCRIPTION of the
                 _f_p_a_t_h_c_o_n_f() function defined in the System Interfaces volume
                 of POSIX.1-2017, without the enclosing braces, shall be
                 supported. The implementation may add other local variables.

       _p_a_t_h_n_a_m_e  A pathname for which the variable specified by _p_a_t_h___v_a_r is to
                 be determined.

       _s_y_s_t_e_m___v_a_r
                 A name of a configuration variable. All of the following
                 variables shall be supported:

                  *  The names in the Variable column of the table in the
                     DESCRIPTION of the _s_y_s_c_o_n_f() function in the System
                     Interfaces volume of POSIX.1-2017, except for the entries
                     corresponding to _SC_CLK_TCK, _SC_GETGR_R_SIZE_MAX, and
                     _SC_GETPW_R_SIZE_MAX, without the enclosing braces.

                     For compatibility with earlier versions, the following
                     variable names shall also be supported: POSIX2_C_BIND
                     POSIX2_C_DEV POSIX2_CHAR_TERM POSIX2_FORT_DEV
                     POSIX2_FORT_RUN POSIX2_LOCALEDEF POSIX2_SW_DEV POSIX2_UPE
                     POSIX2_VERSION

                     and shall be equivalent to the same name prefixed with an
                     <underscore>.  This requirement may be removed in a
                     future version.

                  *  The names of the symbolic constants used as the _n_a_m_e
                     argument of the _c_o_n_f_s_t_r() function in the System
                     Interfaces volume of POSIX.1-2017, without the _CS_
                     prefix.

                  *  The names of the symbolic constants listed under the
                     headings ``Maximum Values'' and ``Minimum Values'' in the
                     description of the _<_l_i_m_i_t_s_._h_> header in the Base
                     Definitions volume of POSIX.1-2017, without the enclosing
                     braces.

                     For compatibility with earlier versions, the following
                     variable names shall also be supported:
                     POSIX2_BC_BASE_MAX POSIX2_BC_DIM_MAX POSIX2_BC_SCALE_MAX
                     POSIX2_BC_STRING_MAX POSIX2_COLL_WEIGHTS_MAX
                     POSIX2_EXPR_NEST_MAX POSIX2_LINE_MAX POSIX2_RE_DUP_MAX

                     and shall be equivalent to the same name prefixed with an
                     <underscore>.  This requirement may be removed in a
                     future version.

                 The implementation may add other local values.

SSTTDDIINN
       Not used.

IINNPPUUTT FFIILLEESS
       None.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of
       _g_e_t_c_o_n_f:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments).

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       If the specified variable is defined on the system and its value is
       described to be available from the _c_o_n_f_s_t_r() function defined in the
       System Interfaces volume of POSIX.1-2017, its value shall be written in
       the following format:


           "%s\n", <_v_a_l_u_e>

       Otherwise, if the specified variable is defined on the system, its
       value shall be written in the following format:


           "%d\n", <_v_a_l_u_e>

       If the specified variable is valid, but is undefined on the system,
       _g_e_t_c_o_n_f shall write using the following format:


           "undefined\n"

       If the variable name is invalid or an error occurs, nothing shall be
       written to standard output.

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    The specified variable is valid and information about its current
             state was written successfully.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

EEXXAAMMPPLLEESS
       The following example illustrates the value of {NGROUPS_MAX}:


           getconf NGROUPS_MAX

       The following example illustrates the value of {NAME_MAX} for a
       specific directory:


           getconf NAME_MAX /usr

       The following 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 indeterminate.
               else
                   echo PATH_MAX in /usr is $value.
               fi
           else
               echo Error in getconf.
           fi

RRAATTIIOONNAALLEE
       The original need for this utility, and for the _c_o_n_f_s_t_r() function, was
       to provide a way of finding the configuration-defined default value for
       the _P_A_T_H environment variable. Since _P_A_T_H can be modified by the user
       to include directories that could contain utilities replacing the
       standard utilities, shell scripts need a way to determine the system-
       supplied _P_A_T_H environment variable value that contains the correct
       search path for the standard utilities. It was later suggested that
       access to the other variables described in this volume of POSIX.1-2017
       could also be useful to applications.

       This functionality of _g_e_t_c_o_n_f would not be adequately subsumed by
       another command such as:


           grep _v_a_r /etc/conf

       because such a strategy would provide correct values for neither those
       variables that can vary at runtime, nor those that can vary depending
       on the path.

       Early proposal versions of _g_e_t_c_o_n_f specified exit status 1 when the
       specified variable was valid, but not defined on the system. The output
       string ""uunnddeeffiinneedd"" is now used to specify this case with exit code 0
       because so many things depend on an exit code of zero when an invoked
       utility is successful.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _c_9_9

       The Base Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s, <<lliimmiittss..hh>>

       The System Interfaces volume of POSIX.1-2017, _c_o_n_f_s_t_r(), _f_p_a_t_h_c_o_n_f(),
       _s_y_s_c_o_n_f(), _s_y_s_t_e_m()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                           GETCONF(1)
