From owner-p4-projects Wed May 8 8:33:19 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D5E6037B408; Wed, 8 May 2002 08:33:04 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0D7A137B407 for ; Wed, 8 May 2002 08:33:04 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g48FX3q20811 for perforce@freebsd.org; Wed, 8 May 2002 08:33:03 -0700 (PDT) (envelope-from mini@freebsd.org) Date: Wed, 8 May 2002 08:33:03 -0700 (PDT) Message-Id: <200205081533.g48FX3q20811@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to mini@freebsd.org using -f From: Jonathan Mini Subject: PERFORCE change 11012 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11012 Change 11012 by mini@mini_stylus on 2002/05/08 08:32:05 - pass thread's instead of proc's to CURSIG() and issignal() - mark a thread TDS_UNQUEUED when blocking it while its parent handles its signal (via ptrace(2)). This make gdb work properly again, and fixed ptrace(2) on normal processes. Affected files ... ... //depot/projects/kse/sys/kern/kern_condvar.c#32 edit ... //depot/projects/kse/sys/kern/kern_sig.c#47 edit ... //depot/projects/kse/sys/kern/kern_synch.c#58 edit ... //depot/projects/kse/sys/kern/subr_trap.c#52 edit ... //depot/projects/kse/sys/sys/signalvar.h#11 edit Differences ... ==== //depot/projects/kse/sys/kern/kern_condvar.c#32 (text+ko) ==== @@ -178,7 +178,7 @@ mtx_unlock_spin(&sched_lock); p = td->td_proc; PROC_LOCK(p); - sig = CURSIG(p); /* XXXKSE */ + sig = CURSIG(td); /* XXXKSE */ if (thread_suspend_check(1)) sig = SIGSTOP; mtx_lock_spin(&sched_lock); @@ -322,7 +322,7 @@ PROC_LOCK(p); if (sig == 0) - sig = CURSIG(p); /* XXXKSE */ + sig = CURSIG(td); /* XXXKSE */ if (sig != 0) { if (SIGISMEMBER(p->p_sigacts->ps_sigintr, sig)) rval = EINTR; @@ -482,7 +482,7 @@ PROC_LOCK(p); if (sig == 0) - sig = CURSIG(p); + sig = CURSIG(td); if (sig != 0) { if (SIGISMEMBER(p->p_sigacts->ps_sigintr, sig)) rval = EINTR; ==== //depot/projects/kse/sys/kern/kern_sig.c#47 (text+ko) ==== @@ -172,12 +172,13 @@ * MP SAFE. */ int -CURSIG(struct proc *p) +CURSIG(struct thread *td) { + struct proc *p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); mtx_assert(&sched_lock, MA_NOTOWNED); - return (SIGPENDING(p) ? issignal(p) : 0); + return (SIGPENDING(p) ? issignal(td) : 0); } /* @@ -1590,13 +1591,14 @@ * by checking the pending signal masks in the CURSIG macro.) The normal call * sequence is * - * while (sig = CURSIG(curproc)) + * while (sig = CURSIG(curthread)) * postsig(sig); */ int -issignal(p) - register struct proc *p; +issignal(td) + struct thread *td; { + struct proc *p = td->td_proc; sigset_t mask; register int sig, prop; @@ -1635,6 +1637,7 @@ do { mtx_lock_spin(&sched_lock); stop(p); + td->td_state = TDS_UNQUEUED; PROC_UNLOCK(p); DROP_GIANT(); p->p_stats->p_ru.ru_nivcsw++; ==== //depot/projects/kse/sys/kern/kern_synch.c#58 (text+ko) ==== @@ -518,7 +518,7 @@ td->td_flags |= TDF_SINTR; mtx_unlock_spin(&sched_lock); PROC_LOCK(p); - sig = CURSIG(p); + sig = CURSIG(td); if (thread_suspend_check(1)) { sig = EINTR; rval = EINTR; @@ -566,7 +566,7 @@ if (rval == 0 && catch) { PROC_LOCK(p); /* XXX: shouldn't we always be calling CURSIG() */ - if (sig != 0 || (sig = CURSIG(p))) { + if (sig != 0 || (sig = CURSIG(td))) { if (SIGISMEMBER(p->p_sigacts->ps_sigintr, sig)) rval = EINTR; else @@ -898,6 +898,7 @@ cv_waitq_remove(td); else unsleep(td); + case TDS_UNQUEUED: /* being put back onto the queue */ case TDS_NEW: /* not yet had time to suspend */ case TDS_RUNQ: /* not yet had time to suspend */ break; ==== //depot/projects/kse/sys/kern/subr_trap.c#52 (text+ko) ==== @@ -343,7 +343,7 @@ if (sflag & PS_NEEDSIGCHK) { mtx_lock(&Giant); PROC_LOCK(p); - while ((sig = CURSIG(p)) != 0) + while ((sig = CURSIG(td)) != 0) postsig(sig); PROC_UNLOCK(p); mtx_unlock(&Giant); ==== //depot/projects/kse/sys/sys/signalvar.h#11 (text+ko) ==== @@ -234,10 +234,10 @@ /* * Machine-independent functions: */ -int CURSIG(struct proc *p); +int CURSIG(struct thread *td); void execsigs(struct proc *p); void gsignal(int pgid, int sig); -int issignal(struct proc *p); +int issignal(struct thread *p); void killproc(struct proc *p, char *why); void pgsigio(struct sigio **, int signum, int checkctty); void pgsignal(struct pgrp *pgrp, int sig, int checkctty); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message