From owner-freebsd-current Wed Feb 26 6:10:15 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6CD1037B401; Wed, 26 Feb 2003 06:10:13 -0800 (PST) Received: from smtp02.syd.iprimus.net.au (smtp02.syd.iprimus.net.au [210.50.76.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6418843F85; Wed, 26 Feb 2003 06:10:12 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au ([210.50.201.21]) by smtp02.syd.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Thu, 27 Feb 2003 01:10:10 +1100 Received: from dilbert.robbins.dropbear.id.au (vpxm25uwjrweq9yg@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id h1QEA5n1053408; Thu, 27 Feb 2003 01:10:05 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id h1QEA4AB053407; Thu, 27 Feb 2003 01:10:04 +1100 (EST) (envelope-from tim) Date: Thu, 27 Feb 2003 01:10:03 +1100 From: Tim Robbins To: Mike Makonnen Cc: julian@FreeBSD.ORG, freebsd-current@FreeBSD.ORG Subject: Re: signals still broken ? Message-ID: <20030227011003.A53053@dilbert.robbins.dropbear.id.au> References: <20030226112543.ISTQ16831.out001.verizon.net@kokeb.ambesa.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030226112543.ISTQ16831.out001.verizon.net@kokeb.ambesa.net>; from mtm@identd.net on Wed, Feb 26, 2003 at 06:25:39AM -0500 X-OriginalArrivalTime: 26 Feb 2003 14:10:10.0754 (UTC) FILETIME=[C6149A20:01C2DDA0] Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Feb 26, 2003 at 06:25:39AM -0500, Mike Makonnen wrote: > The following program is stuck in pause(3) forever. I have reproduced the bug in > 5.0-RELEASE, but 4.7-STABLE behaves as expected: the child resumes upon > receiving SIGCONT. I spent a while trying to decipher the 5.x signal code and I think I have spotted the code responsible for the difference in behaviour between 5.x and 4.7. The difference is that 5.x drops SIGCONT when the process is already "active" even when a handler is installed for that signal. Here is a patch to try: Do not drop SIGCONT signals when a process is not stopped and has installed a handler for that signal. Index: kern_sig.c =================================================================== RCS file: /x/freebsd/src/sys/kern/kern_sig.c,v retrieving revision 1.210 diff -u -r1.210 kern_sig.c --- kern_sig.c 17 Feb 2003 09:58:11 -0000 1.210 +++ kern_sig.c 26 Feb 2003 13:41:01 -0000 @@ -1483,10 +1483,7 @@ * eventually hit thread_suspend_check(). */ } else if (p->p_state == PRS_NORMAL) { - if (prop & SA_CONT) { - /* - * Already active, don't need to start again. - */ + if ((prop & SA_CONT) && action == SIG_DFL) { SIGDELSET(p->p_siglist, sig); goto out; } With this patch applied, your test program seems to work properly except that wait() is called incorrectly (1st arg should be a pointer): $ ./a.out sleeping 3s waiting a.out: wait(): Bad address Let me know whether it works for you. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message