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