Re: Should parent's WIFSIGNALED(siginfo->si_status) be true EVEN IF the SIGNAL was caught by the child?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux