Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site wjvax.wjvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!pyramid!pesnta!wjvax!brett From: brett@wjvax.UUCP (Brett Galloway) Newsgroups: net.unix-wizards Subject: re: Process control query (4.2 BSD) Message-ID: <645@wjvax.wjvax.UUCP> Date: Thu, 23-Jan-86 19:15:38 EST Article-I.D.: wjvax.645 Posted: Thu Jan 23 19:15:38 1986 Date-Received: Sat, 25-Jan-86 08:32:41 EST Reply-To: brett@wjvax.UUCP (Brett Galloway) Organization: Watkins-Johnson Co., San Jose, Calif. Lines: 22 Keywords: 4.2, BSD, process control Last week I posted a query to the net about communicating the success or failure of an execve() from inside a fork() to the parent process. I got several responses (thank you). I finally decided to create a pipe between the child and the parent. If the child's execve() fails, it writes write(fd,&errno,sizeof(errno)) down the pipe and _exit()'s. If the child's execve() succeeds, the pipe gets closed automatically, because I explicitly mark the close on exec flag for the pipe in the parent). Meanwhile, the parent sits on the other end of the pipe. If it sees EOF (read(fd,&errno_save,sizeof(int) == 0)), it knows the execve() succeeded. Otherwise, it gets the error code returned by exeve(). Apparently, the only way for the parent to detect the difference between the child's execve() failing or succeeding and exiting very quickly is by using a scheme as above, which explicitly communicates the success/failure of the execve() from the child to the parent. ------------- Brett Galloway {pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett