aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>1999-01-06 18:11:53 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>1999-01-06 18:11:53 +0000
commiteec1dbe6cee1fa7f9f35d0806a365d631308c56a (patch)
treefcbd064758cf68a0418ea858fb10e400a525dd82 /lib
parentfae0c289fb97d7b769e167c0e2eba9373fd8562b (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/sysctl.35
-rw-r--r--lib/libc/gen/sysctl.c12
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index 30e8e83eb879..02a185ca848a 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -667,9 +667,10 @@ If the amount of free and cache memory falls below this value, the
pageout daemon will enter "memory conserving mode" to avoid deadlock.
.El
.Sh RETURN VALUES
-If the call to
.Fn sysctl
-is successful, the number of bytes copied out is returned.
+and
+.Fn sysctlbyname
+return 0 when successful.
Otherwise \-1 is returned and
.Va errno
is set appropriately.
diff --git a/lib/libc/gen/sysctl.c b/lib/libc/gen/sysctl.c
index cb7448af3243..19709d5932e9 100644
--- a/lib/libc/gen/sysctl.c
+++ b/lib/libc/gen/sysctl.c
@@ -66,16 +66,20 @@ sysctl(name, namelen, oldp, oldlenp, newp, newlen)
switch (name[1]) {
case USER_CS_PATH:
- if (oldp && *oldlenp < sizeof(_PATH_STDPATH))
- return (ENOMEM);
+ if (oldp && *oldlenp < sizeof(_PATH_STDPATH)) {
+ errno = ENOMEM;
+ return -1;
+ }
*oldlenp = sizeof(_PATH_STDPATH);
if (oldp != NULL)
memmove(oldp, _PATH_STDPATH, sizeof(_PATH_STDPATH));
return (0);
}
- if (oldp && *oldlenp < sizeof(int))
- return (ENOMEM);
+ if (oldp && *oldlenp < sizeof(int)) {
+ errno = ENOMEM;
+ return (-1);
+ }
*oldlenp = sizeof(int);
if (oldp == NULL)
return (0);