Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!spdcc!m2c!ulowell!cg-atla!batson From: batson@cg-atla.UUCP (Jay Batson X5927) Newsgroups: comp.arch Subject: Re: Free Software Foundation (was: Re: Mach, the new standard?) Message-ID: <911@cg-atla.UUCP> Date: Sat, 26-Sep-87 13:48:22 EDT Article-I.D.: cg-atla.911 Posted: Sat Sep 26 13:48:22 1987 Date-Received: Sun, 27-Sep-87 11:26:08 EDT References: <1665@ncr-sd.SanDiego.NCR.COM> <8381@utzoo.UUCP> <233@hobbes.UUCP> Reply-To: batson@cg-atla.UUCP (Jay Batson X5927) Organization: Compugraphic Corp. Wilmington, MA Lines: 50 In article <233@hobbes.UUCP> root@hobbes.UUCP (John Plocher) writes: >> Most uses of fork() are immediately followed by an exec() call. > >When this came up last spring, someone (gwyn?) grep'd thru all the Unix >source and found a grand total of TWO places where fork() was immediately >followed by exec()! All the others had dup()s, close()s, and setuid()s, etc >stuck in between. In the future, please try to ground your "facts" in >something solid before making sweeping statements like that... Well now, I don't myself usually get in the middle of other persons arguments, but when a flamer is himself working from heresay, I take exception. In response to this accusation of John's, I did this: less `egrep -l /src/bin/*.c /src/ucb/*.c` Not a completely extensive search, but a good sample. The results are: Programs forking Programs forking then (more or less) exec'ing but NOT exec'ing (possibly conditionally) ------------------------------------- -------------------------------- cc mail du wall ed leave login rsh rmail time write rcp rlogin sccs script Note that this search did in fact reveal that there is often SOME code between fork and exec (not always), therefore somewhat validating John. However, from the point of view of doing UNIX/C coding for a few years (I mean 5 isn't many, but more than some), I recall the vast majority of programs that fork usually exec QUITE quickly after the fork, and any processing done afterwards is often just laziness (it could have been set up before the fork - flames to /dev/null - I know there are times when you can't so setup...). Therefore children, what is the lesson for today? Heresay is dangerous.... Jay _________________________________________________________________________ When I'm finally old enough to believe my opinions are sufficiently wise and important for others to listen to, nobody will want to listen to "that old fart...."