Path: utzoo!utgpu!water!watmath!clyde!att!ucbvax!husc6!cs.utexas.edu!longway!jsq From: jsq@longway.TIC.COM (John S. Quarterman) Newsgroups: comp.unix.wizards Subject: Re: transferring processes under csh Message-ID: <235@longway.TIC.COM> Date: 3 Sep 88 16:22:43 GMT References: <1074@imagine.PAWL.RPI.EDU> <1264@mcgill-vision.UUCP> <5709@cg-atla.UUCP> <2364@pixar.UUCP> Reply-To: jsq@longway.tic.com (John S. Quarterman) Organization: TIC Lines: 53 In article <2364@pixar.UUCP> rta@pixar.UUCP (Rick Ace) writes: ... >Roadblocks to making ATTACH work under UNIX: >1. UNIX has no formal concept of a "job" Actually, it does: the process group. Csh uses it all the time in job control. > and no per-job database. No, but it has a process group ID and a process group leader. > (This is not the only approach, but it worked well for ATTACH.) Actually you attach to the session, not the job. >2. Determining which processes belong to which terminals is a nebulous task. The nebulous concept in UNIX has been that of a session: what is it, how is it created, and how is it related to the controlling terminal. Particularly so, when in System V there is only one process group per session, while in BSD you can have many. >3. Processes have direct handles (file descriptors) on terminals; > they do not go indirect a job-common location. About the > closest thing to a "controlling terminal" is /dev/tty, but > that's not what you'll find at stdin/stdout/stderr. Ah, but both System V and BSD have controlling terminals. Try looking at vhangup(2) in BSD or setpgrp(2) in System V. The controlling terminal is associated with a process group, and sends keyboard-generated signals like SIGHUP, SIGINT, and SIGQUIT to processes in that process group. The controlling terminal is the one you get when you open /dev/tty. How else it is set up varies with the system, although it's usually by opening a terminal after getting rid of the previous controlling terminal by some implementation-defined method. You may find IEEE 1003.1 (approved 22 August 1988) interesting in this regard. Its definitions of process groups, sessions, and controlling terminals, together with ancillary functions, were written after months of intensive discussion among people from AT&T, UCB, MIT, HP, IBM, etc. Little problems like setpgrp() not being the same thing in BSD and System V, and like nobody really having a good definition of a session to start with, were dealt with (I won't necessarily say ``solved'' for all such problems). TOPS-20-style ATTACH was explicitly considered and the text in the standard is carefully written so that you could implement it with ATTACH and be conformant. You will probably see 1003.1 conformant systems soon (DEC already claims to have one), but I don't know if anybody is actually doing ATTACH.