Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 1995 09:21:44 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-hackers@freebsd.org (FreeBSD hackers)
Cc:        filo@yahoo.com
Subject:   Re: Ignoring SIGCHLD without having to wait()?
Message-ID:  <199507170721.JAA05076@uriah.heep.sax.de>
In-Reply-To: <9507170445.AA18374@cs.weber.edu> from "Terry Lambert" at Jul 16, 95 10:45:38 pm

next in thread | previous in thread | raw e-mail | index | archive | help
As Terry Lambert wrote:
> 
> I believe that the "ignore" is supposed to work: that is, it will cause
> the exit status to be automatically reaped.  That is, _exit will check
> the mask on the parent process and react accordingly.

Huh?

j@uriah 88% cat foo.c
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>

int main(void) {
        pid_t pid;
        int i;

        signal(SIGCHLD, SIG_IGN);

        for(i = 0; i < 20; i++) {
                if((pid = fork()) == 0) {
                        return 0;
                }
        }

        sleep(100);
        return 0;
}
j@uriah 89% cc foo.c
j@uriah 90% ./a.out &
[2] 5031
j@uriah 91% ps
  PID TT  STAT      TIME COMMAND
...
 5031 a1  S      0:00.10 ./a.out
 5032 a1  Z      0:00.00  (a.out)
 5033 a1  Z      0:00.00  (a.out)
 5034 a1  Z      0:00.00  (a.out)
 5035 a1  Z      0:00.00  (a.out)
 5036 a1  Z      0:00.00  (a.out)
 5037 a1  Z      0:00.00  (a.out)
 5038 a1  Z      0:00.00  (a.out)
 5039 a1  Z      0:00.00  (a.out)
 5040 a1  Z      0:00.00  (a.out)
 5041 a1  Z      0:00.00  (a.out)
 5042 a1  Z      0:00.00  (a.out)
 5043 a1  Z      0:00.00  (a.out)
 5044 a1  Z      0:00.00  (a.out)
 5045 a1  Z      0:00.00  (a.out)
 5046 a1  Z      0:00.00  (a.out)
 5047 a1  Z      0:00.00  (a.out)
 5048 a1  Z      0:00.00  (a.out)
 5049 a1  Z      0:00.00  (a.out)
 5050 a1  Z      0:00.00  (a.out)
 5051 a1  Z      0:00.00  (a.out)
j@uriah 92% kill %2
[2]    Terminated             ./a.out

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507170721.JAA05076>