Thanks for the quick reply!

At Tue, 17 Apr 2001 10:51:48 -0400,
Dan Eischen wrote:
> Akinori MUSHA wrote:
> > Would you take a look at PR#25110 ?  Some programs are suffering with
> > a problem that with the threaded library a process cannot receive due
> > signals except SIGKILL and SIGSTOP from its children and thus it
> > stalls at waitpid() after forking.
> > 
> > The PR precisely describes the underlying cause and points out how you
> > can examine and solve the problem.
> > 
> > I'd appreciate if you or someone else with a clue could deal with it.
> 
> You can try the patch below.  I think I've posted this patch before,
> but I guess I never committed it.

I tested your patch with the latest 4-STABLE and the latest 5-CURRENT,
and both passed my test programs that didn't work before!  Of course,
the test program provided in the PR by Ueno-san also worked properly.

Attached is the patch I used for 4-STABLE.

Now Dan, do you consider sliding it into 4.3-RELEASE?  The problem had
been reported, you recognized and posted a fix, and the fix looks
reasonable and indeed works.  I would be great to see 4.3-RELEASE
shipped with the fork-safe libc_r.

If you are sure it's a mature fix, I'd like you to pester jkh for
approval. :)


Regards,

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Freeze this moment a little bit longer, make each impression
  a little bit stronger..  Experience slips away -- Time stand still"

Index: uthread/uthread_fork.c
===================================================================
RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_fork.c,v
retrieving revision 1.19.2.1
diff -u -r1.19.2.1 uthread_fork.c
--- uthread/uthread_fork.c      2000/11/09 23:46:03     1.19.2.1
+++ uthread/uthread_fork.c      2001/04/17 17:07:43
@@ -32,6 +32,7 @@
  * $FreeBSD: src/lib/libc_r/uthread/uthread_fork.c,v 1.19.2.1 2000/11/09 23:46:03 
deischen Exp $
  */
 #include <errno.h>
+#include <signal.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -108,7 +109,16 @@
                else if (_pq_init(&_readyq) != 0) {
                        /* Abort this application: */
                        PANIC("Cannot initialize priority ready queue.");
-               } else {
+               } else if ((_thread_sigstack.ss_sp == NULL) &&
+                   ((_thread_sigstack.ss_sp = malloc(SIGSTKSZ)) == NULL))
+                       PANIC("Unable to allocate alternate signal stack");
+               else {
+                       /* Install the alternate signal stack: */
+                       _thread_sigstack.ss_size = SIGSTKSZ;
+                       _thread_sigstack.ss_flags = 0;
+                       if (_thread_sys_sigaltstack(&_thread_sigstack, NULL) != 0)
+                               PANIC("Unable to install alternate signal stack");
+
                        /*
                         * Enter a loop to remove all threads other than
                         * the running thread from the thread list:

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

Reply via email to