Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!mit-eddie!ll-xn!ames!amdcad!amd!intelca!oliveb!pyramid!prls!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.unix.questions Subject: Re: Using vfork (was Fork and Join, Pipe in C) Message-ID: <828@mcgill-vision.UUCP> Date: Fri, 26-Jun-87 20:50:26 EDT Article-I.D.: mcgill-v.828 Posted: Fri Jun 26 20:50:26 1987 Date-Received: Sat, 4-Jul-87 23:07:32 EDT References: <7737@brl-adm.ARPA> <1186@ius2.cs.cmu.edu> <8174@utzoo.UUCP> <21731@sun.uucp> <21685@sun.uucp> Organization: McGill University, Montreal Lines: 31 Quotes are from articles <21731@sun.uucp> and <21685@sun.uucp>, written by guy%gorodish@Sun.COM (Guy Harris). > There is very little you can do with the (temporarily) shared memory > you get from "vfork", and in most, if not all, cases, you can do the > same thing just as well without it. Well, I wrote such code (just once, as far as I can recall). The child process had to do some fiddling before execing. It was possible for it to fail during this fiddling. Also, the parent had to know the exit code of the execed program, if it was really executed; this exit code could be any of the possible exit codes. How is the parent to know whether the child succeeded in its fiddling and exec? I used the `shared' memory to pass a flag back to the parent. This was simple, fast, and obvious (I noted the dependence on the (admittedly) ugly vfork() semantics in a comment at that point in the code). I see no way to pass this back without using a temporary file (ugh) or a pipe (double ugh; and is it guaranteed to have enough buffer capacity?). > The only remaining reason to use vfork is that one has written ugly > and brain-damaged code that depends on the semantics of "vfork". > [...] If anybody has written code of this sort, they should hang > their head in shame and then go out and fix it NOW. Well, I'm not exactly proud of the technique, but I won't go so far as to hang my head in shame. Fix it, you say; but what fix would you recommend I use? der Mouse (mouse@mcgill-vision.uucp)