diff options
author | John Baldwin <jhb@FreeBSD.org> | 2001-04-24 00:51:53 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2001-04-24 00:51:53 +0000 |
commit | 33a9ed9d0e26ec60b5237d33dc09026841b9bf67 (patch) | |
tree | 13737902646621a419ff2787450af6795c4f8f66 /sys/posix4 | |
parent | 5d69bac493abc8ca9f35ca358987efbe2cbb2a91 (diff) | |
download | src-33a9ed9d0e26ec60b5237d33dc09026841b9bf67.tar.gz src-33a9ed9d0e26ec60b5237d33dc09026841b9bf67.zip |
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
Notes
Notes:
svn path=/head/; revision=75893
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 860176a8e25f..0d1fd0e08506 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; |