confstr.diff
| confstr.3 5 Dec 2006 18:43:12 -0000 | ||
|---|---|---|
| 33 | 33 |
.\" $FreeBSD: src/lib/libc/gen/confstr.3,v 1.5.2.5 2001/12/14 18:33:50 ru Exp $ |
| 34 | 34 |
.\" $DragonFly: src/lib/libc/gen/confstr.3,v 1.3 2006/05/26 19:39:36 swildner Exp $ |
| 35 | 35 |
.\" |
| 36 |
.Dd June 4, 1993
|
|
| 36 |
.Dd December 5, 2006
|
|
| 37 | 37 |
.Dt CONFSTR 3 |
| 38 | 38 |
.Os |
| 39 | 39 |
.Sh NAME |
| ... | ... | |
| 90 | 90 |
.Sh RETURN VALUES |
| 91 | 91 |
If the call to |
| 92 | 92 |
.Fn confstr |
| 93 |
is not successful, \-1 is returned and
|
|
| 93 |
is not successful, 0 is returned and
|
|
| 94 | 94 |
.Va errno |
| 95 | 95 |
is set appropriately. |
| 96 | 96 |
Otherwise, if the variable does not have a configuration defined value, |
| ... | ... | |
| 123 | 123 |
.El |
| 124 | 124 |
.Sh SEE ALSO |
| 125 | 125 |
.Xr sysctl 3 |
| 126 |
.Rs |
|
| 127 |
.St -p1003.2 |
|
| 126 | 128 |
.Sh HISTORY |
| 127 | 129 |
The |
| 128 | 130 |
.Fn confstr |
| confstr.c 5 Dec 2006 18:32:40 -0000 | ||
|---|---|---|
| 55 | 55 |
mib[0] = CTL_USER; |
| 56 | 56 |
mib[1] = USER_CS_PATH; |
| 57 | 57 |
if (sysctl(mib, 2, NULL, &tlen, NULL, 0) == -1) |
| 58 |
return (-1); |
|
| 58 |
/* |
|
| 59 |
* POSIX 1003.2 requires errors to return 0. |
|
| 60 |
*/ |
|
| 61 |
return (0); |
|
| 59 | 62 |
if (len != 0 && buf != NULL) {
|
| 60 | 63 |
if ((p = malloc(tlen)) == NULL) |
| 61 |
return (-1);
|
|
| 64 |
return (0); /* POSIX 1003.2 */
|
|
| 62 | 65 |
if (sysctl(mib, 2, p, &tlen, NULL, 0) == -1) {
|
| 63 | 66 |
sverrno = errno; |
| 64 | 67 |
free(p); |
| 65 | 68 |
errno = sverrno; |
| 66 |
return (-1);
|
|
| 69 |
return (0); /* POSIX 1003.2 */
|
|
| 67 | 70 |
} |
| 68 | 71 |
/* |
| 69 | 72 |
* POSIX 1003.2 requires partial return of |