summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_poll.c
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2007-06-04 18:25:08 +0000
committerdwmalone <dwmalone@FreeBSD.org>2007-06-04 18:25:08 +0000
commit771efb08f5bfaf22da0498ae91647fdecb3cc6bb (patch)
treee4320a83dea3de4df605896db823e0af0f883364 /sys/kern/kern_poll.c
parent360dc5b21c582598a9aaf5b3cd6f3832b847ef41 (diff)
downloadFreeBSD-src-771efb08f5bfaf22da0498ae91647fdecb3cc6bb.zip
FreeBSD-src-771efb08f5bfaf22da0498ae91647fdecb3cc6bb.tar.gz
Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export. The type must always be an int or an unsigned int. Remove the instances where a sizeof(variable) is passed to stop people accidently cut and pasting these examples. In a few places this was sysctl_handle_int was being used on 64 bit types, which would truncate the value to be exported. In these cases use sysctl_handle_quad to export them and change the format to Q so that sysctl(1) can still print them.
Diffstat (limited to 'sys/kern/kern_poll.c')
-rw-r--r--sys/kern/kern_poll.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/kern_poll.c b/sys/kern/kern_poll.c
index 8e87607..3e3efbf 100644
--- a/sys/kern/kern_poll.c
+++ b/sys/kern/kern_poll.c
@@ -113,7 +113,7 @@ static int poll_burst_max_sysctl(SYSCTL_HANDLER_ARGS)
uint32_t val = poll_burst_max;
int error;
- error = sysctl_handle_int(oidp, &val, sizeof(int), req);
+ error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr )
return (error);
if (val < MIN_POLL_BURST_MAX || val > MAX_POLL_BURST_MAX)
@@ -137,7 +137,7 @@ static int poll_each_burst_sysctl(SYSCTL_HANDLER_ARGS)
uint32_t val = poll_each_burst;
int error;
- error = sysctl_handle_int(oidp, &val, sizeof(int), req);
+ error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr )
return (error);
if (val < 1)
@@ -167,7 +167,7 @@ static int user_frac_sysctl(SYSCTL_HANDLER_ARGS)
uint32_t val = user_frac;
int error;
- error = sysctl_handle_int(oidp, &val, sizeof(int), req);
+ error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr )
return (error);
if (val < 0 || val > 99)
@@ -190,7 +190,7 @@ static int reg_frac_sysctl(SYSCTL_HANDLER_ARGS)
uint32_t val = reg_frac;
int error;
- error = sysctl_handle_int(oidp, &val, sizeof(int), req);
+ error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr )
return (error);
if (val < 1 || val > hz)
@@ -535,7 +535,7 @@ poll_switch(SYSCTL_HANDLER_ARGS)
int error;
int val = polling;
- error = sysctl_handle_int(oidp, &val, sizeof(int), req);
+ error = sysctl_handle_int(oidp, &val, 0, req);
if (error || !req->newptr )
return (error);
OpenPOWER on IntegriCloud