Mail Archives: cygwin/2004/03/25/02:14:45
hi,
Thanks for your attention. But I found the second result (two SIGCHLD) in
both the cases. I m using the cygwin version 1.5.5.1
Thanks,
Ghanshyam
> -----Original Message-----
> From: Christopher Faylor
[mailto:cgf-no-personal-reply-please AT cygwin DOT com]
> Sent: Wednesday, March 24, 2004 10:13 PM
> To: cygwin AT cygwin DOT com
> Subject: Re: 1.5.5.1 posix conformance for sigaction()
>
> On Wed, Mar 24, 2004 at 08:24:34PM +0000, Ghanshyam wrote:
> >Hi all,
> >
> >I found some problem in sigaction() system call with respect to
following
> >assertions defined in IEEE std 2003.1 -1992 Test methods for measuring
> >conformance to POSIX-part1 document: When I run NIST-PCTS test suite on
> >cygwin the following assertion failed.
> >
> >14(C) If the behavior associated with {_POSIX_JOB_CONTROL} is
> supported:
> > When sig is SIGCHLD and the SA_NOCLDSTOP flag is set in sa_flags,
> then a
> > call to sigaction(sig, act, oact) results in a SIGCHLD signal not
> > being generated for the parent process whenever any of its child
> > processes stop.
> >
> >********** SIGCHLD signal received by parent process when SIGSTOP
signal
> >is send to child process!
>
> I have employed a patented method that I have devised called "a simple
> test case" to determine if your claim is true or not.
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <signal.h>
>
> void
> ouch (int sig)
> {
> printf ("ouch %d\n", sig);
> }
>
> int
> main (int argc, char **argv)
> {
> struct sigaction newact = {0};
> struct sigaction oldact;
> int pid, x;
>
> if (argc == 1)
> newact.sa_flags = SA_NOCLDSTOP;
> newact.sa_handler = ouch;
> printf ("%d = sigaction\n", sigaction (SIGCHLD, &newact, &oldact));
> if ((pid = fork ()) > 0)
> kill (pid, SIGSTOP);
> else
> {
> sleep (5);
> sleep (1);
> puts ("exiting child\n");
> exit (0);
> }
> sleep (1);
> kill (pid, SIGCONT);
> wait (&x);
> puts ("exiting parent");
> }
>
> Compiling the above program as "sigstopchld" and running it provides:
>
> m:\test>.\sigstopchld # Calling with SA_NOCLDSTOP
> 0 = sigaction
> exiting child
>
> ouch 20 # Just one SIGCHLD from child exit
> exiting parent
>
> m:\test>.\sigstopchld 1 # SA_NOCLDSTOP not set
> 0 = sigaction
> ouch 20 # first SIGCHLD
> exiting child
>
> ouch 20 # second SIGCHLD
> exiting parent
>
> This indicates to me that SA_NOCLDSTOP is working as designed.
> --
> Christopher Faylor spammer? -> aaaspam AT sourceware DOT org
> Cygwin Project Leader
> Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -