Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_sysctl.c
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
static MALLOC_DEFINE(M_SYSCTL, "sysctl", "sysctl internal magic"); | static MALLOC_DEFINE(M_SYSCTL, "sysctl", "sysctl internal magic"); | ||||
static MALLOC_DEFINE(M_SYSCTLOID, "sysctloid", "sysctl dynamic oids"); | static MALLOC_DEFINE(M_SYSCTLOID, "sysctloid", "sysctl dynamic oids"); | ||||
static MALLOC_DEFINE(M_SYSCTLTMP, "sysctltmp", "sysctl temp output buffer"); | static MALLOC_DEFINE(M_SYSCTLTMP, "sysctltmp", "sysctl temp output buffer"); | ||||
/* | /* | ||||
* The sysctllock protects the MIB tree. It also protects sysctl | * The sysctllock protects the MIB tree. It also protects sysctl | ||||
* contexts used with dynamic sysctls. The sysctl_register_oid() and | * contexts used with dynamic sysctls. The sysctl_register_oid() and | ||||
* sysctl_unregister_oid() routines require the sysctllock to already | * sysctl_unregister_oid() routines require the sysctllock to already | ||||
* be held, so the sysctl_wlock() and sysctl_wunlock() routines are | * be held, so the sysctl_wlock(), sysctl_wunlock(), sysctl_rlock() and | ||||
* provided for the few places in the kernel which need to use that | * sysctl_runlock() routines are provided for the few places in the kernel | ||||
* API rather than using the dynamic API. Use of the dynamic API is | * which need to use that API rather than using the dynamic API. | ||||
* strongly encouraged for most code. | * Use of the dynamic API is strongly encouraged for most code. | ||||
* | * | ||||
* The sysctlmemlock is used to limit the amount of user memory wired for | * The sysctlmemlock is used to limit the amount of user memory wired for | ||||
* sysctl requests. This is implemented by serializing any userland | * sysctl requests. This is implemented by serializing any userland | ||||
* sysctl requests larger than a single page via an exclusive lock. | * sysctl requests larger than a single page via an exclusive lock. | ||||
*/ | */ | ||||
static struct rmlock sysctllock; | static struct rmlock sysctllock; | ||||
static struct sx __exclusive_cache_line sysctlmemlock; | static struct sx __exclusive_cache_line sysctlmemlock; | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | sysctl_wlock(void) | ||||
SYSCTL_WLOCK(); | SYSCTL_WLOCK(); | ||||
} | } | ||||
void | void | ||||
sysctl_wunlock(void) | sysctl_wunlock(void) | ||||
{ | { | ||||
SYSCTL_WUNLOCK(); | SYSCTL_WUNLOCK(); | ||||
} | |||||
void | |||||
sysctl_rlock(struct rm_priotracker *tracker) | |||||
{ | |||||
SYSCTL_RLOCK(tracker); | |||||
} | |||||
void | |||||
sysctl_runlock(struct rm_priotracker *tracker) | |||||
{ | |||||
SYSCTL_RUNLOCK(tracker); | |||||
} | } | ||||
static int | static int | ||||
sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, intmax_t arg2, | sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, intmax_t arg2, | ||||
struct sysctl_req *req, struct rm_priotracker *tracker) | struct sysctl_req *req, struct rm_priotracker *tracker) | ||||
{ | { | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 2,680 Lines • Show Last 20 Lines |