Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!bonnie!akgua!gatech!seismo!brl-tgr!tgr!phil@RICE.ARPA From: phil@RICE.ARPA (William LeFebvre) Newsgroups: net.unix-wizards Subject: Re: am I in background? Message-ID: <3070@brl-tgr.ARPA> Date: Fri, 8-Nov-85 21:19:04 EST Article-I.D.: brl-tgr.3070 Posted: Fri Nov 8 21:19:04 1985 Date-Received: Tue, 12-Nov-85 04:16:22 EST Sender: news@brl-tgr.ARPA Lines: 35 >Ron Natalie: > On shells with job control, all it does is switch the terminal process > group to something different than the running process. The > standard input is not touched. However if the standard input > is still the terminal, the user will read EOF whenever he tries > to read it, unless he is catching SIGTTIN. What? Not with the c-shell. If the login process (the shell) still has the control terminal open, then the process doing the read always gets a SIGTTIN (actually, the whole process group get the TTIN). Otherwise, the read returns with an EBADF (of course, stdio translates an EBADF into an EOF). The default action for TTIN is to stop the process. If TTIN is being held or ignored, then the read returns an EIO. When a process gets stopped for any reason (in this case, from a TTIN), the parent process (usually the c-shell) gets a SIGCHLD, indicating that a child's status has changed. The result is that when you put a process in the background that then tries to read from your terminal, the c-shell will say "Stopped (tty input) ...". This happens without any unusual action on the part of the child -- it is the default. This turns out to be very handy, especially with an interactive program that has a long startup time (such as TeX). One can start the program in the background and go off and do something else while it starts up (like make small changes to an input file). When it is ready, it will get stopped. Then the user can simply "fg" it and start typing. Unfortunately, emacs doesn't benefit from this since it does an ioctl on the terminal (which has similar consequences) before it does all of its startup stuff (like reading the profile). William LeFebvre Department of Computer Science Rice Universityor, for the daring: