xref: /freebsd/usr.bin/getconf/getconf.1 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
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.\"
29*dda1cfcfSJohn Baldwin.Dd September 15, 2017
308c6bd995SGarrett Wollman.Dt GETCONF 1
318c6bd995SGarrett Wollman.Os
328c6bd995SGarrett Wollman.Sh NAME
338c6bd995SGarrett Wollman.Nm getconf
348c6bd995SGarrett Wollman.Nd retrieve standard configuration variables
358c6bd995SGarrett Wollman.Sh SYNOPSIS
368fe908efSRuslan Ermilov.Nm
37*dda1cfcfSJohn Baldwin.Fl a
38*dda1cfcfSJohn Baldwin.Op Ar file
39*dda1cfcfSJohn Baldwin.Nm
408c6bd995SGarrett Wollman.Op Fl v Ar environment
418c6bd995SGarrett Wollman.Ar path_var
428c6bd995SGarrett Wollman.Ar file
438fe908efSRuslan Ermilov.Nm
448c6bd995SGarrett Wollman.Op Fl v Ar environment
458c6bd995SGarrett Wollman.Ar system_var
468c6bd995SGarrett Wollman.Sh DESCRIPTION
478c6bd995SGarrett WollmanThe
488fe908efSRuslan Ermilov.Nm
49*dda1cfcfSJohn Baldwinutility prints the values of
508c6bd995SGarrett Wollman.Tn POSIX
518c6bd995SGarrett Wollmanor
528c6bd995SGarrett Wollman.Tn X/Open
53*dda1cfcfSJohn Baldwinpath or system configuration variables to the standard output.
54*dda1cfcfSJohn BaldwinIf a variable is undefined, the string
558c6bd995SGarrett Wollman.Dq Li undefined
568c6bd995SGarrett Wollmanis output.
578c6bd995SGarrett Wollman.Pp
58*dda1cfcfSJohn BaldwinThe first form of the command displays all of the path or system configuration
59*dda1cfcfSJohn Baldwinvariables to standard output.
60*dda1cfcfSJohn BaldwinIf
61*dda1cfcfSJohn Baldwin.Ar file
62*dda1cfcfSJohn Baldwinis provided,
63*dda1cfcfSJohn Baldwinall path configuration variables are reported for
64*dda1cfcfSJohn Baldwin.Ar file
65*dda1cfcfSJohn Baldwinusing
66*dda1cfcfSJohn Baldwin.Xr pathconf 2 .
67*dda1cfcfSJohn BaldwinOtherwise,
68*dda1cfcfSJohn Baldwinall system configuration variables are reported using
69*dda1cfcfSJohn Baldwin.Xr confstr 3
70*dda1cfcfSJohn Baldwinand
71*dda1cfcfSJohn Baldwin.Xr sysconf 3 .
72*dda1cfcfSJohn Baldwin.Pp
73*dda1cfcfSJohn BaldwinThe second form of the command, with two mandatory
748c6bd995SGarrett Wollmanarguments, retrieves file- and file system-specific
758c6bd995SGarrett Wollmanconfiguration variables using
768c6bd995SGarrett Wollman.Xr pathconf 2 .
77*dda1cfcfSJohn BaldwinThe third form, with a single argument, retrieves system
788c6bd995SGarrett Wollmanconfiguration variables using
798c6bd995SGarrett Wollman.Xr confstr 3
808c6bd995SGarrett Wollmanand
818c6bd995SGarrett Wollman.Xr sysconf 3 ,
828c6bd995SGarrett Wollmandepending on the type of variable.
83e9cfb9aeSGarrett WollmanAs an extension, the second form can also be used to query static limits from
84fe08efe6SRuslan Ermilov.In limits.h .
858c6bd995SGarrett Wollman.Pp
86e9cfb9aeSGarrett WollmanAll
87e9cfb9aeSGarrett Wollman.Xr sysconf 3
88e9cfb9aeSGarrett Wollmanand
89e9cfb9aeSGarrett Wollman.Xr pathconf 2
90e9cfb9aeSGarrett Wollmanvariables use the same name as the manifest constants defined in
918c6bd995SGarrett Wollmanthe relevant standard C-language bindings, including any leading
928c6bd995SGarrett Wollmanunderscore or prefix.
938c6bd995SGarrett WollmanThat is to say,
948c6bd995SGarrett Wollman.Ar system_var
958c6bd995SGarrett Wollmanmight be
968c6bd995SGarrett Wollman.Dv ARG_MAX
978c6bd995SGarrett Wollmanor
988c6bd995SGarrett Wollman.Dv _POSIX_VERSION ,
998c6bd995SGarrett Wollmanas opposed to the
1008c6bd995SGarrett Wollman.Xr sysconf 3
1018c6bd995SGarrett Wollmannames
1028c6bd995SGarrett Wollman.Dv _SC_ARG_MAX
1038c6bd995SGarrett Wollmanor
1048c6bd995SGarrett Wollman.Dv _SC_POSIX_VERSION .
105e9cfb9aeSGarrett WollmanVariables retrieved from
106e9cfb9aeSGarrett Wollman.Xr confstr 3
107e9cfb9aeSGarrett Wollmanhave the leading
108e9cfb9aeSGarrett Wollman.Ql _CS_
109e9cfb9aeSGarrett Wollmanstripped off; thus,
110e9cfb9aeSGarrett Wollman.Dv _CS_PATH
111e9cfb9aeSGarrett Wollmanis queried by a
1128c6bd995SGarrett Wollman.Ar system_var
1138c6bd995SGarrett Wollmanof
114e9cfb9aeSGarrett Wollman.Dq Li PATH .
115e9cfb9aeSGarrett Wollman.Ss Programming Environments
1168c6bd995SGarrett WollmanThe
1178c6bd995SGarrett Wollman.Fl v Ar environment
118e9cfb9aeSGarrett Wollmanoption specifies a
119e9cfb9aeSGarrett Wollman.St -p1003.1-2001
120e9cfb9aeSGarrett Wollmanprogramming environment under which the values are to be queried.
121e9cfb9aeSGarrett WollmanThis option currently does nothing, but may in the future be used
122e9cfb9aeSGarrett Wollmanto select between 32-bit and 64-bit execution environments on platforms
123e9cfb9aeSGarrett Wollmanwhich support both.
124e9cfb9aeSGarrett WollmanSpecifying an environment which is not supported on the current execution
125e9cfb9aeSGarrett Wollmanplatform gives undefined results.
126e9cfb9aeSGarrett Wollman.Pp
127e9cfb9aeSGarrett WollmanThe standard programming environments are as follows:
128e9cfb9aeSGarrett Wollman.Bl -tag -width ".Li POSIX_V6_LPBIG_OFFBIG" -offset indent
129e9cfb9aeSGarrett Wollman.It Li POSIX_V6_ILP32_OFF32
130e9cfb9aeSGarrett WollmanExactly 32-bit integer, long, pointer, and file offset.
131e9cfb9aeSGarrett Wollman.Sy Supported platforms :
132e9cfb9aeSGarrett WollmanNone.
133e9cfb9aeSGarrett Wollman.It Li POSIX_V6_ILP32_OFFBIG
134e9cfb9aeSGarrett WollmanExactly 32-bit integer, long, and pointer; at least 64-bit file offset.
135e9cfb9aeSGarrett Wollman.Sy Supported platforms :
136e9cfb9aeSGarrett Wollman.Tn IA32 ,
137e9cfb9aeSGarrett Wollman.Tn PowerPC .
138e9cfb9aeSGarrett Wollman.It Li POSIX_V6_LP64_OFF64
139e9cfb9aeSGarrett WollmanExactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
140e9cfb9aeSGarrett Wollman.Sy Supported platforms :
141bfa4e93dSEnji Cooper.Tn AMD64 ,
142e9cfb9aeSGarrett Wollman.Tn SPARC64 .
143e9cfb9aeSGarrett Wollman.It Li POSIX_V6_LPBIG_OFFBIG
144e9cfb9aeSGarrett WollmanAt least 32-bit integer; at least 64-bit long, pointer, and file offset.
145e9cfb9aeSGarrett Wollman.Sy Supported platforms :
146e9cfb9aeSGarrett WollmanNone.
147e9cfb9aeSGarrett Wollman.El
148e9cfb9aeSGarrett Wollman.Pp
149e9cfb9aeSGarrett WollmanThe command:
1505bd97a95SRuslan Ermilov.Pp
1515bd97a95SRuslan Ermilov.Dl "getconf POSIX_V6_WIDTH_RESTRICTED_ENVS"
152e9cfb9aeSGarrett Wollman.Pp
153e9cfb9aeSGarrett Wollmanreturns a newline-separated list of environments in which the width
154e9cfb9aeSGarrett Wollmanof certain fundamental types is no greater than the width of the native
155e9cfb9aeSGarrett WollmanC type
1565bd97a95SRuslan Ermilov.Vt long .
157e9cfb9aeSGarrett WollmanAt present, all programming environments supported by
158e9cfb9aeSGarrett Wollman.Fx
159e9cfb9aeSGarrett Wollmanhave this property.
160e9cfb9aeSGarrett WollmanSeveral of the
161e9cfb9aeSGarrett Wollman.Xr confstr 3
162e9cfb9aeSGarrett Wollmanvariables provide information on the necessary compiler and linker flags
163e9cfb9aeSGarrett Wollmanto use the standard programming environments described above.
164a866e170SRuslan Ermilov.Sh EXIT STATUS
165d628d776SRuslan Ermilov.Ex -std
1668c6bd995SGarrett Wollman.Sh EXAMPLES
1678c6bd995SGarrett WollmanThe command:
1685bd97a95SRuslan Ermilov.Pp
1695bd97a95SRuslan Ermilov.Dl "getconf PATH"
1708c6bd995SGarrett Wollman.Pp
1718c6bd995SGarrett Wollmanwill display the system default setting for the
1728c6bd995SGarrett Wollman.Ev PATH
1738c6bd995SGarrett Wollmanenvironment variable.
1748c6bd995SGarrett Wollman.Pp
1758c6bd995SGarrett WollmanThe command:
1765bd97a95SRuslan Ermilov.Pp
1775bd97a95SRuslan Ermilov.Dl "getconf NAME_MAX /tmp"
1788c6bd995SGarrett Wollman.Pp
1798c6bd995SGarrett Wollmanwill display the maximum length of a filename in the
1808c6bd995SGarrett Wollman.Pa /tmp
1818c6bd995SGarrett Wollmandirectory.
182e9cfb9aeSGarrett Wollman.Pp
183e9cfb9aeSGarrett WollmanThe command:
1845bd97a95SRuslan Ermilov.Pp
1855bd97a95SRuslan Ermilov.Dl "getconf -v POSIX_V6_LPBIG_OFFBIG LONG_MAX"
186e9cfb9aeSGarrett Wollman.Pp
187e9cfb9aeSGarrett Wollmanwill display the maximum value of the C type
1885bd97a95SRuslan Ermilov.Vt long
189e9cfb9aeSGarrett Wollmanin the
190e9cfb9aeSGarrett Wollman.Li POSIX_V6_LPBIG_OFFBIG
191e9cfb9aeSGarrett Wollmanprogramming environment,
192e9cfb9aeSGarrett Wollmanif the system supports that environment.
1936c7216dfSRuslan Ermilov.Sh DIAGNOSTICS
1946c7216dfSRuslan ErmilovUse of a
1956c7216dfSRuslan Ermilov.Ar system_var
1966c7216dfSRuslan Ermilovor
1976c7216dfSRuslan Ermilov.Ar path_var
1986c7216dfSRuslan Ermilovwhich is completely unrecognized is considered an error,
1996c7216dfSRuslan Ermilovcausing a diagnostic message to be written to standard error.
2006c7216dfSRuslan ErmilovOne
2016c7216dfSRuslan Ermilovwhich is known but merely undefined does not result in an error
2026c7216dfSRuslan Ermilovindication.
2036c7216dfSRuslan ErmilovThe
2046c7216dfSRuslan Ermilov.Nm
2056c7216dfSRuslan Ermilovutility recognizes all of the variables defined for
2066c7216dfSRuslan Ermilov.St -p1003.1-2001 ,
2076c7216dfSRuslan Ermilovincluding those which are not currently implemented.
2088c6bd995SGarrett Wollman.Sh SEE ALSO
2098c6bd995SGarrett Wollman.Xr pathconf 2 ,
2105521ff5aSRuslan Ermilov.Xr confstr 3 ,
2118c6bd995SGarrett Wollman.Xr sysconf 3
2128c6bd995SGarrett Wollman.Sh STANDARDS
2138c6bd995SGarrett WollmanThe
2148fe908efSRuslan Ermilov.Nm
2158c6bd995SGarrett Wollmanutility is expected to be compliant with
216e9cfb9aeSGarrett Wollman.St -p1003.1-2001 .
2178c6bd995SGarrett Wollman.Sh HISTORY
2188c6bd995SGarrett WollmanThe
2198fe908efSRuslan Ermilov.Nm
2205bd97a95SRuslan Ermilovutility first appeared in
2218c6bd995SGarrett Wollman.Fx 5.0 .
222251c176fSRuslan Ermilov.Sh AUTHORS
2232b7af31cSBaptiste Daroussin.An Garrett A. Wollman Aq Mt wollman@lcs.mit.edu
224