[comp.unix.wizards] <suspend> command in csh; why not for the login shell?

mouse@mcgill-vision.UUCP (der Mouse) (11/08/86)

In article <2401@yale-cheops.yale.UUCP>, dglasser@yale.UUCP (Danny
Glasser) asks why the csh suspend command doesn't work for a login
shell.

> The csh "suspend" command allows the user to suspend a sub-shell of
> the login shell, as if the user had typed ctrl-Z to the shell.
Assuming ^Z is your suspend character....when I type ^Z to my shell it
just beeps.
> However, if the user tries to invoke the "suspend" command in the
> login shell, [it says "Can't suspend a login shell (yet)"].

> It would be very useful to be able to "suspend" one's login shell
> (and any processes running under it) and then access this shell later
> on.  Suspending a login shell would be an alternative to "logout",
> and when the user logged back in again, he/she would have the option
> of creating a new login shell or accessing a suspended login shell.

> Having said all this, I pose the following questions:  Why hasn't
> this been done?

Because it's difficult (:-).

Doing this requires that there be some way to detach the shell and all
processes under it from one terminal and attach it to another.  Given
the current device paradigm, this would require some major kernel work.
The only way I see to do this without major kernel hacks is to run
something when you log in that grabs a pseudo-terminal and runs a shell
on it.  Then when you suspend the shell, the parent process releases
the real tty, forks, and the parent dies (so init knows to fork a new
getty).  When you log in again, this magic program knows (UNIX-domain
socket? file in ~? file in /tmp? kernel hack?) that there's another
instance around, so it connects to the pseudo-tty the other one had (or
if UNIX won't permit it, it just talks to the existing process holding
the master half).  Voila, you are talking to the same shell as before
(which really never died).

This could be done with a new program and some hacks to the shell, but
would pay a penalty in (a) performance, (b) extra processes, and (c)
pseudo-terminals ((b) and (c) are tied up principally by people who
habitually suspend rather than logging out -- a penalty of two
processes and a pseudo-terminal per login is not too bad).

There is also a problem in that you will get used to leaving in the
middle of things because you can "log out" and come back to it later.
You can get bitten badly when the machine crashes and of course your
saved login is lost.

					der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu

	Aren't you glad you don't shave with Occam's Razor?