From xemacs-m  Fri Jul 18 07:16:55 1997
Received: from fronsac.ensg.u-nancy.fr (fronsac.ensg.u-nancy.fr [192.93.48.17])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id HAA07661
	for <xemacs-beta@xemacs.org>; Fri, 18 Jul 1997 07:16:50 -0500 (CDT)
Message-Id: <199707181216.HAA07661@xemacs.org>
Received: by fronsac.ensg.u-nancy.fr
	(8.7.1/16.2) id IAA04721; Fri, 18 Jul 1997 08:16:42 -0400 (EDT)
Date: Fri, 18 Jul 1997 08:16:42 -0400 (EDT)
From: Richard Cognot <cognot@ensg.u-nancy.fr>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: xemacs-beta@xemacs.org
Subject: SIGCHLD on hpux 10.20 (20.3b10)
X-Mailer: VM 6.32 under 20.3 "Athens" XEmacs  Lucid (beta10)
Reply-to: cognot@ensg.u-nancy.fr
X-Face:  .|{6#t`YCBNfg_E.8;@IFK9kd'Ol7>~2S7U!o3+g)+\`hV5&I]k,UwC%g%Y\,-KV+[eEgZm
 i(NgMB@L_n/A!jk;}@!?$<t5Aw`B$R=xJSv[F$2&sz*cwxF!|B3)MH,6YBDNU!$9;91N_p*>}</%ZO
 +EYRSc{a_#KXB)sJlPpxQq,/:}\*noO!;(5PY~MTnspl;&XA$JccP;N~;v5E>Yh.



I've just seen an awfull lot of defunct processes on my machine (hp
C100 running hpux 10.20). All of them had my xemacs process as their
parent, and where sendmail processes (I'm using VM to read/send mail).

After digging a bit in my archives, I found 7 different test cases for 
SIGCHLD handling in the xemacs beta list (that was roughly 2 years
ago, first one posted in Fri Jun 2 1995, for those who are
interested).

Anyway, only one of thoses tests passes on 10.20. Several of them
passe on 9.X, 10.01 and 10.10...

Funnily enough, some of these tests receive the SIGCHLD OK (at least
they say so), but the defunct processes will only go away upon
termination, so there definitely is something wrong out there.

The following program is the only one out of the seven posted that
does it right (i.e.: get the signals, and the defunct processes
disapear each time a signal is received).

I'll have to check with b13, but I haven't seen anything concerning
SIGCHLD on the list recently, so my guess is that the problem is still 
there.

#include <stdio.h>
#include <signal.h>

volatile int tick = 0;

void
h()
{
  struct sigaction act;
  tick++;
  wait ();

  act.sa_handler = h;
  sigemptyset (&act.sa_mask);
  sigaction(SIGCHLD, &act, 0);

  sleep(2);
  if (tick == 5) {
    puts("got all the SIGCHLDs");
    exit(0);
  }
}

main()
{
  int i;

  struct sigaction act;
  act.sa_handler = h;
  sigemptyset (&act.sa_mask);
  sigaction(SIGCHLD, &act, 0);

  for (i = 0; i < 5; i++) {
    switch (fork()) {
      case 0:
	sleep(5);
	exit(0);
	break;
      default:
	break;
    }
  }
  while (1) {}
}

-- 
|-------------------------------------------------------------|
| Richard Cognot           | Proceed, with fingers crossed... |
|                          |           /\^^/\                 |
| <cognot@ensg.u-nancy.fr> |             `'                   |
|-------------------------------------------------------------|
| http://www.ensg.u-nancy.fr/~cognot                          |
|-------------------------------------------------------------|

