xref: /freebsd/usr.bin/getconf/getconf.1 (revision bfa4e93d35adf0cba3ca58966bb098ed6bbd4a5e)
18c6bd995SGarrett Wollman.\"
28c6bd995SGarrett Wollman.\" Copyright 2000 Massachusetts Institute of Technology
38c6bd995SGarrett Wollman.\"
48c6bd995SGarrett Wollman.\" Permission to use, copy, modify, and distribute this software and
58c6bd995SGarrett Wollman.\" its documentation for any purpose and without fee is hereby
68c6bd995SGarrett Wollman.\" granted, provided that both the above copyright notice and this
78c6bd995SGarrett Wollman.\" permission notice appear in all copies, that both the above
88c6bd995SGarrett Wollman.\" copyright notice and this permission notice appear in all
98c6bd995SGarrett Wollman.\" supporting documentation, and that the name of M.I.T. not be used
108c6bd995SGarrett Wollman.\" in advertising or publicity pertaining to distribution of the
118c6bd995SGarrett Wollman.\" software without specific, written prior permission.  M.I.T. makes
128c6bd995SGarrett Wollman.\" no representations about the suitability of this software for any
138c6bd995SGarrett Wollman.\" purpose.  It is provided "as is" without express or implied
148c6bd995SGarrett Wollman.\" warranty.
158c6bd995SGarrett Wollman.\"
168c6bd995SGarrett Wollman.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
178c6bd995SGarrett Wollman.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
188c6bd995SGarrett Wollman.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
198c6bd995SGarrett Wollman.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
208c6bd995SGarrett Wollman.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
218c6bd995SGarrett Wollman.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
228c6bd995SGarrett Wollman.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
238c6bd995SGarrett Wollman.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
248c6bd995SGarrett Wollman.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
258c6bd995SGarrett Wollman.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
268c6bd995SGarrett Wollman.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
278c6bd995SGarrett Wollman.\" SUCH DAMAGE.
288c6bd995SGarrett Wollman.\"
298c6bd995SGarrett Wollman.\" $FreeBSD$
308c6bd995SGarrett Wollman.\"
31*bfa4e93dSEnji Cooper.Dd August 8, 2016
328c6bd995SGarrett Wollman.Dt GETCONF 1
338c6bd995SGarrett Wollman.Os
348c6bd995SGarrett Wollman.Sh NAME
358c6bd995SGarrett Wollman.Nm getconf
368c6bd995SGarrett Wollman.Nd retrieve standard configuration variables
378c6bd995SGarrett Wollman.Sh SYNOPSIS
388fe908efSRuslan Ermilov.Nm
398c6bd995SGarrett Wollman.Op Fl v Ar environment
408c6bd995SGarrett Wollman.Ar path_var
418c6bd995SGarrett Wollman.Ar file
428fe908efSRuslan Ermilov.Nm
438c6bd995SGarrett Wollman.Op Fl v Ar environment
448c6bd995SGarrett Wollman.Ar system_var
458c6bd995SGarrett Wollman.Sh DESCRIPTION
468c6bd995SGarrett WollmanThe
478fe908efSRuslan Ermilov.Nm
4804662725SGarrett Wollmanutility prints the value of a
498c6bd995SGarrett Wollman.Tn POSIX
508c6bd995SGarrett Wollmanor
518c6bd995SGarrett Wollman.Tn X/Open
52d75f6037SGarrett Wollmanpath or system configuration variable to the standard output.
538c6bd995SGarrett WollmanIf the specified variable is undefined, the string
548c6bd995SGarrett Wollman.Dq Li undefined
558c6bd995SGarrett Wollmanis output.
568c6bd995SGarrett Wollman.Pp
578c6bd995SGarrett WollmanThe first form of the command, with two mandatory
588c6bd995SGarrett Wollmanarguments, retrieves file- and file system-specific
598c6bd995SGarrett Wollmanconfiguration variables using
608c6bd995SGarrett Wollman.Xr pathconf 2 .
618c6bd995SGarrett WollmanThe second form, with a single argument, retrieves system
628c6bd995SGarrett Wollmanconfiguration variables using
638c6bd995SGarrett Wollman.Xr confstr 3
648c6bd995SGarrett Wollmanand
658c6bd995SGarrett Wollman.Xr sysconf 3 ,
668c6bd995SGarrett Wollmandepending on the type of variable.
67e9cfb9aeSGarrett WollmanAs an extension, the second form can also be used to query static limits from
68fe08efe6SRuslan Ermilov.In limits.h .
698c6bd995SGarrett Wollman.Pp
70e9cfb9aeSGarrett WollmanAll
71e9cfb9aeSGarrett Wollman.Xr sysconf 3
72e9cfb9aeSGarrett Wollmanand
73e9cfb9aeSGarrett Wollman.Xr pathconf 2
74e9cfb9aeSGarrett Wollmanvariables use the same name as the manifest constants defined in
758c6bd995SGarrett Wollmanthe relevant standard C-language bindings, including any leading
768c6bd995SGarrett Wollmanunderscore or prefix.
778c6bd995SGarrett WollmanThat is to say,
788c6bd995SGarrett Wollman.Ar system_var
798c6bd995SGarrett Wollmanmight be
808c6bd995SGarrett Wollman.Dv ARG_MAX
818c6bd995SGarrett Wollmanor
828c6bd995SGarrett Wollman.Dv _POSIX_VERSION ,
838c6bd995SGarrett Wollmanas opposed to the
848c6bd995SGarrett Wollman.Xr sysconf 3
858c6bd995SGarrett Wollmannames
868c6bd995SGarrett Wollman.Dv _SC_ARG_MAX
878c6bd995SGarrett Wollmanor
888c6bd995SGarrett Wollman.Dv _SC_POSIX_VERSION .
89e9cfb9aeSGarrett WollmanVariables retrieved from
90e9cfb9aeSGarrett Wollman.Xr confstr 3
91e9cfb9aeSGarrett Wollmanhave the leading
92e9cfb9aeSGarrett Wollman.Ql _CS_
93e9cfb9aeSGarrett Wollmanstripped off; thus,
94e9cfb9aeSGarrett Wollman.Dv _CS_PATH
95e9cfb9aeSGarrett Wollmanis queried by a
968c6bd995SGarrett Wollman.Ar system_var
978c6bd995SGarrett Wollmanof
98e9cfb9aeSGarrett Wollman.Dq Li PATH .
99e9cfb9aeSGarrett Wollman.Ss Programming Environments
1008c6bd995SGarrett WollmanThe
1018c6bd995SGarrett Wollman.Fl v Ar environment
102e9cfb9aeSGarrett Wollmanoption specifies a
103e9cfb9aeSGarrett Wollman.St -p1003.1-2001
104e9cfb9aeSGarrett Wollmanprogramming environment under which the values are to be queried.
105e9cfb9aeSGarrett WollmanThis option currently does nothing, but may in the future be used
106e9cfb9aeSGarrett Wollmanto select between 32-bit and 64-bit execution environments on platforms
107e9cfb9aeSGarrett Wollmanwhich support both.
108e9cfb9aeSGarrett WollmanSpecifying an environment which is not supported on the current execution
109e9cfb9aeSGarrett Wollmanplatform gives undefined results.
110e9cfb9aeSGarrett Wollman.Pp
111e9cfb9aeSGarrett WollmanThe standard programming environments are as follows:
112e9cfb9aeSGarrett Wollman.Bl -tag -width ".Li POSIX_V6_LPBIG_OFFBIG" -offset indent
113e9cfb9aeSGarrett Wollman.It Li POSIX_V6_ILP32_OFF32
114e9cfb9aeSGarrett WollmanExactly 32-bit integer, long, pointer, and file offset.
115e9cfb9aeSGarrett Wollman.Sy Supported platforms :
116e9cfb9aeSGarrett WollmanNone.
117e9cfb9aeSGarrett Wollman.It Li POSIX_V6_ILP32_OFFBIG
118e9cfb9aeSGarrett WollmanExactly 32-bit integer, long, and pointer; at least 64-bit file offset.
119e9cfb9aeSGarrett Wollman.Sy Supported platforms :
120e9cfb9aeSGarrett Wollman.Tn IA32 ,
121e9cfb9aeSGarrett Wollman.Tn PowerPC .
122e9cfb9aeSGarrett Wollman.It Li POSIX_V6_LP64_OFF64
123e9cfb9aeSGarrett WollmanExactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
124e9cfb9aeSGarrett Wollman.Sy Supported platforms :
125*bfa4e93dSEnji Cooper.Tn AMD64 ,
126e9cfb9aeSGarrett Wollman.Tn SPARC64 .
127e9cfb9aeSGarrett Wollman.It Li POSIX_V6_LPBIG_OFFBIG
128e9cfb9aeSGarrett WollmanAt least 32-bit integer; at least 64-bit long, pointer, and file offset.
129e9cfb9aeSGarrett Wollman.Sy Supported platforms :
130e9cfb9aeSGarrett WollmanNone.
131e9cfb9aeSGarrett Wollman.El
132e9cfb9aeSGarrett Wollman.Pp
133e9cfb9aeSGarrett WollmanThe command:
1345bd97a95SRuslan Ermilov.Pp
1355bd97a95SRuslan Ermilov.Dl "getconf POSIX_V6_WIDTH_RESTRICTED_ENVS"
136e9cfb9aeSGarrett Wollman.Pp
137e9cfb9aeSGarrett Wollmanreturns a newline-separated list of environments in which the width
138e9cfb9aeSGarrett Wollmanof certain fundamental types is no greater than the width of the native
139e9cfb9aeSGarrett WollmanC type
1405bd97a95SRuslan Ermilov.Vt long .
141e9cfb9aeSGarrett WollmanAt present, all programming environments supported by
142e9cfb9aeSGarrett Wollman.Fx
143e9cfb9aeSGarrett Wollmanhave this property.
144e9cfb9aeSGarrett WollmanSeveral of the
145e9cfb9aeSGarrett Wollman.Xr confstr 3
146e9cfb9aeSGarrett Wollmanvariables provide information on the necessary compiler and linker flags
147e9cfb9aeSGarrett Wollmanto use the standard programming environments described above.
148a866e170SRuslan Ermilov.Sh EXIT STATUS
149d628d776SRuslan Ermilov.Ex -std
1508c6bd995SGarrett Wollman.Sh EXAMPLES
1518c6bd995SGarrett WollmanThe command:
1525bd97a95SRuslan Ermilov.Pp
1535bd97a95SRuslan Ermilov.Dl "getconf PATH"
1548c6bd995SGarrett Wollman.Pp
1558c6bd995SGarrett Wollmanwill display the system default setting for the
1568c6bd995SGarrett Wollman.Ev PATH
1578c6bd995SGarrett Wollmanenvironment variable.
1588c6bd995SGarrett Wollman.Pp
1598c6bd995SGarrett WollmanThe command:
1605bd97a95SRuslan Ermilov.Pp
1615bd97a95SRuslan Ermilov.Dl "getconf NAME_MAX /tmp"
1628c6bd995SGarrett Wollman.Pp
1638c6bd995SGarrett Wollmanwill display the maximum length of a filename in the
1648c6bd995SGarrett Wollman.Pa /tmp
1658c6bd995SGarrett Wollmandirectory.
166e9cfb9aeSGarrett Wollman.Pp
167e9cfb9aeSGarrett WollmanThe command:
1685bd97a95SRuslan Ermilov.Pp
1695bd97a95SRuslan Ermilov.Dl "getconf -v POSIX_V6_LPBIG_OFFBIG LONG_MAX"
170e9cfb9aeSGarrett Wollman.Pp
171e9cfb9aeSGarrett Wollmanwill display the maximum value of the C type
1725bd97a95SRuslan Ermilov.Vt long
173e9cfb9aeSGarrett Wollmanin the
174e9cfb9aeSGarrett Wollman.Li POSIX_V6_LPBIG_OFFBIG
175e9cfb9aeSGarrett Wollmanprogramming environment,
176e9cfb9aeSGarrett Wollmanif the system supports that environment.
1776c7216dfSRuslan Ermilov.Sh DIAGNOSTICS
1786c7216dfSRuslan ErmilovUse of a
1796c7216dfSRuslan Ermilov.Ar system_var
1806c7216dfSRuslan Ermilovor
1816c7216dfSRuslan Ermilov.Ar path_var
1826c7216dfSRuslan Ermilovwhich is completely unrecognized is considered an error,
1836c7216dfSRuslan Ermilovcausing a diagnostic message to be written to standard error.
1846c7216dfSRuslan ErmilovOne
1856c7216dfSRuslan Ermilovwhich is known but merely undefined does not result in an error
1866c7216dfSRuslan Ermilovindication.
1876c7216dfSRuslan ErmilovThe
1886c7216dfSRuslan Ermilov.Nm
1896c7216dfSRuslan Ermilovutility recognizes all of the variables defined for
1906c7216dfSRuslan Ermilov.St -p1003.1-2001 ,
1916c7216dfSRuslan Ermilovincluding those which are not currently implemented.
1928c6bd995SGarrett Wollman.Sh SEE ALSO
1938c6bd995SGarrett Wollman.Xr pathconf 2 ,
1945521ff5aSRuslan Ermilov.Xr confstr 3 ,
1958c6bd995SGarrett Wollman.Xr sysconf 3
1968c6bd995SGarrett Wollman.Sh STANDARDS
1978c6bd995SGarrett WollmanThe
1988fe908efSRuslan Ermilov.Nm
1998c6bd995SGarrett Wollmanutility is expected to be compliant with
200e9cfb9aeSGarrett Wollman.St -p1003.1-2001 .
2018c6bd995SGarrett Wollman.Sh HISTORY
2028c6bd995SGarrett WollmanThe
2038fe908efSRuslan Ermilov.Nm
2045bd97a95SRuslan Ermilovutility first appeared in
2058c6bd995SGarrett Wollman.Fx 5.0 .
206251c176fSRuslan Ermilov.Sh AUTHORS
2072b7af31cSBaptiste Daroussin.An Garrett A. Wollman Aq Mt wollman@lcs.mit.edu
208