diff options
author | jhb <jhb@FreeBSD.org> | 2001-04-24 00:51:53 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-04-24 00:51:53 +0000 |
commit | 9c03a8ae91e06e47f0c59996ef0e2300e231e101 (patch) | |
tree | ec00c764b1eb58ed4297070edb5806ffd7ca4765 /sys/posix4 | |
parent | 383dd0a2656889604bb7eb71b993875024ddd832 (diff) | |
download | FreeBSD-src-9c03a8ae91e06e47f0c59996ef0e2300e231e101.zip FreeBSD-src-9c03a8ae91e06e47f0c59996ef0e2300e231e101.tar.gz |
Change the pfind() and zpfind() functions to lock the process that they
find before releasing the allproc lock and returning.
Reviewed by: -smp, dfr, jake
Diffstat (limited to 'sys/posix4')
-rw-r--r-- | sys/posix4/p1003_1b.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/posix4/p1003_1b.c b/sys/posix4/p1003_1b.c index 860176a..0d1fd0e 100644 --- a/sys/posix4/p1003_1b.c +++ b/sys/posix4/p1003_1b.c @@ -87,9 +87,10 @@ int p31b_proc(struct proc *p, pid_t pid, struct proc **pp) int ret = 0; struct proc *other_proc = 0; - if (pid == 0) + if (pid == 0) { other_proc = p; - else + PROC_LOCK(p); + } else other_proc = pfind(pid); if (other_proc) @@ -100,6 +101,7 @@ int p31b_proc(struct proc *p, pid_t pid, struct proc **pp) *pp = other_proc; else ret = EPERM; + PROC_UNLOCK(other_proc); } else ret = ESRCH; |