Bug #393 » confstr.diff
| confstr.3 5 Dec 2006 18:43:12 -0000 | ||
|---|---|---|
|
.\" $FreeBSD: src/lib/libc/gen/confstr.3,v 1.5.2.5 2001/12/14 18:33:50 ru Exp $
|
||
|
.\" $DragonFly: src/lib/libc/gen/confstr.3,v 1.3 2006/05/26 19:39:36 swildner Exp $
|
||
|
.\"
|
||
|
.Dd June 4, 1993
|
||
|
.Dd December 5, 2006
|
||
|
.Dt CONFSTR 3
|
||
|
.Os
|
||
|
.Sh NAME
|
||
| ... | ... | |
|
.Sh RETURN VALUES
|
||
|
If the call to
|
||
|
.Fn confstr
|
||
|
is not successful, \-1 is returned and
|
||
|
is not successful, 0 is returned and
|
||
|
.Va errno
|
||
|
is set appropriately.
|
||
|
Otherwise, if the variable does not have a configuration defined value,
|
||
| ... | ... | |
|
.El
|
||
|
.Sh SEE ALSO
|
||
|
.Xr sysctl 3
|
||
|
.Rs
|
||
|
.St -p1003.2
|
||
|
.Sh HISTORY
|
||
|
The
|
||
|
.Fn confstr
|
||
| confstr.c 5 Dec 2006 18:32:40 -0000 | ||
|---|---|---|
|
mib[0] = CTL_USER;
|
||
|
mib[1] = USER_CS_PATH;
|
||
|
if (sysctl(mib, 2, NULL, &tlen, NULL, 0) == -1)
|
||
|
return (-1);
|
||
|
/*
|
||
|
* POSIX 1003.2 requires errors to return 0.
|
||
|
*/
|
||
|
return (0);
|
||
|
if (len != 0 && buf != NULL) {
|
||
|
if ((p = malloc(tlen)) == NULL)
|
||
|
return (-1);
|
||
|
return (0); /* POSIX 1003.2 */
|
||
|
if (sysctl(mib, 2, p, &tlen, NULL, 0) == -1) {
|
||
|
sverrno = errno;
|
||
|
free(p);
|
||
|
errno = sverrno;
|
||
|
return (-1);
|
||
|
return (0); /* POSIX 1003.2 */
|
||
|
}
|
||
|
/*
|
||
|
* POSIX 1003.2 requires partial return of
|
||