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.
This commit is contained in:
parent
df82ff50ed
commit
041b706b2f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170289
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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));
|
||||
|
@ -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", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
2
sys/geom/cache/g_cache.c
vendored
2
sys/geom/cache/g_cache.c
vendored
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user