From a09da298590e8c11ebafa37f79e0046814665237 Mon Sep 17 00:00:00 2001 From: tanimura Date: Sat, 23 Feb 2002 11:12:57 +0000 Subject: Lock struct pgrp, session and sigio. New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current) --- sys/kern/sys_process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/kern/sys_process.c') diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 018734e..e15f191 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -515,10 +515,10 @@ ptrace(struct thread *td, struct ptrace_args *uap) struct proc *pp; pp = pfind(p->p_oppid); - if (pp != NULL) - PROC_UNLOCK(pp); - else + if (pp == NULL) pp = initproc; + else + PROC_UNLOCK(pp); PROC_LOCK(p); proc_reparent(p, pp); } else -- cgit v1.1