xref: /freebsd/usr.bin/getconf/getconf.1 (revision 251c176f415c9dc57b7c8c063aec4208bfc2efa6)
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.\"
318c6bd995SGarrett Wollman.Dd April 25, 2000
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
388c6bd995SGarrett Wollman.Nm getconf
398c6bd995SGarrett Wollman.Op Fl v Ar environment
408c6bd995SGarrett Wollman.Ar path_var
418c6bd995SGarrett Wollman.Ar file
428c6bd995SGarrett Wollman.Pp
438c6bd995SGarrett Wollman.Nm getconf
448c6bd995SGarrett Wollman.Op Fl v Ar environment
458c6bd995SGarrett Wollman.Ar system_var
468c6bd995SGarrett Wollman.Sh DESCRIPTION
478c6bd995SGarrett WollmanThe
488c6bd995SGarrett Wollman.Nm getconf
498c6bd995SGarrett Wollmanutility outputs the value of
508c6bd995SGarrett Wollman.Tn POSIX
518c6bd995SGarrett Wollmanor
528c6bd995SGarrett Wollman.Tn X/Open
538c6bd995SGarrett Wollmansystem or path configuration variable on the standard output.
548c6bd995SGarrett WollmanIf the specified variable is undefined, the string
558c6bd995SGarrett Wollman.Dq Li undefined
568c6bd995SGarrett Wollmanis output.
578c6bd995SGarrett Wollman.Pp
588c6bd995SGarrett WollmanThe first form of the command, with two mandatory
598c6bd995SGarrett Wollmanarguments, retrieves file- and filesystem-specific
608c6bd995SGarrett Wollmanconfiguration variables using
618c6bd995SGarrett Wollman.Xr pathconf 2 .
628c6bd995SGarrett WollmanThe second form, with a single argument, retrieves system
638c6bd995SGarrett Wollmanconfiguration variables using
648c6bd995SGarrett Wollman.Xr confstr 3
658c6bd995SGarrett Wollmanand
668c6bd995SGarrett Wollman.Xr sysconf 3 ,
678c6bd995SGarrett Wollmandepending on the type of variable.
688c6bd995SGarrett Wollman.Pp
698c6bd995SGarrett WollmanAll variables use the same name as the manifest constants defined in
708c6bd995SGarrett Wollmanthe relevant standard C-language bindings, including any leading
718c6bd995SGarrett Wollmanunderscore or prefix.
728c6bd995SGarrett WollmanThat is to say,
738c6bd995SGarrett Wollman.Ar system_var
748c6bd995SGarrett Wollmanmight be
758c6bd995SGarrett Wollman.Dv ARG_MAX
768c6bd995SGarrett Wollmanor
778c6bd995SGarrett Wollman.Dv _POSIX_VERSION ,
788c6bd995SGarrett Wollmanas opposed to the
798c6bd995SGarrett Wollman.Xr sysconf 3
808c6bd995SGarrett Wollmannames
818c6bd995SGarrett Wollman.Dv _SC_ARG_MAX
828c6bd995SGarrett Wollmanor
838c6bd995SGarrett Wollman.Dv _SC_POSIX_VERSION .
848c6bd995SGarrett Wollman(There is one exception: there is no corresponding manifest constant
858c6bd995SGarrett Wollmanto
868c6bd995SGarrett Wollman.Dv _CS_PATH ,
878c6bd995SGarrett Wollmanso a
888c6bd995SGarrett Wollman.Ar system_var
898c6bd995SGarrett Wollmanof
908c6bd995SGarrett Wollman.Dq Li PATH
918c6bd995SGarrett Wollmanis used.)
928c6bd995SGarrett Wollman.Pp
938c6bd995SGarrett WollmanThe
948c6bd995SGarrett Wollman.Fl v Ar environment
958c6bd995SGarrett Wollmanoption is not supported, but provided for compatibility purposes.
968c6bd995SGarrett Wollman.Sh DIAGNOSTICS
978c6bd995SGarrett WollmanThe
988c6bd995SGarrett Wollman.Nm getconf
998c6bd995SGarrett Wollmanutility exits 0 on success or >0 if an error occurred.
1008c6bd995SGarrett WollmanUse of a
1018c6bd995SGarrett Wollman.Ar system_var
1028c6bd995SGarrett Wollmanor
1038c6bd995SGarrett Wollman.Ar path_var
1048c6bd995SGarrett Wollmanwhich is completely unknown to the system is considered an error,
1058c6bd995SGarrett Wollmancausing a diagnostic message to be written to standard error; one
1068c6bd995SGarrett Wollmanwhich is known but merely undefined does not result in an error
1078c6bd995SGarrett Wollmanindication.
1088c6bd995SGarrett Wollman.Pp
1098c6bd995SGarrett WollmanUse of the unsupported
1108c6bd995SGarrett Wollman.Fl v Ar environment
1118c6bd995SGarrett Wollmanoption will result in a diagnostic message indicating that it is not
1128c6bd995SGarrett Wollmansupported.
1138c6bd995SGarrett Wollman.Sh EXAMPLES
1148c6bd995SGarrett WollmanThe command:
1158c6bd995SGarrett Wollman.Bd -literal -offset indent
1168c6bd995SGarrett Wollmangetconf PATH
1178c6bd995SGarrett Wollman.Ed
1188c6bd995SGarrett Wollman.Pp
1198c6bd995SGarrett Wollmanwill display the system default setting for the
1208c6bd995SGarrett Wollman.Ev PATH
1218c6bd995SGarrett Wollmanenvironment variable.
1228c6bd995SGarrett Wollman.Pp
1238c6bd995SGarrett WollmanThe command:
1248c6bd995SGarrett Wollman.Bd -literal -offset indent
1258c6bd995SGarrett Wollmangetconf NAME_MAX /tmp
1268c6bd995SGarrett Wollman.Ed
1278c6bd995SGarrett Wollman.Pp
1288c6bd995SGarrett Wollmanwill display the maximum length of a filename in the
1298c6bd995SGarrett Wollman.Pa /tmp
1308c6bd995SGarrett Wollmandirectory.
1318c6bd995SGarrett Wollman.Sh SEE ALSO
1328c6bd995SGarrett Wollman.Xr confstr 3 ,
1338c6bd995SGarrett Wollman.Xr pathconf 2 ,
1348c6bd995SGarrett Wollman.Xr sysconf 3
1358c6bd995SGarrett Wollman.Sh STANDARDS
1368c6bd995SGarrett WollmanThe
1378c6bd995SGarrett Wollman.Nm getconf
1388c6bd995SGarrett Wollmanutility is expected to be compliant with
1398c6bd995SGarrett Wollman.St -susv2 .
1408c6bd995SGarrett Wollman.Sh HISTORY
1418c6bd995SGarrett WollmanThe
1428c6bd995SGarrett Wollman.Nm getconf
1438c6bd995SGarrett Wollmancommand first appeared in
1448c6bd995SGarrett Wollman.Fx 5.0 .
1458c6bd995SGarrett Wollman.Sh BUGS
1468c6bd995SGarrett WollmanThe original
1478c6bd995SGarrett Wollman.Tn X/Open
1488c6bd995SGarrett Wollmanspecification erroneously requires the return values of
1498c6bd995SGarrett Wollman.Xr pathconf 2
1508c6bd995SGarrett Wollmanand
1518c6bd995SGarrett Wollman.Xr sysconf 3
1528c6bd995SGarrett Wollmanto be printed using the
1538c6bd995SGarrett Wollman.Xr printf 3
1548c6bd995SGarrett Wollmanformat specifier
1558c6bd995SGarrett Wollman.Li \&"%d" .
1568c6bd995SGarrett WollmanWe ignore that aspect of the specification and use the
1578c6bd995SGarrett Wollmancorrect
1588c6bd995SGarrett Wollman.Li \&"%ld"
1598c6bd995SGarrett Wollmanformat.
160251c176fSRuslan Ermilov.Sh AUTHORS
1618c6bd995SGarrett Wollman.An Garrett A. Wollman Aq wollman@lcs.mit.edu
162