From 771efb08f5bfaf22da0498ae91647fdecb3cc6bb Mon Sep 17 00:00:00 2001 From: dwmalone Date: Mon, 4 Jun 2007 18:25:08 +0000 Subject: 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. --- sys/amd64/amd64/tsc.c | 6 +++--- sys/amd64/isa/clock.c | 2 +- sys/cam/cam_xpt.c | 2 +- sys/cam/scsi/scsi_all.c | 2 +- sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c | 4 ++-- sys/compat/opensolaris/kern/opensolaris_kstat.c | 4 ++-- sys/dev/acpica/acpi_timer.c | 2 +- sys/dev/bge/if_bge.c | 2 +- sys/dev/sound/clone.c | 2 +- sys/dev/sound/pci/atiixp.c | 2 +- sys/dev/sound/pci/emu10kx.c | 2 +- sys/dev/sound/pci/es137x.c | 10 +++++----- sys/dev/sound/pci/hda/hdac.c | 6 +++--- sys/dev/sound/pci/via8233.c | 6 +++--- sys/dev/sound/pcm/ac97.c | 2 +- sys/dev/sound/pcm/channel.c | 6 +++--- sys/dev/sound/pcm/feeder.c | 2 +- sys/dev/sound/pcm/feeder_rate.c | 6 +++--- sys/dev/sound/pcm/sndstat.c | 4 ++-- sys/dev/sound/pcm/sound.c | 14 +++++++------- sys/dev/sound/pcm/vchan.c | 2 +- sys/dev/usb/uplcom.c | 2 +- sys/dev/usb/uvscom.c | 4 ++-- sys/geom/cache/g_cache.c | 2 +- sys/geom/journal/g_journal.c | 6 +++--- sys/geom/stripe/g_stripe.c | 2 +- sys/i386/i386/elan-mmcr.c | 2 +- sys/i386/i386/mp_clock.c | 2 +- sys/i386/i386/tsc.c | 4 ++-- sys/i386/isa/clock.c | 2 +- sys/isa/atrtc.c | 2 +- sys/kern/kern_mbuf.c | 2 +- sys/kern/kern_poll.c | 10 +++++----- sys/kern/kern_tc.c | 6 +++--- sys/kern/uipc_socket.c | 4 ++-- sys/netgraph/bluetooth/common/ng_bluetooth.c | 8 ++++---- sys/netgraph/ng_base.c | 2 +- sys/netinet/tcp_timewait.c | 2 +- sys/pc98/cbus/clock.c | 2 +- sys/pc98/cbus/pcrtc.c | 2 +- 40 files changed, 77 insertions(+), 77 deletions(-) (limited to 'sys') diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index c4fae71..3c66a33 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -204,7 +204,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS) if (tsc_timecounter.tc_frequency == 0) return (EOPNOTSUPP); freq = tsc_freq; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_quad(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) { tsc_freq = freq; tsc_timecounter.tc_frequency = tsc_freq; @@ -212,8 +212,8 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_LONG | CTLFLAG_RW, - 0, sizeof(u_int), sysctl_machdep_tsc_freq, "IU", ""); +SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW, + 0, sizeof(u_int), sysctl_machdep_tsc_freq, "QU", ""); static unsigned tsc_get_timecount(struct timecounter *tc) diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index a6410ea..4efe73a 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -839,7 +839,7 @@ sysctl_machdep_i8254_freq(SYSCTL_HANDLER_ARGS) * is is too generic. Should use it everywhere. */ freq = timer_freq; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_int(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) set_timer_freq(freq, hz); return (error); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index baa9bbf..51a8a38 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -6352,7 +6352,7 @@ sysctl_cam_search_luns(SYSCTL_HANDLER_ARGS) int error, bool; bool = cam_srch_hi; - error = sysctl_handle_int(oidp, &bool, sizeof(bool), req); + error = sysctl_handle_int(oidp, &bool, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (bool == 0 || bool == 1) { diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index e370106..7349709 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -3023,7 +3023,7 @@ sysctl_scsi_delay(SYSCTL_HANDLER_ARGS) int error, delay; delay = scsi_delay; - error = sysctl_handle_int(oidp, &delay, sizeof(delay), req); + error = sysctl_handle_int(oidp, &delay, 0, req); if (error != 0 || req->newptr == NULL) return (error); return (set_scsi_delay(delay)); diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c b/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c index 673de14..6d0b7cf 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c @@ -102,7 +102,7 @@ kstat_sysctl(SYSCTL_HANDLER_ARGS) uint64_t val; val = ksent->value.ui64; - return sysctl_handle_int(oidp, &val, sizeof(val), req); + return sysctl_handle_quad(oidp, &val, 0, req); } void @@ -118,7 +118,7 @@ kstat_install(kstat_t *ksp) SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx, SYSCTL_CHILDREN(ksp->ks_sysctl_root), OID_AUTO, ksent->name, CTLTYPE_QUAD | CTLFLAG_RD, ksent, sizeof(*ksent), - kstat_sysctl, "IU", ""); + kstat_sysctl, "QU", ""); } } diff --git a/sys/compat/opensolaris/kern/opensolaris_kstat.c b/sys/compat/opensolaris/kern/opensolaris_kstat.c index 673de14..6d0b7cf 100644 --- a/sys/compat/opensolaris/kern/opensolaris_kstat.c +++ b/sys/compat/opensolaris/kern/opensolaris_kstat.c @@ -102,7 +102,7 @@ kstat_sysctl(SYSCTL_HANDLER_ARGS) uint64_t val; val = ksent->value.ui64; - return sysctl_handle_int(oidp, &val, sizeof(val), req); + return sysctl_handle_quad(oidp, &val, 0, req); } void @@ -118,7 +118,7 @@ kstat_install(kstat_t *ksp) SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx, SYSCTL_CHILDREN(ksp->ks_sysctl_root), OID_AUTO, ksent->name, CTLTYPE_QUAD | CTLFLAG_RD, ksent, sizeof(*ksent), - kstat_sysctl, "IU", ""); + kstat_sysctl, "QU", ""); } } diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c index 2cc966c..f83978e 100644 --- a/sys/dev/acpica/acpi_timer.c +++ b/sys/dev/acpica/acpi_timer.c @@ -262,7 +262,7 @@ acpi_timer_sysctl_freq(SYSCTL_HANDLER_ARGS) if (acpi_timer_timecounter.tc_frequency == 0) return (EOPNOTSUPP); freq = acpi_timer_frequency; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_int(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) { acpi_timer_frequency = freq; acpi_timer_timecounter.tc_frequency = acpi_timer_frequency; diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index e6483b9..b0576bb 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -4426,7 +4426,7 @@ bge_sysctl_stats(SYSCTL_HANDLER_ARGS) base = BGE_MEMWIN_START + BGE_STATS_BLOCK; result = CSR_READ_4(sc, base + offset + offsetof(bge_hostaddr, bge_addr_lo)); - return (sysctl_handle_int(oidp, &result, sizeof(result), req)); + return (sysctl_handle_int(oidp, &result, 0, req)); } #ifdef BGE_REGISTER_DEBUG diff --git a/sys/dev/sound/clone.c b/sys/dev/sound/clone.c index 51316af..8b96443 100644 --- a/sys/dev/sound/clone.c +++ b/sys/dev/sound/clone.c @@ -148,7 +148,7 @@ sysctl_hw_snd_timestamp_precision(SYSCTL_HANDLER_ARGS) int err, val; val = snd_timestamp_precision; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL) { switch (val) { case SND_TSP_SEC: diff --git a/sys/dev/sound/pci/atiixp.c b/sys/dev/sound/pci/atiixp.c index cfbde70..325e506 100644 --- a/sys/dev/sound/pci/atiixp.c +++ b/sys/dev/sound/pci/atiixp.c @@ -957,7 +957,7 @@ sysctl_atiixp_polling(SYSCTL_HANDLER_ARGS) atiixp_lock(sc); val = sc->polling; atiixp_unlock(sc); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); diff --git a/sys/dev/sound/pci/emu10kx.c b/sys/dev/sound/pci/emu10kx.c index f455120..42e9bbd 100644 --- a/sys/dev/sound/pci/emu10kx.c +++ b/sys/dev/sound/pci/emu10kx.c @@ -1449,7 +1449,7 @@ sysctl_emu_mixer_control(SYSCTL_HANDLER_ARGS) mixer_id = arg2; new_vol = emumix_get_volume(sc, mixer_id); - err = sysctl_handle_int(oidp, &new_vol, sizeof(new_vol), req); + err = sysctl_handle_int(oidp, &new_vol, 0, req); if (err || req->newptr == NULL) return (err); diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index ec6cc75..e7f1655 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -1375,7 +1375,7 @@ sysctl_es137x_spdif_enable(SYSCTL_HANDLER_ARGS) r = es_rd(es, ES1370_REG_STATUS, 4); ES_UNLOCK(es); new_en = (r & ENABLE_SPDIF) ? 1 : 0; - err = sysctl_handle_int(oidp, &new_en, sizeof(new_en), req); + err = sysctl_handle_int(oidp, &new_en, 0, req); if (err || req->newptr == NULL) return (err); @@ -1412,7 +1412,7 @@ sysctl_es137x_latency_timer(SYSCTL_HANDLER_ARGS) ES_LOCK(es); val = pci_read_config(dev, PCIR_LATTIMER, 1); ES_UNLOCK(es); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); @@ -1441,7 +1441,7 @@ sysctl_es137x_fixed_rate(SYSCTL_HANDLER_ARGS) if (val < es_caps.minspeed) val = 0; ES_UNLOCK(es); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); @@ -1496,7 +1496,7 @@ sysctl_es137x_single_pcm_mixer(SYSCTL_HANDLER_ARGS) set = ES_SINGLE_PCM_MIX(es->escfg); val = set; ES_UNLOCK(es); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); @@ -1571,7 +1571,7 @@ sysctl_es_polling(SYSCTL_HANDLER_ARGS) ES_LOCK(es); val = es->polling; ES_UNLOCK(es); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index 7ae9342..4968900 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -5723,7 +5723,7 @@ sysctl_hdac_polling(SYSCTL_HANDLER_ARGS) hdac_lock(sc); val = sc->polling; hdac_unlock(sc); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); @@ -5782,7 +5782,7 @@ sysctl_hdac_polling_interval(SYSCTL_HANDLER_ARGS) hdac_lock(sc); val = ((uint64_t)sc->poll_ival * 1000) / hz; hdac_unlock(sc); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); @@ -5822,7 +5822,7 @@ sysctl_hdac_dump(SYSCTL_HANDLER_ARGS) devinfo->codec->sc == NULL) return (EINVAL); val = 0; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL || val == 0) return (err); sc = devinfo->codec->sc; diff --git a/sys/dev/sound/pci/via8233.c b/sys/dev/sound/pci/via8233.c index 829582f..a8b9057 100644 --- a/sys/dev/sound/pci/via8233.c +++ b/sys/dev/sound/pci/via8233.c @@ -165,7 +165,7 @@ sysctl_via8233_spdif_enable(SYSCTL_HANDLER_ARGS) r = pci_read_config(dev, VIA_PCI_SPDIF, 1); snd_mtxunlock(via->lock); new_en = (r & VIA_SPDIF_EN) ? 1 : 0; - err = sysctl_handle_int(oidp, &new_en, sizeof(new_en), req); + err = sysctl_handle_int(oidp, &new_en, 0, req); if (err || req->newptr == NULL) return (err); @@ -195,7 +195,7 @@ sysctl_via8233_dxs_src(SYSCTL_HANDLER_ARGS) snd_mtxlock(via->lock); val = via->dxs_src; snd_mtxunlock(via->lock); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); @@ -223,7 +223,7 @@ sysctl_via_polling(SYSCTL_HANDLER_ARGS) snd_mtxlock(via->lock); val = via->polling; snd_mtxunlock(via->lock); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err || req->newptr == NULL) return (err); diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index 279d5e5..44c947c 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -880,7 +880,7 @@ sysctl_hw_snd_ac97_eapd(SYSCTL_HANDLER_ARGS) inv = (codec->flags & AC97_F_EAPD_INV) ? 0 : 1; ea = (val >> 15) ^ inv; snd_mtxunlock(codec->lock); - err = sysctl_handle_int(oidp, &ea, sizeof(ea), req); + err = sysctl_handle_int(oidp, &ea, 0, req); if (err == 0 && req->newptr != NULL) { if (ea != 0 && ea != 1) return EINVAL; diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index f5753b1..c9831ff 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -70,7 +70,7 @@ sysctl_hw_snd_latency(SYSCTL_HANDLER_ARGS) int err, val; val = chn_latency; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return err; if (val < CHN_LATENCY_MIN || val > CHN_LATENCY_MAX) @@ -93,7 +93,7 @@ sysctl_hw_snd_latency_profile(SYSCTL_HANDLER_ARGS) int err, val; val = chn_latency_profile; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return err; if (val < CHN_LATENCY_PROFILE_MIN || val > CHN_LATENCY_PROFILE_MAX) @@ -116,7 +116,7 @@ sysctl_hw_snd_timeout(SYSCTL_HANDLER_ARGS) int err, val; val = chn_timeout; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return err; if (val < CHN_TIMEOUT_MIN || val > CHN_TIMEOUT_MAX) diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index 8e97960..fefbc92 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -45,7 +45,7 @@ sysctl_hw_snd_feeder_buffersize(SYSCTL_HANDLER_ARGS) int i, err, val; val = feeder_buffersize; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return err; diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c index 14cca55..79f06f1 100644 --- a/sys/dev/sound/pcm/feeder_rate.c +++ b/sys/dev/sound/pcm/feeder_rate.c @@ -130,7 +130,7 @@ sysctl_hw_snd_feeder_rate_min(SYSCTL_HANDLER_ARGS) int err, val; val = feeder_rate_min; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (RATE_FACTOR_SAFE(val) && val < feeder_rate_max) @@ -149,7 +149,7 @@ sysctl_hw_snd_feeder_rate_max(SYSCTL_HANDLER_ARGS) int err, val; val = feeder_rate_max; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (RATE_FACTOR_SAFE(val) && val > feeder_rate_min) @@ -168,7 +168,7 @@ sysctl_hw_snd_feeder_rate_round(SYSCTL_HANDLER_ARGS) int err, val; val = feeder_rate_round; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (val < FEEDRATE_ROUNDHZ_MIN || val > FEEDRATE_ROUNDHZ_MAX) diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index c07e1de..db65989 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -99,7 +99,7 @@ sysctl_hw_snd_sndstat_pid(SYSCTL_HANDLER_ARGS) mtx_lock(&sndstat_lock); val = (int)SNDSTAT_PID(sndstat_dev); mtx_unlock(&sndstat_lock); - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val == 0) { mtx_lock(&sndstat_lock); SNDSTAT_FLUSH(); @@ -120,7 +120,7 @@ sysctl_hw_sndverbose(SYSCTL_HANDLER_ARGS) int error, verbose; verbose = snd_verbose; - error = sysctl_handle_int(oidp, &verbose, sizeof(verbose), req); + error = sysctl_handle_int(oidp, &verbose, 0, req); if (error == 0 && req->newptr != NULL) { mtx_lock(&sndstat_lock); if (verbose < 0 || verbose > 4) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index dee3c99..4f6d078 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -441,7 +441,7 @@ sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS) int error, unit; unit = snd_unit; - error = sysctl_handle_int(oidp, &unit, sizeof(unit), req); + error = sysctl_handle_int(oidp, &unit, 0, req); if (error == 0 && req->newptr != NULL) { d = devclass_get_softc(pcm_devclass, unit); if (d == NULL || CHN_EMPTY(d, channels.pcm)) @@ -462,7 +462,7 @@ sysctl_hw_snd_maxautovchans(SYSCTL_HANDLER_ARGS) int i, v, error; v = snd_maxautovchans; - error = sysctl_handle_int(oidp, &v, sizeof(v), req); + error = sysctl_handle_int(oidp, &v, 0, req); if (error == 0 && req->newptr != NULL) { if (v < 0) v = 0; @@ -840,7 +840,7 @@ sysctl_dev_pcm_clone_flags(SYSCTL_HANDLER_ARGS) pcm_lock(d); flags = snd_clone_getflags(d->clones); pcm_unlock(d); - err = sysctl_handle_int(oidp, (int *)(&flags), sizeof(flags), req); + err = sysctl_handle_int(oidp, &flags, 0, req); if (err == 0 && req->newptr != NULL) { if ((flags & ~SND_CLONE_MASK)) @@ -868,7 +868,7 @@ sysctl_dev_pcm_clone_deadline(SYSCTL_HANDLER_ARGS) pcm_lock(d); deadline = snd_clone_getdeadline(d->clones); pcm_unlock(d); - err = sysctl_handle_int(oidp, &deadline, sizeof(deadline), req); + err = sysctl_handle_int(oidp, &deadline, 0, req); if (err == 0 && req->newptr != NULL) { if (deadline < 0) @@ -894,7 +894,7 @@ sysctl_dev_pcm_clone_gc(SYSCTL_HANDLER_ARGS) return (ENODEV); val = 0; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val != 0) { pcm_lock(d); @@ -912,7 +912,7 @@ sysctl_hw_snd_clone_gc(SYSCTL_HANDLER_ARGS) int i, err, val; val = 0; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val != 0) { for (i = 0; pcm_devclass != NULL && @@ -1275,7 +1275,7 @@ sysctl_hw_snd_vchans(SYSCTL_HANDLER_ARGS) } newcnt = vchancount; - err = sysctl_handle_int(oidp, &newcnt, sizeof(newcnt), req); + err = sysctl_handle_int(oidp, &newcnt, 0, req); if (err == 0 && req->newptr != NULL && vchancount != newcnt) { if (newcnt < 0) diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 8e7c865..28f4a4a 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -577,7 +577,7 @@ sysctl_hw_snd_vchanrate(SYSCTL_HANDLER_ARGS) pcm_inprog(d, -1); return (EINVAL); } - err = sysctl_handle_int(oidp, &newspd, sizeof(newspd), req); + err = sysctl_handle_int(oidp, &newspd, 0, req); if (err == 0 && req->newptr != NULL) { if (newspd < 1 || newspd < feeder_rate_min || newspd > feeder_rate_max) { diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index df568b9..2dd9bc3 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -307,7 +307,7 @@ sysctl_hw_usb_uplcom_interval(SYSCTL_HANDLER_ARGS) int err, val; val = uplcominterval; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (0 < val && val <= 1000) diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index 989f1a8..bef84f8 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -268,7 +268,7 @@ sysctl_hw_usb_uvscom_opktsize(SYSCTL_HANDLER_ARGS) int err, val; val = uvscomobufsiz; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (0 < val && val <= UVSCOMOBUFSIZE) @@ -285,7 +285,7 @@ sysctl_hw_usb_uvscom_interval(SYSCTL_HANDLER_ARGS) int err, val; val = uvscominterval; - err = sysctl_handle_int(oidp, &val, sizeof(val), req); + err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (0 < val && val <= 1000) diff --git a/sys/geom/cache/g_cache.c b/sys/geom/cache/g_cache.c index 60b0254..7be8cb3 100644 --- a/sys/geom/cache/g_cache.c +++ b/sys/geom/cache/g_cache.c @@ -66,7 +66,7 @@ sysctl_handle_pct(SYSCTL_HANDLER_ARGS) u_int val = *(u_int *)arg1; int error; - error = sysctl_handle_int(oidp, &val, sizeof(val), req); + error = sysctl_handle_int(oidp, &val, 0, req); if (error || !req->newptr) return (error); if (val < 0 || val > 100) diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index cd9ffec..6be6580 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -115,7 +115,7 @@ g_journal_record_entries_sysctl(SYSCTL_HANDLER_ARGS) int error; entries = g_journal_record_entries; - error = sysctl_handle_int(oidp, &entries, sizeof(entries), req); + error = sysctl_handle_int(oidp, &entries, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (entries < 1 || entries > GJ_RECORD_HEADER_NENTRIES) @@ -150,7 +150,7 @@ g_journal_cache_limit_sysctl(SYSCTL_HANDLER_ARGS) int error; limit = g_journal_cache_limit; - error = sysctl_handle_int(oidp, &limit, sizeof(limit), req); + error = sysctl_handle_int(oidp, &limit, 0, req); if (error != 0 || req->newptr == NULL) return (error); g_journal_cache_limit = limit; @@ -170,7 +170,7 @@ g_journal_cache_switch_sysctl(SYSCTL_HANDLER_ARGS) int error; cswitch = g_journal_cache_switch; - error = sysctl_handle_int(oidp, &cswitch, sizeof(cswitch), req); + error = sysctl_handle_int(oidp, &cswitch, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (cswitch < 0 || cswitch > 100) diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c index 3bf087f..c059df5 100644 --- a/sys/geom/stripe/g_stripe.c +++ b/sys/geom/stripe/g_stripe.c @@ -80,7 +80,7 @@ g_sysctl_stripe_fast(SYSCTL_HANDLER_ARGS) int error, fast; fast = g_stripe_fast; - error = sysctl_handle_int(oidp, &fast, sizeof(fast), req); + error = sysctl_handle_int(oidp, &fast, 0, req); if (error == 0 && req->newptr != NULL) g_stripe_fast = fast; return (error); diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c index 6556167..45f7c3a 100644 --- a/sys/i386/i386/elan-mmcr.c +++ b/sys/i386/i386/elan-mmcr.c @@ -313,7 +313,7 @@ sysctl_machdep_elan_freq(SYSCTL_HANDLER_ARGS) int error; f = elan_timecounter.tc_frequency * 4; - error = sysctl_handle_int(oidp, &f, sizeof(f), req); + error = sysctl_handle_int(oidp, &f, 0, req); if (error == 0 && req->newptr != NULL) elan_timecounter.tc_frequency = (f + 3) / 4; return (error); diff --git a/sys/i386/i386/mp_clock.c b/sys/i386/i386/mp_clock.c index 2c3dbbb..48264ce 100644 --- a/sys/i386/i386/mp_clock.c +++ b/sys/i386/i386/mp_clock.c @@ -71,7 +71,7 @@ sysctl_machdep_piix_freq(SYSCTL_HANDLER_ARGS) if (piix_timecounter.tc_frequency == 0) return (EOPNOTSUPP); freq = piix_freq; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_int(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) { piix_freq = freq; piix_timecounter.tc_frequency = piix_freq; diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index b2de9fe..f841096 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -228,7 +228,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS) if (tsc_timecounter.tc_frequency == 0) return (EOPNOTSUPP); freq = tsc_freq; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_quad(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) { tsc_freq = freq; tsc_timecounter.tc_frequency = tsc_freq; @@ -237,7 +237,7 @@ sysctl_machdep_tsc_freq(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_QUAD | CTLFLAG_RW, - 0, sizeof(u_int), sysctl_machdep_tsc_freq, "IU", ""); + 0, sizeof(u_int), sysctl_machdep_tsc_freq, "QU", ""); static unsigned tsc_get_timecount(struct timecounter *tc) diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 3125bd1..62c5764 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -838,7 +838,7 @@ sysctl_machdep_i8254_freq(SYSCTL_HANDLER_ARGS) * is is too generic. Should use it everywhere. */ freq = timer_freq; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_int(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) set_timer_freq(freq, hz); return (error); diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 3125bd1..62c5764 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -838,7 +838,7 @@ sysctl_machdep_i8254_freq(SYSCTL_HANDLER_ARGS) * is is too generic. Should use it everywhere. */ freq = timer_freq; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_int(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) set_timer_freq(freq, hz); return (error); diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 5f4882d..8023920 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -118,7 +118,7 @@ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS) int error, newnmbclusters; newnmbclusters = nmbclusters; - error = sysctl_handle_int(oidp, &newnmbclusters, sizeof(int), req); + error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); if (error == 0 && req->newptr) { if (newnmbclusters > nmbclusters) { nmbclusters = newnmbclusters; 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); diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 8b7e0c4..bda9fb7 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"); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 1b6d03b..e2cf09b 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -215,7 +215,7 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS) int error, newmaxsockets; newmaxsockets = maxsockets; - error = sysctl_handle_int(oidp, &newmaxsockets, sizeof(int), req); + error = sysctl_handle_int(oidp, &newmaxsockets, 0, req); if (error == 0 && req->newptr) { if (newmaxsockets > maxsockets) { maxsockets = newmaxsockets; @@ -2770,7 +2770,7 @@ sysctl_somaxconn(SYSCTL_HANDLER_ARGS) int val; val = somaxconn; - error = sysctl_handle_int(oidp, &val, sizeof(int), req); + error = sysctl_handle_int(oidp, &val, 0, req); if (error || !req->newptr ) return (error); diff --git a/sys/netgraph/bluetooth/common/ng_bluetooth.c b/sys/netgraph/bluetooth/common/ng_bluetooth.c index 108e96b..6f6a46e 100644 --- a/sys/netgraph/bluetooth/common/ng_bluetooth.c +++ b/sys/netgraph/bluetooth/common/ng_bluetooth.c @@ -72,7 +72,7 @@ bluetooth_set_hci_command_timeout_value(SYSCTL_HANDLER_ARGS) int error; value = bluetooth_hci_command_timeout_value; - error = sysctl_handle_int(oidp, &value, sizeof(value), req); + error = sysctl_handle_int(oidp, &value, 0, req); if (error == 0 && req->newptr != NULL) { if (value > 0) bluetooth_hci_command_timeout_value = value; @@ -96,7 +96,7 @@ bluetooth_set_hci_connect_timeout_value(SYSCTL_HANDLER_ARGS) int error; value = bluetooth_hci_connect_timeout_value; - error = sysctl_handle_int(oidp, &value, sizeof(value), req); + error = sysctl_handle_int(oidp, &value, 0, req); if (error == 0 && req->newptr != NULL) { if (0 < value && value <= bluetooth_l2cap_rtx_timeout_value) bluetooth_hci_connect_timeout_value = value; @@ -131,7 +131,7 @@ bluetooth_set_l2cap_rtx_timeout_value(SYSCTL_HANDLER_ARGS) int error; value = bluetooth_l2cap_rtx_timeout_value; - error = sysctl_handle_int(oidp, &value, sizeof(value), req); + error = sysctl_handle_int(oidp, &value, 0, req); if (error == 0 && req->newptr != NULL) { if (bluetooth_hci_connect_timeout_value <= value && value <= bluetooth_l2cap_ertx_timeout_value) @@ -156,7 +156,7 @@ bluetooth_set_l2cap_ertx_timeout_value(SYSCTL_HANDLER_ARGS) int error; value = bluetooth_l2cap_ertx_timeout_value; - error = sysctl_handle_int(oidp, &value, sizeof(value), req); + error = sysctl_handle_int(oidp, &value, 0, req); if (error == 0 && req->newptr != NULL) { if (value >= bluetooth_l2cap_rtx_timeout_value) bluetooth_l2cap_ertx_timeout_value = value; diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index ebcc488..4999293 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3299,7 +3299,7 @@ sysctl_debug_ng_dump_items(SYSCTL_HANDLER_ARGS) val = allocated; i = 1; - error = sysctl_handle_int(oidp, &val, sizeof(int), req); + error = sysctl_handle_int(oidp, &val, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (val == 42) { diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index b6279b3..7f4f4fb 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -130,7 +130,7 @@ sysctl_maxtcptw(SYSCTL_HANDLER_ARGS) new = tcptw_auto_size(); else new = maxtcptw; - error = sysctl_handle_int(oidp, &new, sizeof(int), req); + error = sysctl_handle_int(oidp, &new, 0, req); if (error == 0 && req->newptr) if (new >= 32) { maxtcptw = new; diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index 7b8e982..874109a 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -728,7 +728,7 @@ sysctl_machdep_i8254_freq(SYSCTL_HANDLER_ARGS) * is is too generic. Should use it everywhere. */ freq = timer_freq; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_int(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) set_timer_freq(freq, hz); return (error); diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c index 7b8e982..874109a 100644 --- a/sys/pc98/cbus/pcrtc.c +++ b/sys/pc98/cbus/pcrtc.c @@ -728,7 +728,7 @@ sysctl_machdep_i8254_freq(SYSCTL_HANDLER_ARGS) * is is too generic. Should use it everywhere. */ freq = timer_freq; - error = sysctl_handle_int(oidp, &freq, sizeof(freq), req); + error = sysctl_handle_int(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) set_timer_freq(freq, hz); return (error); -- cgit v1.1