From owner-freebsd-hackers Mon Sep 1 21:11:55 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id VAA12150 for hackers-outgoing; Mon, 1 Sep 1997 21:11:55 -0700 (PDT) Received: from counterintelligence.ml.org (mdean.vip.best.com [206.86.94.101]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id VAA12145 for ; Mon, 1 Sep 1997 21:11:51 -0700 (PDT) Received: from localhost (jamil@localhost) by counterintelligence.ml.org (8.8.7/8.8.5) with SMTP id VAA04123; Mon, 1 Sep 1997 21:10:52 -0700 (PDT) Date: Mon, 1 Sep 1997 21:10:52 -0700 (PDT) From: "Jamil J. Weatherbee" To: David Greenman cc: Greg Lehey , freebsd-hackers@FreeBSD.ORG Subject: Re: SIGCLD In-Reply-To: <199709020354.UAA17302@implode.root.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > Yes, there is a difference. SIGCHLD signal delivery isn't reliable, so if > a SIGCHLD is missed, it is possible that more than one process needs to be > reaped. The first form will only reap on child, while the second form reaps > all of them. You want to use the second form. So, in the capacity that I plan on using the non zombieing children is demonstrated below -- I don't care which order the lines are written in (will not be a regular file, rather a socket descriptor) just that i don't end up with a collision of the two -- as long as I am using the low level read/write calls (as opposed to stream io), can I be certain that the pieces of data are delivered one after the other(in any order), is this a result of the fact that the kernel is single threaded? Will this always work even in future (possibly multithreaded) kernels? --------------------------------------------------------------- #include #include #include #include #include #include #include void die (int sig) { int status; while (wait3 (&status, WNOHANG, (struct rusage *) NULL)>0); } void main (void) { char msgpar[] = "the parents big long insignificant message\n"; char msgcld[] = "childs string that really says nor means anything\n"; int fd = open ("garbage",O_CREAT|O_RDWR,S_IRUSR|S_IWUSR); signal (SIGCHLD, die); if (fork()) { write (fd, msgpar, sizeof(msgpar)-1); exit (0); } write (fd, msgcld, sizeof(msgcld)-1); }