diff options
author | jake <jake@FreeBSD.org> | 2000-11-22 07:42:04 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2000-11-22 07:42:04 +0000 |
commit | 0c0be4e82677a2d8fb49b7a70676bf359e7360b0 (patch) | |
tree | a0c32260edfde6d861e66b11172147608684043e /sys/vm/vm_meter.c | |
parent | 1b544875743d53491a096b0c757bf30ce73bb83b (diff) | |
download | FreeBSD-src-0c0be4e82677a2d8fb49b7a70676bf359e7360b0.zip FreeBSD-src-0c0be4e82677a2d8fb49b7a70676bf359e7360b0.tar.gz |
Protect the following with a lockmgr lock:
allproc
zombproc
pidhashtbl
proc.p_list
proc.p_hash
nextpid
Reviewed by: jhb
Obtained from: BSD/OS and netbsd
Diffstat (limited to 'sys/vm/vm_meter.c')
-rw-r--r-- | sys/vm/vm_meter.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 8b68a65..9ed122e 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -78,6 +78,7 @@ loadav(struct loadavg *avg) register int i, nrun; register struct proc *p; + lockmgr(&allproc_lock, LK_SHARED, NULL, CURPROC); for (nrun = 0, p = allproc.lh_first; p != 0; p = p->p_list.le_next) { switch (p->p_stat) { case SSLEEP: @@ -92,6 +93,7 @@ loadav(struct loadavg *avg) nrun++; } } + lockmgr(&allproc_lock, LK_RELEASE, NULL, CURPROC); for (i = 0; i < 3; i++) avg->ldavg[i] = (cexp[i] * avg->ldavg[i] + nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT; @@ -149,6 +151,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) /* * Calculate process statistics. */ + lockmgr(&allproc_lock, LK_SHARED, NULL, CURPROC); for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) { if (p->p_flag & P_SYSTEM) continue; @@ -199,6 +202,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) if (paging) totalp->t_pw++; } + lockmgr(&allproc_lock, LK_RELEASE, NULL, CURPROC); /* * Calculate object memory usage statistics. */ |