Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.emacs,net.unix Subject: Re: UNIX and/or Gosling Emacs problem. Message-ID: <1440@umcp-cs.UUCP> Date: Thu, 29-Aug-85 11:04:28 EDT Article-I.D.: umcp-cs.1440 Posted: Thu Aug 29 11:04:28 1985 Date-Received: Sat, 31-Aug-85 08:19:43 EDT References: <441@sbcs.UUCP> Distribution: net Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 37 Xref: watmath net.emacs:1228 net.unix:5520 If you want your program to run "in the background", it should do its own forking *and* close fd's 0, 1, and 2 *and* (to be nice) it should probably give up its control terminal as well. Note that I do not mean "background" in the sense the C shell uses. #include #include /* * Continue running as a completely detached process. */ backgroundify() { register int pid, tt; fflush(stdout); /* clean up */ fflush(stderr); if ((pid = vfork()) < 0) { perror("backgroundify: fork"); return (-1); } if (pid) /* parent */ exit(0); if ((tt = open("/dev/tty", 2)) >= 0) { (void) ioctl(tt, TIOCNOTTY, (char *)0); (void) close(tt); } (void) close(0); (void) close(1); (void) close(2); return (0); } -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland