diff options
author | jhb <jhb@FreeBSD.org> | 2002-10-15 00:03:40 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-10-15 00:03:40 +0000 |
commit | db8a406c24025647789a4d21484a3b79c09714f9 (patch) | |
tree | 015b6beb5c92a9e342e0fb9d658951a73b39a574 /sys | |
parent | f8f30374ddd0a6d37b7438b44638f61a76fd8471 (diff) | |
download | FreeBSD-src-db8a406c24025647789a4d21484a3b79c09714f9.zip FreeBSD-src-db8a406c24025647789a4d21484a3b79c09714f9.tar.gz |
Remove the leaderp variable and just access p_leader directly. The
p_leader field is not protected by the proc lock but is only set during
fork1() by the parent process and never changes.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_descrip.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index b464caf..ce7ae77 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -258,7 +258,6 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) struct flock *flp; int tmp, error = 0, flg = F_POSIX; u_int newmin; - struct proc *leaderp; mtx_lock(&Giant); @@ -379,9 +378,8 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) } PROC_LOCK(p); p->p_flag |= P_ADVLOCK; - leaderp = p->p_leader; PROC_UNLOCK(p); - error = VOP_ADVLOCK(vp, (caddr_t)leaderp, F_SETLK, + error = VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_SETLK, flp, flg); break; case F_WRLCK: @@ -389,18 +387,11 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) error = EBADF; break; } - PROC_LOCK(p); - p->p_flag |= P_ADVLOCK; - leaderp = p->p_leader; - PROC_UNLOCK(p); - error = VOP_ADVLOCK(vp, (caddr_t)leaderp, F_SETLK, flp, + error = VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_SETLK, flp, flg); break; case F_UNLCK: - PROC_LOCK(p); - leaderp = p->p_leader; - PROC_UNLOCK(p); - error = VOP_ADVLOCK(vp, (caddr_t)leaderp, F_UNLCK, flp, + error = VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_UNLCK, flp, F_POSIX); break; default: |