From: Nicholas Miell <nmiell@comcast.net>
To: "John Z. Bohach" <jzb2@aexorsyst.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Should parent's WIFSIGNALED(siginfo->si_status) be true EVEN IF the SIGNAL was caught by the child?
Date: Sat, 22 Sep 2007 11:52:14 -0700 [thread overview]
Message-ID: <1190487134.2712.2.camel@entropy> (raw)
In-Reply-To: <200709221122.09523.jzb2@aexorsyst.com>
On Sat, 2007-09-22 at 11:22 -0700, John Z. Bohach wrote:
> Hello,
>
> It is unclear from the various documentions in the kernel and glibc what
> the proper behaviour should be for the case when a child process
> catches a SIGNAL (say for instance, SIGTERM), and then calls exit()
> from within its caught SIGNAL handler.
>
> Since the exit() will cause a SIGCHLD to the parent, and the parent
> (let's say) has a SIGCHLD sigaction (SA_SIGINFO sa_flags set), should
> the parent's WIFSIGNALED(siginfo->si_status) be true?
>
> To recap, the WIFSIGNALED section of the waitpid() manpage says:
>
> WIFSIGNALED(status)
> returns true if the child process was terminated by a signal.
>
> So the dilemna: the child caught the signal, so it wasn't terminated by
> a signal, but rather its signal handler (let's say) called exit.
POSIX says
WIFSIGNALED(stat_val)
Evaluates to a non-zero value if status was returned for a child
process that terminated due to the receipt of a signal that was
not caught (see <signal.h>).
So there's no dilemma at all and Linux is non-conformant.
--
Nicholas Miell <nmiell@comcast.net>
prev parent reply other threads:[~2007-09-22 18:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-22 18:22 Should parent's WIFSIGNALED(siginfo->si_status) be true EVEN IF the SIGNAL was caught by the child? John Z. Bohach
2007-09-22 18:49 ` Michael Kerrisk
2007-09-22 20:18 ` John Z. Bohach
2007-09-22 23:35 ` Andreas Schwab
2007-09-23 1:05 ` John Z. Bohach
2007-09-22 18:52 ` Nicholas Miell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1190487134.2712.2.camel@entropy \
--to=nmiell@comcast.net \
--cc=jzb2@aexorsyst.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.