Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!seismo!mcvax!ukc!hrc63!nwh From: nwh@hrc63.UUCP (Nigel Holder Marconi) Newsgroups: net.unix-wizards Subject: System V and SIGCLD Message-ID: <337@hrc63.UUCP> Date: Thu, 8-May-86 11:49:19 EDT Article-I.D.: hrc63.337 Posted: Thu May 8 11:49:19 1986 Date-Received: Sun, 11-May-86 04:01:25 EDT Organization: GEC Hirst Research Labs, Wembley, Middlesex. Lines: 54 Relay-Version: version B 2.10.2 9/18/84; site hrc63.UUCP Posting-Version: version B 2.10.2 9/18/84; site cheviot.uucp Path: hrc63!ukc!cheviot!lindsay From: lindsay@cheviot.uucp (Lindsay F. Marshall) Newsgroups: net.unix-wizards Subject: System V and SIGCLD Message-ID: <709@cheviot.uucp> Date: 7 May 86 10:33:56 GMT Date-Received: 8 May 86 06:26:52 GMT Reply-To: lindsay@cheviot.newcastle.ac.uk (Lindsay F. Marshall) Organization: U. of Newcastle upon Tyne, U.K. Lines: 40 Xpath: ukc eagle The following code goes into an infinite loop on System V :- trap(sig) int sig; { printf("trapped SIGCLD\n"); signal(SIGCLD, trap); /* reset handler */ } main() { signal(SIGCLD, trap); switch ( fork() ) { case 0 : /* child */ sleep(5); exit(0); case -1 : printf("error\n"); exit(1); default : pause(); } exit(0); } The problem is that resetting the SIGCLD trap inside the handler causes the signal to be raised again and the handler to be re-entered...... This is not documented in the manual page and seems to me to be a bug as if you do not reset the handler the system seems to set it to SIG_DFL, meaning that you will loose any SIGCLD signals between the handler's exit and your getting a chance to call signal again. Anyone have any thoughts, information etc. on this problem?? ------------------------------------------------------------------------------ Lindsay F. Marshall, Computing Lab., U of Newcastle upon Tyne, Tyne & Wear, UK ARPA : lindsay%cheviot.newcastle.ac.uk@ucl-cs.arpa JANET : lindsay@uk.ac.newcastle.cheviot UUCP : !ukc!cheviot!lindsay -------------------------------------------------------------------------------