diff options
author | rwatson <rwatson@FreeBSD.org> | 2002-04-02 05:50:07 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2002-04-02 05:50:07 +0000 |
commit | 219837a0a6384deaae3b7cc8131d0e842418ef7a (patch) | |
tree | 662cd4e2bee1c31cd440d11512e35afab5978775 /sys | |
parent | 4a45f236cfb604c94da7c6141a80604c469b34f6 (diff) | |
download | FreeBSD-src-219837a0a6384deaae3b7cc8131d0e842418ef7a.zip FreeBSD-src-219837a0a6384deaae3b7cc8131d0e842418ef7a.tar.gz |
Update comment regarding the locking of the sysctl tree.
Rename memlock to sysctllock, and MEMLOCK()/MEMUNLOCK() to SYSCTL_LOCK()/
SYSCTL_UNLOCK() and related changes to make the lock names make more
sense.
Submitted by: Jonathan Mini <mini@haikugeek.com>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_sysctl.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index e3e1bc6..6943bc5 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -59,13 +59,13 @@ static MALLOC_DEFINE(M_SYSCTL, "sysctl", "sysctl internal magic"); static MALLOC_DEFINE(M_SYSCTLOID, "sysctloid", "sysctl dynamic oids"); /* - * Locking and stats + * Locking - this locks the sysctl tree in memory. */ -static struct sx memlock; +static struct sx sysctllock; -#define MEMLOCK_LOCK() sx_xlock(&memlock) -#define MEMLOCK_UNLOCK() sx_xunlock(&memlock) -#define MEMLOCK_INIT() sx_init(&memlock, "sysctl memlock") +#define SYSCTL_LOCK() sx_xlock(&sysctllock) +#define SYSCTL_UNLOCK() sx_xunlock(&sysctllock) +#define SYSCTL_INIT() sx_init(&sysctllock, "sysctl sysctllock") static int sysctl_root(SYSCTL_HANDLER_ARGS); @@ -397,7 +397,7 @@ sysctl_register_all(void *arg) { struct sysctl_oid **oidp; - MEMLOCK_INIT(); + SYSCTL_INIT(); SET_FOREACH(oidp, sysctl_set) sysctl_register_oid(*oidp); } @@ -901,14 +901,14 @@ kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old, req.newfunc = sysctl_new_kernel; req.lock = 1; - MEMLOCK_LOCK(); + SYSCTL_LOCK(); error = sysctl_root(0, name, namelen, &req); if (req.lock == 2) vsunlock(req.oldptr, req.oldlen); - MEMLOCK_UNLOCK(); + SYSCTL_UNLOCK(); if (error && error != ENOMEM) return (error); @@ -1178,7 +1178,7 @@ userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, req.newfunc = sysctl_new_user; req.lock = 1; - MEMLOCK_LOCK(); + SYSCTL_LOCK(); do { req2 = req; @@ -1189,7 +1189,7 @@ userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, if (req.lock == 2) vsunlock(req.oldptr, req.oldlen); - MEMLOCK_UNLOCK(); + SYSCTL_UNLOCK(); if (error && error != ENOMEM) return (error); |