aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_tc.c
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2007-06-04 18:25:08 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2007-06-04 18:25:08 +0000
commit041b706b2fa9a5d00d1752796abb7af549d5977b (patch)
treee4320a83dea3de4df605896db823e0af0f883364 /sys/kern/kern_tc.c
parentdf82ff50ed4d9796c4e6b2dae16c3e0e82bfa1fa (diff)
downloadsrc-041b706b2fa9a5d00d1752796abb7af549d5977b.tar.gz
src-041b706b2fa9a5d00d1752796abb7af549d5977b.zip
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.
Notes
Notes: svn path=/head/; revision=170289
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r--sys/kern/kern_tc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 8b7e0c40be07..bda9fb7be9ef 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -141,7 +141,7 @@ sysctl_kern_timecounter_get(SYSCTL_HANDLER_ARGS)
struct timecounter *tc = arg1;
ncount = tc->tc_get_timecount(tc);
- return sysctl_handle_int(oidp, &ncount, sizeof(ncount), req);
+ return sysctl_handle_int(oidp, &ncount, 0, req);
}
static int
@@ -151,7 +151,7 @@ sysctl_kern_timecounter_freq(SYSCTL_HANDLER_ARGS)
struct timecounter *tc = arg1;
freq = tc->tc_frequency;
- return sysctl_handle_int(oidp, &freq, sizeof(freq), req);
+ return sysctl_handle_quad(oidp, &freq, 0, req);
}
/*
@@ -365,7 +365,7 @@ tc_init(struct timecounter *tc)
sysctl_kern_timecounter_get, "IU", "current timecounter value");
SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(tc_root), OID_AUTO,
"frequency", CTLTYPE_QUAD | CTLFLAG_RD, tc, sizeof(*tc),
- sysctl_kern_timecounter_freq, "IU", "timecounter frequency");
+ sysctl_kern_timecounter_freq, "QU", "timecounter frequency");
SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(tc_root), OID_AUTO,
"quality", CTLFLAG_RD, &(tc->tc_quality), 0,
"goodness of time counter");