summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2000-12-13 00:17:05 +0000
committerjake <jake@FreeBSD.org>2000-12-13 00:17:05 +0000
commita4ad237eaa665b78919b8ff019591629b59df5e9 (patch)
tree43d22ede99071cd294fded182b591a4a3cb8d414 /sys/compat
parent825aa5c1b32389b54f15847261348e090c31b7fc (diff)
downloadFreeBSD-src-a4ad237eaa665b78919b8ff019591629b59df5e9.zip
FreeBSD-src-a4ad237eaa665b78919b8ff019591629b59df5e9.tar.gz
- Change the allproc_lock to use a macro, ALLPROC_LOCK(how), instead
of explicit calls to lockmgr. Also provides macros for the flags pased to specify shared, exclusive or release which map to the lockmgr flags. This is so that the use of lockmgr can be easily replaced with optimized reader-writer locks. - Add some locking that I missed the first time.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/svr4/svr4_misc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 4d921b5..601d205 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -953,16 +953,19 @@ svr4_pfind(pid)
{
struct proc *p;
+ ALLPROC_LOCK(AP_SHARED);
/* look in the live processes */
if ((p = pfind(pid)) != NULL)
- return p;
+ goto out;
/* look in the zombies */
for (p = zombproc.lh_first; p != 0; p = p->p_list.le_next)
if (p->p_pid == pid)
- return p;
+ break;
+out:
+ ALLPROC_LOCK(AP_RELEASE);
- return NULL;
+ return p;
}
@@ -1253,7 +1256,9 @@ loop:
*/
leavepgrp(q);
+ ALLPROC_LOCK(AP_EXCLUSIVE);
LIST_REMOVE(q, p_list); /* off zombproc */
+ ALLPROC_LOCK(AP_RELEASE);
LIST_REMOVE(q, p_sibling);
OpenPOWER on IntegriCloud