xref: /csrg-svn/lib/libc/gen/confstr.3 (revision 61111)
1*61111Sbostic.\" Copyright (c) 1993
2*61111Sbostic.\"	The Regents of the University of California.  All rights reserved.
360282Sbostic.\"
460282Sbostic.\" %sccs.include.redist.roff%
560282Sbostic.\"
6*61111Sbostic.\"	@(#)confstr.3	8.1 (Berkeley) 06/04/93
760282Sbostic.\"
860282Sbostic.Dd
960282Sbostic.Dt CONFSTR 3
1060282Sbostic.Os BSD 4
1160282Sbostic.Sh NAME
1260282Sbostic.Nm confstr
1360282Sbostic.Nd get string-valued configurable variables
1460282Sbostic.Sh SYNOPSIS
1560282Sbostic.Fd #include <unistd.h>
1660282Sbostic.Ft size_t
1760282Sbostic.Fn confstr "int name" "char *buf" "size_t len"
1860282Sbostic.Sh DESCRIPTION
1960282Sbostic.Bf -symbolic
2060282SbosticThis interface is obsoleted by sysctl(3).
2160282Sbostic.Ef
2260282Sbostic.Pp
2360282SbosticThe
2460282Sbostic.Fn confstr
2560282Sbosticfunction provides a method for applications to get configuration
2660282Sbosticdefined string values.
2760282Sbostic.Pp
2860282SbosticThe
2960282Sbostic.Fa name
3060282Sbosticargument specifies the system variable to be queried.
3160282SbosticSymbolic constants for each name value are found in the include file
3260282Sbostic.Li <unistd.h> .
3360282SbosticThe
3460282Sbostic.Fa len
3560282Sbosticargument specifies the size of the buffer referenced by the
3660282Sbosticargument
3760282Sbostic.Fa buf .
3860282SbosticIf
3960282Sbostic.Fa len
4060282Sbosticis non-zero,
4160282Sbostic.Fa buf
4260282Sbosticis a non-null pointer, and
4360282Sbostic.Fa name
4460282Sbostichas a value, up to
4560282Sbostic.Fa len
4660282Sbostic\- 1 bytes of the value are copied into the buffer
4760282Sbostic.Fa buf .
4860282SbosticThe copied value is always null terminated.
4960282Sbostic.Pp
5060282SbosticThe available values are as follows:
5160282Sbostic.Pp
5260282Sbostic.Bl -tag -width "123456"
5360282Sbostic.Pp
5460282Sbostic.It Li _CS_PATH
5560282SbosticReturn a value for the
5660282Sbostic.Ev PATH
5760282Sbosticenvironment variable that finds all the standard utilities.
5860282Sbostic.El
5960282Sbostic.Sh RETURN VALUES
6060282SbosticIf the call to
6160282Sbostic.Nm confstr
6260282Sbosticis not successful, \-1 is returned and
6360282Sbostic.Va errno
6460282Sbosticis set appropriately.
6560282SbosticOtherwise, if the variable does not have a configuration defined value,
6660282Sbostic0 is returned and
6760282Sbostic.Va errno
6860282Sbosticis not modified.
6960282SbosticOtherwise, the buffer size needed to hold the entire configuration-defined
7060282Sbosticvalue is returned.
7160282SbosticIf this size is greater than the argument
7260282Sbostic.Fa len ,
7360282Sbosticthe string in
7460282Sbostic.Fa buf
7560282Sbosticwas truncated.
7660282Sbostic.Sh ERRORS
7760282SbosticThe
7860282Sbostic.Nm confstr
7960282Sbosticfunction may fail and set
8060282Sbostic.Va error
8160282Sbosticfor any of the errors specified for the library functions
8260282Sbostic.Xr malloc 3
8360282Sbosticand
8460282Sbostic.Xr sysctl 3 .
8560282Sbostic.Pp
8660282SbosticIn addition, the following errors may be reported:
8760282Sbostic.Bl -tag -width Er
8860282Sbostic.It Bq Er EINVAL
8960282SbosticThe value of the
9060282Sbostic.Fa name
9160282Sbosticargument is invalid.
9260282Sbostic.Sh SEE ALSO
9360282Sbostic.Xr sysctl 3
9460282Sbostic.Sh HISTORY
9560282SbosticThe
9660282Sbostic.Nm confstr
9760282Sbosticfunction first appeared in 4.4BSD.
98