Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 May 2013 12:14:51 +0200
From:      vilibald wanca <vilibald.wanca@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: signal vs. sigaction and SIGCHLD
Message-ID:  <CANRpF5eMidvX0qk_TAE-yiw1EhGgdX3qsjwj8%2Be%2Bv7F-RAV40w@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Doesn't wait call suspend the calling process until the child is terminated?
>From man page for wait:

 The wait() function suspends execution of its calling process until
     status information is available for a terminated child process

But in your case the child process is not terminated. If you use the same
pid = waitpid(-1, &tstat, WUNTRACED); in case of  signal you'll get
the same result as with sigaction, or that's what I suspect to happen,
haven't had a chance test it.

Vilda


2013/5/21 Polytropon <freebsd@edvax.de>
>
> On Tue, 21 May 2013 15:24:26 +1000, Noel Hunt wrote:
> > If I recompile with `#undef SIGACTION', waithandler is not
> > called.
> >
> > I should add that even with the sigaction(2) interface, without
> > the `sigprocmask' call, it still doesn't work, which suggests
> > that SIGCHLD is being blocked.
> >
> > Can anyone explain why?
>
> From reading "man 3 signal", I get the following impression:
>
>      No    Name         Default Action       Description
>      20    SIGCHLD      discard signal       child status has changed
>
> The default action is to discard the signal, so the following
> paragraph could make sense:
>
>      The sig argument specifies which signal was received.  The func procedure
>      allows a user to choose the action upon receipt of a signal.  To set the
>      default action of the signal to occur as listed above, func should be
>      SIG_DFL.  A SIG_DFL resets the default action.  To ignore the signal func
>      should be SIG_IGN.  This will cause subsequent instances of the signal to
>      be ignored and pending instances to be discarded.  If SIG_IGN is not
>      used, further occurrences of the signal are automatically blocked and
>      func is called.
>
> From my limited understanding, maybe this could help you find
> an explanation of the observed behaviour?
>
> Also compare /usr/include/sys/signal.h for the definition of
> the involved typedef's.
>
>
> --
> Polytropon
> Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANRpF5eMidvX0qk_TAE-yiw1EhGgdX3qsjwj8%2Be%2Bv7F-RAV40w>