1*60282Sbostic.\" Copyright (c) 1993 The Regents of the University of California. 2*60282Sbostic.\" All rights reserved. 3*60282Sbostic.\" 4*60282Sbostic.\" %sccs.include.redist.roff% 5*60282Sbostic.\" 6*60282Sbostic.\" @(#)confstr.3 5.1 (Berkeley) 05/24/93 7*60282Sbostic.\" 8*60282Sbostic.Dd 9*60282Sbostic.Dt CONFSTR 3 10*60282Sbostic.Os BSD 4 11*60282Sbostic.Sh NAME 12*60282Sbostic.Nm confstr 13*60282Sbostic.Nd get string-valued configurable variables 14*60282Sbostic.Sh SYNOPSIS 15*60282Sbostic.Fd #include <unistd.h> 16*60282Sbostic.Ft size_t 17*60282Sbostic.Fn confstr "int name" "char *buf" "size_t len" 18*60282Sbostic.Sh DESCRIPTION 19*60282Sbostic.Bf -symbolic 20*60282SbosticThis interface is obsoleted by sysctl(3). 21*60282Sbostic.Ef 22*60282Sbostic.Pp 23*60282SbosticThe 24*60282Sbostic.Fn confstr 25*60282Sbosticfunction provides a method for applications to get configuration 26*60282Sbosticdefined string values. 27*60282Sbostic.Pp 28*60282SbosticThe 29*60282Sbostic.Fa name 30*60282Sbosticargument specifies the system variable to be queried. 31*60282SbosticSymbolic constants for each name value are found in the include file 32*60282Sbostic.Li <unistd.h> . 33*60282SbosticThe 34*60282Sbostic.Fa len 35*60282Sbosticargument specifies the size of the buffer referenced by the 36*60282Sbosticargument 37*60282Sbostic.Fa buf . 38*60282SbosticIf 39*60282Sbostic.Fa len 40*60282Sbosticis non-zero, 41*60282Sbostic.Fa buf 42*60282Sbosticis a non-null pointer, and 43*60282Sbostic.Fa name 44*60282Sbostichas a value, up to 45*60282Sbostic.Fa len 46*60282Sbostic\- 1 bytes of the value are copied into the buffer 47*60282Sbostic.Fa buf . 48*60282SbosticThe copied value is always null terminated. 49*60282Sbostic.Pp 50*60282SbosticThe available values are as follows: 51*60282Sbostic.Pp 52*60282Sbostic.Bl -tag -width "123456" 53*60282Sbostic.Pp 54*60282Sbostic.It Li _CS_PATH 55*60282SbosticReturn a value for the 56*60282Sbostic.Ev PATH 57*60282Sbosticenvironment variable that finds all the standard utilities. 58*60282Sbostic.El 59*60282Sbostic.Sh RETURN VALUES 60*60282SbosticIf the call to 61*60282Sbostic.Nm confstr 62*60282Sbosticis not successful, \-1 is returned and 63*60282Sbostic.Va errno 64*60282Sbosticis set appropriately. 65*60282SbosticOtherwise, if the variable does not have a configuration defined value, 66*60282Sbostic0 is returned and 67*60282Sbostic.Va errno 68*60282Sbosticis not modified. 69*60282SbosticOtherwise, the buffer size needed to hold the entire configuration-defined 70*60282Sbosticvalue is returned. 71*60282SbosticIf this size is greater than the argument 72*60282Sbostic.Fa len , 73*60282Sbosticthe string in 74*60282Sbostic.Fa buf 75*60282Sbosticwas truncated. 76*60282Sbostic.Sh ERRORS 77*60282SbosticThe 78*60282Sbostic.Nm confstr 79*60282Sbosticfunction may fail and set 80*60282Sbostic.Va error 81*60282Sbosticfor any of the errors specified for the library functions 82*60282Sbostic.Xr malloc 3 83*60282Sbosticand 84*60282Sbostic.Xr sysctl 3 . 85*60282Sbostic.Pp 86*60282SbosticIn addition, the following errors may be reported: 87*60282Sbostic.Bl -tag -width Er 88*60282Sbostic.It Bq Er EINVAL 89*60282SbosticThe value of the 90*60282Sbostic.Fa name 91*60282Sbosticargument is invalid. 92*60282Sbostic.Sh SEE ALSO 93*60282Sbostic.Xr sysctl 3 94*60282Sbostic.Sh HISTORY 95*60282SbosticThe 96*60282Sbostic.Nm confstr 97*60282Sbosticfunction first appeared in 4.4BSD. 98