1*bac379f5Sbostic.\" Copyright (c) 1993 2*bac379f5Sbostic.\" The Regents of the University of California. All rights reserved. 336dfb9bbSbostic.\" 436dfb9bbSbostic.\" %sccs.include.redist.roff% 536dfb9bbSbostic.\" 6*bac379f5Sbostic.\" @(#)confstr.3 8.1 (Berkeley) 06/04/93 736dfb9bbSbostic.\" 836dfb9bbSbostic.Dd 936dfb9bbSbostic.Dt CONFSTR 3 1036dfb9bbSbostic.Os BSD 4 1136dfb9bbSbostic.Sh NAME 1236dfb9bbSbostic.Nm confstr 1336dfb9bbSbostic.Nd get string-valued configurable variables 1436dfb9bbSbostic.Sh SYNOPSIS 1536dfb9bbSbostic.Fd #include <unistd.h> 1636dfb9bbSbostic.Ft size_t 1736dfb9bbSbostic.Fn confstr "int name" "char *buf" "size_t len" 1836dfb9bbSbostic.Sh DESCRIPTION 1936dfb9bbSbostic.Bf -symbolic 2036dfb9bbSbosticThis interface is obsoleted by sysctl(3). 2136dfb9bbSbostic.Ef 2236dfb9bbSbostic.Pp 2336dfb9bbSbosticThe 2436dfb9bbSbostic.Fn confstr 2536dfb9bbSbosticfunction provides a method for applications to get configuration 2636dfb9bbSbosticdefined string values. 2736dfb9bbSbostic.Pp 2836dfb9bbSbosticThe 2936dfb9bbSbostic.Fa name 3036dfb9bbSbosticargument specifies the system variable to be queried. 3136dfb9bbSbosticSymbolic constants for each name value are found in the include file 3236dfb9bbSbostic.Li <unistd.h> . 3336dfb9bbSbosticThe 3436dfb9bbSbostic.Fa len 3536dfb9bbSbosticargument specifies the size of the buffer referenced by the 3636dfb9bbSbosticargument 3736dfb9bbSbostic.Fa buf . 3836dfb9bbSbosticIf 3936dfb9bbSbostic.Fa len 4036dfb9bbSbosticis non-zero, 4136dfb9bbSbostic.Fa buf 4236dfb9bbSbosticis a non-null pointer, and 4336dfb9bbSbostic.Fa name 4436dfb9bbSbostichas a value, up to 4536dfb9bbSbostic.Fa len 4636dfb9bbSbostic\- 1 bytes of the value are copied into the buffer 4736dfb9bbSbostic.Fa buf . 4836dfb9bbSbosticThe copied value is always null terminated. 4936dfb9bbSbostic.Pp 5036dfb9bbSbosticThe available values are as follows: 5136dfb9bbSbostic.Pp 5236dfb9bbSbostic.Bl -tag -width "123456" 5336dfb9bbSbostic.Pp 5436dfb9bbSbostic.It Li _CS_PATH 5536dfb9bbSbosticReturn a value for the 5636dfb9bbSbostic.Ev PATH 5736dfb9bbSbosticenvironment variable that finds all the standard utilities. 5836dfb9bbSbostic.El 5936dfb9bbSbostic.Sh RETURN VALUES 6036dfb9bbSbosticIf the call to 6136dfb9bbSbostic.Nm confstr 6236dfb9bbSbosticis not successful, \-1 is returned and 6336dfb9bbSbostic.Va errno 6436dfb9bbSbosticis set appropriately. 6536dfb9bbSbosticOtherwise, if the variable does not have a configuration defined value, 6636dfb9bbSbostic0 is returned and 6736dfb9bbSbostic.Va errno 6836dfb9bbSbosticis not modified. 6936dfb9bbSbosticOtherwise, the buffer size needed to hold the entire configuration-defined 7036dfb9bbSbosticvalue is returned. 7136dfb9bbSbosticIf this size is greater than the argument 7236dfb9bbSbostic.Fa len , 7336dfb9bbSbosticthe string in 7436dfb9bbSbostic.Fa buf 7536dfb9bbSbosticwas truncated. 7636dfb9bbSbostic.Sh ERRORS 7736dfb9bbSbosticThe 7836dfb9bbSbostic.Nm confstr 7936dfb9bbSbosticfunction may fail and set 8036dfb9bbSbostic.Va error 8136dfb9bbSbosticfor any of the errors specified for the library functions 8236dfb9bbSbostic.Xr malloc 3 8336dfb9bbSbosticand 8436dfb9bbSbostic.Xr sysctl 3 . 8536dfb9bbSbostic.Pp 8636dfb9bbSbosticIn addition, the following errors may be reported: 8736dfb9bbSbostic.Bl -tag -width Er 8836dfb9bbSbostic.It Bq Er EINVAL 8936dfb9bbSbosticThe value of the 9036dfb9bbSbostic.Fa name 9136dfb9bbSbosticargument is invalid. 9236dfb9bbSbostic.Sh SEE ALSO 9336dfb9bbSbostic.Xr sysctl 3 9436dfb9bbSbostic.Sh HISTORY 9536dfb9bbSbosticThe 9636dfb9bbSbostic.Nm confstr 9736dfb9bbSbosticfunction first appeared in 4.4BSD. 98