Re: signals still broken ?

2003-02-26 Thread Tim Robbins
On Thu, Feb 27, 2003 at 01:10:03AM +1100, Tim Robbins wrote:
> 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:
[...]

Never mind, I guess David beat me to it (kern_sig.c 1.211).


Tim

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


Re: signals still broken ?

2003-02-26 Thread Tim Robbins
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 -  1.210
+++ kern_sig.c  26 Feb 2003 13:41:01 -
@@ -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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message