xref: /freebsd/usr.bin/getconf/getconf.1 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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.Dd September 15, 2017
30.Dt GETCONF 1
31.Os
32.Sh NAME
33.Nm getconf
34.Nd retrieve standard configuration variables
35.Sh SYNOPSIS
36.Nm
37.Fl a
38.Op Ar file
39.Nm
40.Op Fl v Ar environment
41.Ar path_var
42.Ar file
43.Nm
44.Op Fl v Ar environment
45.Ar system_var
46.Sh DESCRIPTION
47The
48.Nm
49utility prints the values of
50.Tn POSIX
51or
52.Tn X/Open
53path or system configuration variables to the standard output.
54If a variable is undefined, the string
55.Dq Li undefined
56is output.
57.Pp
58The first form of the command displays all of the path or system configuration
59variables to standard output.
60If
61.Ar file
62is provided,
63all path configuration variables are reported for
64.Ar file
65using
66.Xr pathconf 2 .
67Otherwise,
68all system configuration variables are reported using
69.Xr confstr 3
70and
71.Xr sysconf 3 .
72.Pp
73The second form of the command, with two mandatory
74arguments, retrieves file- and file system-specific
75configuration variables using
76.Xr pathconf 2 .
77The third form, with a single argument, retrieves system
78configuration variables using
79.Xr confstr 3
80and
81.Xr sysconf 3 ,
82depending on the type of variable.
83As an extension, the second form can also be used to query static limits from
84.In limits.h .
85.Pp
86All
87.Xr sysconf 3
88and
89.Xr pathconf 2
90variables use the same name as the manifest constants defined in
91the relevant standard C-language bindings, including any leading
92underscore or prefix.
93That is to say,
94.Ar system_var
95might be
96.Dv ARG_MAX
97or
98.Dv _POSIX_VERSION ,
99as opposed to the
100.Xr sysconf 3
101names
102.Dv _SC_ARG_MAX
103or
104.Dv _SC_POSIX_VERSION .
105Variables retrieved from
106.Xr confstr 3
107have the leading
108.Ql _CS_
109stripped off; thus,
110.Dv _CS_PATH
111is queried by a
112.Ar system_var
113of
114.Dq Li PATH .
115.Ss Programming Environments
116The
117.Fl v Ar environment
118option specifies a
119.St -p1003.1-2001
120programming environment under which the values are to be queried.
121This option currently does nothing, but may in the future be used
122to select between 32-bit and 64-bit execution environments on platforms
123which support both.
124Specifying an environment which is not supported on the current execution
125platform gives undefined results.
126.Pp
127The standard programming environments are as follows:
128.Bl -tag -width ".Li POSIX_V6_LPBIG_OFFBIG" -offset indent
129.It Li POSIX_V6_ILP32_OFF32
130Exactly 32-bit integer, long, pointer, and file offset.
131.Sy Supported platforms :
132None.
133.It Li POSIX_V6_ILP32_OFFBIG
134Exactly 32-bit integer, long, and pointer; at least 64-bit file offset.
135.Sy Supported platforms :
136.Tn IA32 ,
137.Tn PowerPC .
138.It Li POSIX_V6_LP64_OFF64
139Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset.
140.Sy Supported platforms :
141.Tn AMD64 ,
142.Tn SPARC64 .
143.It Li POSIX_V6_LPBIG_OFFBIG
144At least 32-bit integer; at least 64-bit long, pointer, and file offset.
145.Sy Supported platforms :
146None.
147.El
148.Pp
149The command:
150.Pp
151.Dl "getconf POSIX_V6_WIDTH_RESTRICTED_ENVS"
152.Pp
153returns a newline-separated list of environments in which the width
154of certain fundamental types is no greater than the width of the native
155C type
156.Vt long .
157At present, all programming environments supported by
158.Fx
159have this property.
160Several of the
161.Xr confstr 3
162variables provide information on the necessary compiler and linker flags
163to use the standard programming environments described above.
164.Sh EXIT STATUS
165.Ex -std
166.Sh EXAMPLES
167The command:
168.Pp
169.Dl "getconf PATH"
170.Pp
171will display the system default setting for the
172.Ev PATH
173environment variable.
174.Pp
175The command:
176.Pp
177.Dl "getconf NAME_MAX /tmp"
178.Pp
179will display the maximum length of a filename in the
180.Pa /tmp
181directory.
182.Pp
183The command:
184.Pp
185.Dl "getconf -v POSIX_V6_LPBIG_OFFBIG LONG_MAX"
186.Pp
187will display the maximum value of the C type
188.Vt long
189in the
190.Li POSIX_V6_LPBIG_OFFBIG
191programming environment,
192if the system supports that environment.
193.Sh DIAGNOSTICS
194Use of a
195.Ar system_var
196or
197.Ar path_var
198which is completely unrecognized is considered an error,
199causing a diagnostic message to be written to standard error.
200One
201which is known but merely undefined does not result in an error
202indication.
203The
204.Nm
205utility recognizes all of the variables defined for
206.St -p1003.1-2001 ,
207including those which are not currently implemented.
208.Sh SEE ALSO
209.Xr pathconf 2 ,
210.Xr confstr 3 ,
211.Xr sysconf 3
212.Sh STANDARDS
213The
214.Nm
215utility is expected to be compliant with
216.St -p1003.1-2001 .
217.Sh HISTORY
218The
219.Nm
220utility first appeared in
221.Fx 5.0 .
222.Sh AUTHORS
223.An Garrett A. Wollman Aq Mt wollman@lcs.mit.edu
224