diff options
author | dfr <dfr@FreeBSD.org> | 1998-12-27 18:03:29 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1998-12-27 18:03:29 +0000 |
commit | 9238b8271dba66bff7d748e765d7930407e62c0e (patch) | |
tree | 9ea9431f80a2fb0797ec7a3226df618d63334d8b /sys/kern/kern_sysctl.c | |
parent | ab302cd2cde3a14092cba2812798a98860e1e41b (diff) | |
download | FreeBSD-src-9238b8271dba66bff7d748e765d7930407e62c0e.zip FreeBSD-src-9238b8271dba66bff7d748e765d7930407e62c0e.tar.gz |
Fix some 64bit truncation problems which crept into SYSCTL_LONG() with the
last cleanup. Since the oid_arg2 field of struct sysctl_oid is not wide
enough to hold a long, the SYSCTL_LONG() macro has been modified to only
support exporting long variables by pointer instead of by value.
Reviewed by: bde
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r-- | sys/kern/kern_sysctl.c | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index b43c4ee..55e583b 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $Id: kern_sysctl.c,v 1.79 1998/12/04 22:54:51 archie Exp $ + * $Id: kern_sysctl.c,v 1.80 1998/12/13 07:18:54 truckman Exp $ */ #include "opt_compat.h" @@ -497,7 +497,7 @@ SYSCTL_NODE(_sysctl, 4, oidfmt, CTLFLAG_RD, sysctl_sysctl_oidfmt, ""); */ /* - * Handle an integer, signed or unsigned. + * Handle an int, signed or unsigned. * Two cases: * a variable: point arg1 at it. * a constant: pass it in arg2. @@ -524,7 +524,7 @@ sysctl_handle_int SYSCTL_HANDLER_ARGS } /* - * Handle an integer, signed or unsigned. + * Handle a long, signed or unsigned. * Two cases: * a variable: point arg1 at it. * a constant: pass it in arg2. @@ -535,10 +535,7 @@ sysctl_handle_long SYSCTL_HANDLER_ARGS { int error = 0; - if (arg1) - error = SYSCTL_OUT(req, arg1, sizeof(long)); - else - error = SYSCTL_OUT(req, &arg2, sizeof(long)); + error = SYSCTL_OUT(req, arg1, sizeof(long)); if (error || !req->newptr) return (error); @@ -551,33 +548,6 @@ sysctl_handle_long SYSCTL_HANDLER_ARGS } /* - * Handle an integer, signed or unsigned. - * Two cases: - * a variable: point arg1 at it. - * a constant: pass it in arg2. - */ - -int -sysctl_handle_intptr SYSCTL_HANDLER_ARGS -{ - int error = 0; - - if (arg1) - error = SYSCTL_OUT(req, arg1, sizeof(intptr_t)); - else - error = SYSCTL_OUT(req, &arg2, sizeof(intptr_t)); - - if (error || !req->newptr) - return (error); - - if (!arg1) - error = EPERM; - else - error = SYSCTL_IN(req, arg1, sizeof(intptr_t)); - return (error); -} - -/* * Handle our generic '\0' terminated 'C' string. * Two cases: * a variable string: point arg1 at it, arg2 is max length. |