delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/24/11:43:05

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 24 Mar 2004 11:42:40 -0500
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.5.1 posix conformance for sigaction()
Message-ID: <20040324164240.GA6006@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <Pine DOT LNX DOT 4 DOT 10 DOT 10403242018160 DOT 3101-100000 AT denver DOT india DOT mentorg DOT com>
Mime-Version: 1.0
In-Reply-To: <Pine.LNX.4.10.10403242018160.3101-100000@denver.india.mentorg.com>
User-Agent: Mutt/1.4.1i

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019