This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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@sourceware.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]