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$ 30.\" 31.Dd September 18, 2002 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.Pp 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 filesystem-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.Aq Pa 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.Bd -literal -offset indent 136getconf POSIX_V6_WIDTH_RESTRICTED_ENVS 137.Ed 138.Pp 139returns a newline-separated list of environments in which the width 140of certain fundamental types is no greater than the width of the native 141C type 142.Ql long . 143At present, all programming environments supported by 144.Fx 145have this property. 146Several of the 147.Xr confstr 3 148variables provide information on the necessary compiler and linker flags 149to use the standard programming environments described above. 150.Sh DIAGNOSTICS 151.Ex -std 152Use of a 153.Ar system_var 154or 155.Ar path_var 156which is completely unrecognized is considered an error, 157causing a diagnostic message to be written to standard error. 158One 159which is known but merely undefined does not result in an error 160indication. 161The 162.Nm 163command recognizes all of the variables defined for 164.St -p1003.1-2001 , 165including those which are not currently implemented. 166.Sh EXAMPLES 167The command: 168.Bd -literal -offset indent 169getconf PATH 170.Ed 171.Pp 172will display the system default setting for the 173.Ev PATH 174environment variable. 175.Pp 176The command: 177.Bd -literal -offset indent 178getconf NAME_MAX /tmp 179.Ed 180.Pp 181will display the maximum length of a filename in the 182.Pa /tmp 183directory. 184.Pp 185The command: 186.Bd -literal -offset indent 187getconf -v POSIX_V6_LPBIG_OFFBIG LONG_MAX 188.Ed 189.Pp 190will display the maximum value of the C type 191.Ql long 192in the 193.Li POSIX_V6_LPBIG_OFFBIG 194programming environment, 195if the system supports that environment. 196.Sh SEE ALSO 197.Xr pathconf 2 , 198.Xr confstr 3 , 199.Xr sysconf 3 200.Sh STANDARDS 201The 202.Nm 203utility is expected to be compliant with 204.St -p1003.1-2001 . 205.Sh HISTORY 206The 207.Nm 208command first appeared in 209.Fx 5.0 . 210.Sh AUTHORS 211.An Garrett A. Wollman Aq wollman@lcs.mit.edu 212