这篇教程C++ sysctl_handle_int函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sysctl_handle_int函数的典型用法代码示例。如果您正苦于以下问题:C++ sysctl_handle_int函数的具体用法?C++ sysctl_handle_int怎么用?C++ sysctl_handle_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sysctl_handle_int函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: user_frac_sysctlstatic int user_frac_sysctl(SYSCTL_HANDLER_ARGS){ uint32_t val = user_frac; int error; error = sysctl_handle_int(oidp, &val, 0, req); if (error || !req->newptr ) return (error); if (val > 99) return (EINVAL); mtx_lock(&poll_mtx); user_frac = val; mtx_unlock(&poll_mtx); return (0);}
开发者ID:markandrewj,项目名称:freebsd,代码行数:17,
示例2: sysctl_nmbufsstatic intsysctl_nmbufs(SYSCTL_HANDLER_ARGS){ int error, newnmbufs; newnmbufs = nmbufs; error = sysctl_handle_int(oidp, &newnmbufs, 0, req); if (error == 0 && req->newptr && newnmbufs != nmbufs) { if (newnmbufs > nmbufs) { nmbufs = newnmbufs; nmbufs = uma_zone_set_max(zone_mbuf, nmbufs); EVENTHANDLER_INVOKE(nmbufs_change); } else error = EINVAL; } return (error);}
开发者ID:coyizumi,项目名称:cs111,代码行数:17,
示例3: sysctl_zfs_dirty_data_max_percentstatic intsysctl_zfs_dirty_data_max_percent(SYSCTL_HANDLER_ARGS){ int val, err; val = zfs_dirty_data_max_percent; err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (val < 0 || val > 100) return (EINVAL); zfs_dirty_data_max_percent = val; return (0);}
开发者ID:2asoft,项目名称:freebsd,代码行数:17,
示例4: sysctl_machdep_piix_freqstatic intsysctl_machdep_piix_freq(SYSCTL_HANDLER_ARGS){ int error; u_int freq; if (piix_timecounter.tc_frequency == 0) return (EOPNOTSUPP); freq = piix_freq; error = sysctl_handle_int(oidp, &freq, 0, req); if (error == 0 && req->newptr != NULL) { piix_freq = freq; piix_timecounter.tc_frequency = piix_freq; update_timecounter(&piix_timecounter); } return (error);}
开发者ID:victoredwardocallaghan,项目名称:DragonFlyBSD,代码行数:17,
示例5: sysctl_kern_quantumstatic intsysctl_kern_quantum(SYSCTL_HANDLER_ARGS){ int error, new_val, period; period = 1000000 / realstathz; new_val = period * sched_slice; error = sysctl_handle_int(oidp, &new_val, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (new_val <= 0) return (EINVAL); sched_slice = imax(1, (new_val + period / 2) / period); hogticks = imax(1, (2 * hz * sched_slice + realstathz / 2) / realstathz); return (0);}
开发者ID:ornarium,项目名称:freebsd,代码行数:17,
示例6: hatm_sysctl_natm_trafficstatic inthatm_sysctl_natm_traffic(SYSCTL_HANDLER_ARGS){ int error; int tmp; tmp = hatm_natm_traffic; error = sysctl_handle_int(oidp, &tmp, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (tmp != ATMIO_TRAFFIC_UBR && tmp != ATMIO_TRAFFIC_CBR) return (EINVAL); hatm_natm_traffic = tmp; return (0);}
开发者ID:2asoft,项目名称:freebsd,代码行数:17,
示例7: bluetooth_set_hci_connect_timeout_valuestatic intbluetooth_set_hci_connect_timeout_value(SYSCTL_HANDLER_ARGS){ u_int32_t value; int error; value = bluetooth_hci_connect_timeout_value; 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; else error = EINVAL; } return (error);} /* bluetooth_set_hci_connect_timeout_value */
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:17,
示例8: isci_sysctl_reset_remote_device_on_controller1static intisci_sysctl_reset_remote_device_on_controller1(SYSCTL_HANDLER_ARGS){ struct isci_softc *isci = (struct isci_softc *)arg1; uint32_t remote_devices_to_be_reset = 0; struct ISCI_CONTROLLER *controller = &isci->controllers[1]; int error = sysctl_handle_int(oidp, &remote_devices_to_be_reset, 0, req); if (error || remote_devices_to_be_reset == 0) return (error); isci_sysctl_reset_remote_devices(controller, remote_devices_to_be_reset); return (0);}
开发者ID:coyizumi,项目名称:cs111,代码行数:17,
示例9: kdb_sysctl_enterstatic intkdb_sysctl_enter(SYSCTL_HANDLER_ARGS){ int error, i; error = sysctl_wire_old_buffer(req, sizeof(int)); if (error == 0) { i = 0; error = sysctl_handle_int(oidp, &i, 0, req); } if (error != 0 || req->newptr == NULL) return (error); if (kdb_active) return (EBUSY); kdb_enter(KDB_WHY_SYSCTL, "sysctl debug.kdb.enter"); return (0);}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:17,
示例10: sysctl_debug_ddb_capture_bufsize/* * Run-time adjustment of the capture buffer. */static intsysctl_debug_ddb_capture_bufsize(SYSCTL_HANDLER_ARGS){ u_int len, size; char *buf; int error; size = db_capture_bufsize; error = sysctl_handle_int(oidp, &size, 0, req); if (error || req->newptr == NULL) return (error); size = roundup(size, TEXTDUMP_BLOCKSIZE); if (size > db_capture_maxbufsize) return (EINVAL); sx_xlock(&db_capture_sx); if (size != 0) { /* * Potentially the buffer is quite large, so if we can't * allocate it, fail rather than waiting. */ buf = malloc(size, M_DDB_CAPTURE, M_NOWAIT); if (buf == NULL) { sx_xunlock(&db_capture_sx); return (ENOMEM); } len = min(db_capture_bufoff, size); } else { buf = NULL; len = 0; } if (db_capture_buf != NULL && buf != NULL) bcopy(db_capture_buf, buf, len); if (db_capture_buf != NULL) free(db_capture_buf, M_DDB_CAPTURE); db_capture_bufoff = len; db_capture_buf = buf; db_capture_bufsize = size; sx_xunlock(&db_capture_sx); KASSERT(db_capture_bufoff <= db_capture_bufsize, ("sysctl_debug_ddb_capture_bufsize: bufoff > bufsize")); KASSERT(db_capture_bufsize <= db_capture_maxbufsize, ("sysctl_debug_ddb_capture_maxbufsize: bufsize > maxbufsize")); return (0);}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:49,
示例11: ath_sysctl_rfsilentstatic intath_sysctl_rfsilent(SYSCTL_HANDLER_ARGS){ struct ath_softc *sc = arg1; u_int rfsilent; int error; (void) ath_hal_getrfsilent(sc->sc_ah, &rfsilent); error = sysctl_handle_int(oidp, &rfsilent, 0, req); if (error || !req->newptr) return error; if (!ath_hal_setrfsilent(sc->sc_ah, rfsilent)) return EINVAL; sc->sc_rfsilentpin = rfsilent & 0x1c; sc->sc_rfsilentpol = (rfsilent & 0x2) != 0; return 0;}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:17,
示例12: sysctl_nmbclustersstatic intsysctl_nmbclusters(SYSCTL_HANDLER_ARGS){ int error, newnmbclusters; newnmbclusters = nmbclusters; error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); if (error == 0 && req->newptr) { if (newnmbclusters > nmbclusters) { nmbclusters = newnmbclusters; uma_zone_set_max(zone_clust, nmbclusters); EVENTHANDLER_INVOKE(nmbclusters_change); } else error = EINVAL; } return (error);}
开发者ID:amitkumaar,项目名称:osv,代码行数:17,
示例13: sysctl_zfs_delay_min_dirty_percentstatic intsysctl_zfs_delay_min_dirty_percent(SYSCTL_HANDLER_ARGS){ int val, err; val = zfs_delay_min_dirty_percent; err = sysctl_handle_int(oidp, &val, 0, req); if (err != 0 || req->newptr == NULL) return (err); if (val < zfs_vdev_async_write_active_max_dirty_percent) return (EINVAL); zfs_delay_min_dirty_percent = val; return (0);}
开发者ID:2asoft,项目名称:freebsd,代码行数:17,
示例14: sysctl_nmbjumbo16static intsysctl_nmbjumbo16(SYSCTL_HANDLER_ARGS){ int error, newnmbjumbo16; newnmbjumbo16 = nmbjumbo16; error = sysctl_handle_int(oidp, &newnmbjumbo16, 0, req); if (error == 0 && req->newptr && newnmbjumbo16 != nmbjumbo16) { if (newnmbjumbo16 > nmbjumbo16 && nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbjumbo16 = newnmbjumbo16; nmbjumbo16 = uma_zone_set_max(zone_jumbo16, nmbjumbo16); } else error = EINVAL; } return (error);}
开发者ID:coyizumi,项目名称:cs111,代码行数:17,
示例15: isci_sysctl_coalesce_numberstatic intisci_sysctl_coalesce_number(SYSCTL_HANDLER_ARGS){ struct isci_softc *isci = (struct isci_softc *)arg1; int error = sysctl_handle_int(oidp, &isci->coalesce_number, 0, req); int i; if (error) return (error); for (i = 0; i < isci->controller_count; i++) scif_controller_set_interrupt_coalescence( isci->controllers[i].scif_controller_handle, isci->coalesce_number, isci->coalesce_timeout); return (0);}
开发者ID:coyizumi,项目名称:cs111,代码行数:17,
示例16: sysctl_kern_securelvlstatic intsysctl_kern_securelvl(SYSCTL_HANDLER_ARGS){ struct prison *pr; int error, level; pr = req->td->td_ucred->cr_prison; /* * If the process is in jail, return the maximum of the global and * local levels; otherwise, return the global level. Perform a * lockless read since the securelevel is an integer. */ if (pr != NULL) level = imax(securelevel, pr->pr_securelevel); else level = securelevel; error = sysctl_handle_int(oidp, &level, 0, req); if (error || !req->newptr) return (error); /* * Permit update only if the new securelevel exceeds the * global level, and local level if any. */ if (pr != NULL) { mtx_lock(&pr->pr_mtx); if (!regression_securelevel_nonmonotonic && (level < imax(securelevel, pr->pr_securelevel))) { mtx_unlock(&pr->pr_mtx); return (EPERM); } pr->pr_securelevel = level; mtx_unlock(&pr->pr_mtx); } else { mtx_lock(&securelevel_mtx); if (!regression_securelevel_nonmonotonic && (level < securelevel)) { mtx_unlock(&securelevel_mtx); return (EPERM); } securelevel = level; mtx_unlock(&securelevel_mtx); } return (error);}
开发者ID:michas2,项目名称:l4re-snapshot,代码行数:45,
示例17: nvme_sysctl_timeout_periodstatic intnvme_sysctl_timeout_period(SYSCTL_HANDLER_ARGS){ struct nvme_controller *ctrlr = arg1; uint32_t oldval = ctrlr->timeout_period; int error = sysctl_handle_int(oidp, &ctrlr->timeout_period, 0, req); if (error) return (error); if (ctrlr->timeout_period > NVME_MAX_TIMEOUT_PERIOD || ctrlr->timeout_period < NVME_MIN_TIMEOUT_PERIOD) { ctrlr->timeout_period = oldval; return (EINVAL); } return (0);}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:18,
示例18: zy7_devcfg_sysctl_pl_done/* zy7_devcfg_sysctl_pl_done() returns status of the PL_DONE signal. */static intzy7_devcfg_sysctl_pl_done(SYSCTL_HANDLER_ARGS){ struct zy7_devcfg_softc *sc = zy7_devcfg_softc_p; int pl_done = 0; if (sc) { DEVCFG_SC_LOCK(sc); /* PCFG_DONE bit is sticky. Clear it before checking it. */ WR4(sc, ZY7_DEVCFG_INT_STATUS, ZY7_DEVCFG_INT_PCFG_DONE); pl_done = ((RD4(sc, ZY7_DEVCFG_INT_STATUS) & ZY7_DEVCFG_INT_PCFG_DONE) != 0); DEVCFG_SC_UNLOCK(sc); } return (sysctl_handle_int(oidp, &pl_done, 0, req));}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:20,
示例19: zy7_devcfg_fclk_sysctl_level_shiftersstatic intzy7_devcfg_fclk_sysctl_level_shifters(SYSCTL_HANDLER_ARGS){ int error, enabled; enabled = zy7_pl_level_shifters_enabled(); error = sysctl_handle_int(oidp, &enabled, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (enabled) zy7_pl_level_shifters_enable(); else zy7_pl_level_shifters_disable(); return (0);}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:18,
示例20: efi_time_sysctl_handler/* XXX debug stuff */static intefi_time_sysctl_handler(SYSCTL_HANDLER_ARGS){ struct efi_tm tm; int error, val; val = 0; error = sysctl_handle_int(oidp, &val, 0, req); if (error != 0 || req->newptr == NULL) return (error); error = efi_get_time(&tm); if (error == 0) { uprintf("EFI reports: Year %d Month %d Day %d Hour %d Min %d " "Sec %d/n", tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); } return (error);}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:19,
示例21: nvme_sysctl_int_coal_timestatic intnvme_sysctl_int_coal_time(SYSCTL_HANDLER_ARGS){ struct nvme_controller *ctrlr = arg1; uint32_t oldval = ctrlr->int_coal_time; int error = sysctl_handle_int(oidp, &ctrlr->int_coal_time, 0, req); if (error) return (error); if (oldval != ctrlr->int_coal_time) nvme_ctrlr_cmd_set_interrupt_coalescing(ctrlr, ctrlr->int_coal_time, ctrlr->int_coal_threshold, NULL, NULL); return (0);}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:18,
示例22: isci_sysctl_fail_on_task_timeoutstatic intisci_sysctl_fail_on_task_timeout(SYSCTL_HANDLER_ARGS){ struct isci_softc *isci = (struct isci_softc *)arg1; int32_t fail_on_timeout; int error, i; fail_on_timeout = isci->controllers[0].fail_on_task_timeout; error = sysctl_handle_int(oidp, &fail_on_timeout, 0, req); if (error || req->newptr == NULL) return (error); for (i = 0; i < isci->controller_count; i++) isci->controllers[i].fail_on_task_timeout = fail_on_timeout; return (0);}
开发者ID:coyizumi,项目名称:cs111,代码行数:18,
示例23: ath_sysctl_rfkillstatic intath_sysctl_rfkill(SYSCTL_HANDLER_ARGS){ struct ath_softc *sc = arg1; struct ifnet *ifp = sc->sc_ifp; struct ath_hal *ah = sc->sc_ah; u_int rfkill = ath_hal_getrfkill(ah); int error; error = sysctl_handle_int(oidp, &rfkill, 0, req); if (error || !req->newptr) return error; if (rfkill == ath_hal_getrfkill(ah)) /* unchanged */ return 0; if (!ath_hal_setrfkill(ah, rfkill)) return EINVAL; return (ifp->if_drv_flags & IFF_DRV_RUNNING) ? ath_reset(ifp) : 0;}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:18,
示例24: uhso_radio_sysctlstatic intuhso_radio_sysctl(SYSCTL_HANDLER_ARGS){ struct uhso_softc *sc = arg1; int error, radio; radio = sc->sc_radio; error = sysctl_handle_int(oidp, &radio, 0, req); if (error) return (error); if (radio != sc->sc_radio) { radio = radio != 0 ? 1 : 0; error = uhso_radio_ctrl(sc, radio); if (error != -1) sc->sc_radio = radio; } return (0);}
开发者ID:vkhromov,项目名称:freebsd,代码行数:19,
示例25: sysctl_emergency_enable/* * Sysctl support routines */static intsysctl_emergency_enable(SYSCTL_HANDLER_ARGS){ int error, enabled, cpuid, freq; enabled = emergency_intr_enable; error = sysctl_handle_int(oidp, &enabled, 0, req); if (error || req->newptr == NULL) return error; emergency_intr_enable = enabled; if (emergency_intr_enable) freq = emergency_intr_freq; else freq = 1; for (cpuid = 0; cpuid < ncpus; ++cpuid) systimer_adjust_periodic(&emergency_intr_timer[cpuid], freq); return 0;}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:22,
示例26: sysctl_bless_preemptstatic intsysctl_bless_preempt( struct sysctl_oid *oidp, struct sysctl_req *req ){ int error = 0; int value = 0; /* get the old value and process it */ value = blessed_preempt; /* copy out the old value, get the new value */ error = sysctl_handle_int(oidp, &value, 0, req); if (error || !req->newptr) return (error); /* if that worked, and we're writing... */ blessed_preempt = value ? TRUE : FALSE; return 0;}
开发者ID:TalAloni,项目名称:xnu,代码行数:19,
示例27: sysctl_pet_idle_ratestatic intsysctl_pet_idle_rate( struct sysctl_oid *oidp, struct sysctl_req *req ){ int error = 0; int value = 0; /* get the old value and process it */ value = kperf_get_pet_idle_rate(); /* copy out the old value, get the new value */ error = sysctl_handle_int(oidp, &value, 0, req); if (error || !req->newptr) return (error); /* if that worked, and we're writing... */ kperf_set_pet_idle_rate(value); return error;}
开发者ID:TalAloni,项目名称:xnu,代码行数:19,
注:本文中的sysctl_handle_int函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sysctlbyname函数代码示例 C++ sysctl_ctx_init函数代码示例 |