xref: /dragonfly/usr.bin/getconf/getconf.1 (revision 6e5c5008)
1.\"
2.\" Copyright 2000 Massachusetts Institute of Technology
3.\"
4.\" Permission to use, copy, modify, and distribute this software and
5.\" its documentation for any purpose and without fee is hereby
6.\" granted, provided that both the above copyright notice and this
7.\" permission notice appear in all copies, that both the above
8.\" copyright notice and this permission notice appear in all
9.\" supporting documentation, and that the name of M.I.T. not be used
10.\" in advertising or publicity pertaining to distribution of the
11.\" software without specific, written prior permission.  M.I.T. makes
12.\" no representations about the suitability of this software for any
13.\" purpose.  It is provided "as is" without express or implied
14.\" warranty.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\" $FreeBSD: head/usr.bin/getconf/getconf.1 267773 2014-06-23 08:23:05Z bapt $
30.\"
31.Dd October 18, 2015
32.Dt GETCONF 1
33.Os
34.Sh NAME
35.Nm getconf
36.Nd retrieve standard configuration variables
37.Sh SYNOPSIS
38.Nm
39.Op Fl v Ar environment
40.Ar path_var
41.Ar file
42.Nm
43.Op Fl v Ar environment
44.Ar system_var
45.Sh DESCRIPTION
46The
47.Nm
48utility prints the value of a
49.Tn POSIX
50or
51.Tn X/Open
52path or system configuration variable to the standard output.
53If the specified variable is undefined, the string
54.Dq Li undefined
55is output.
56.Pp
57The first form of the command, with two mandatory
58arguments, retrieves file- and file system-specific
59configuration variables using
60.Xr pathconf 2 .
61The second form, with a single argument, retrieves system
62configuration variables using
63.Xr confstr 3
64and
65.Xr sysconf 3 ,
66depending on the type of variable.
67As an extension, the second form can also be used to query static limits from
68.In limits.h .
69.Pp
70All
71.Xr sysconf 3
72and
73.Xr pathconf 2
74variables use the same name as the manifest constants defined in
75the relevant standard C-language bindings, including any leading
76underscore or prefix.
77That is to say,
78.Ar system_var
79might be
80.Dv ARG_MAX
81or
82.Dv _POSIX_VERSION ,
83as opposed to the
84.Xr sysconf 3
85names
86.Dv _SC_ARG_MAX
87or
88.Dv _SC_VERSION .
89Variables retrieved from
90.Xr confstr 3
91have the leading
92.Ql _CS_
93stripped off; thus,
94.Dv _CS_PATH
95is queried by a
96.Ar system_var
97of
98.Dq Li PATH .
99.Ss Programming Environments
100The
101.Fl v Ar environment
102option specifies a
103.St -p1003.1-2001
104programming environment under which the values are to be queried.
105This option currently does nothing, but may in the future be used
106to select between 32-bit and 64-bit execution environments on platforms
107which support both.
108Specifying an environment which is not supported on the current execution
109platform gives undefined results.
110.Pp
111The standard programming environments are as follows:
112.Bl -tag -width ".Li POSIX_V7_LPBIG_OFFBIG" -offset indent
113.It Li POSIX_V7_ILP32_OFF32
114Exactly 32-bit integer, long, pointer, and file offset.
115.Sy Supported platforms :
116None.
117.It Li POSIX_V7_ILP32_OFFBIG
118Exactly 32-bit integer, long, and pointer; at least 64-bit file offset.
119.Sy Supported platforms :
120None.
121.It Li POSIX_V7_LP64_OFF64
122Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
123.Sy Supported platforms :
124.Tn x86_64 .
125.It Li POSIX_V7_LPBIG_OFFBIG
126At least 32-bit integer; at least 64-bit long, pointer, and file offset.
127.Sy Supported platforms :
128None.
129.El
130.Pp
131The command:
132.Pp
133.Dl "getconf POSIX_V7_WIDTH_RESTRICTED_ENVS"
134.Pp
135returns a newline-separated list of environments in which the width
136of certain fundamental types is no greater than the width of the native
137C type
138.Vt long .
139At present, all programming environments supported by
140.Dx
141have this property.
142Several of the
143.Xr confstr 3
144variables provide information on the necessary compiler and linker flags
145to use the standard programming environments described above.
146.Sh EXIT STATUS
147.Ex -std
148.Sh EXAMPLES
149The command:
150.Pp
151.Dl "getconf PATH"
152.Pp
153will display the system default setting for the
154.Ev PATH
155environment variable.
156.Pp
157The command:
158.Pp
159.Dl "getconf NAME_MAX /tmp"
160.Pp
161will display the maximum length of a filename in the
162.Pa /tmp
163directory.
164.Pp
165The command:
166.Pp
167.Dl "getconf -v _POSIX_V7_LPBIG_OFFBIG LONG_MAX"
168.Pp
169will display the maximum value of the C type
170.Vt long
171in the
172.Li POSIX_V7_LPBIG_OFFBIG
173programming environment,
174if the system supports that environment.
175.Sh DIAGNOSTICS
176Use of a
177.Ar system_var
178or
179.Ar path_var
180which is completely unrecognized is considered an error,
181causing a diagnostic message to be written to standard error.
182One
183which is known but merely undefined does not result in an error
184indication.
185The
186.Nm
187utility recognizes all of the variables defined for
188.St -p1003.1-2001 ,
189including those which are not currently implemented.
190.Sh SEE ALSO
191.Xr pathconf 2 ,
192.Xr confstr 3 ,
193.Xr sysconf 3
194.Sh STANDARDS
195The
196.Nm
197utility is expected to be compliant with
198.St -p1003.1-2001 .
199.Sh HISTORY
200The
201.Nm
202utility first appeared in
203.Fx 5.0 .
204.Sh AUTHORS
205.An Garrett A. Wollman Aq Mt wollman@lcs.mit.edu
206