[TUHS] Sockets and the true UNIX

Chris Torek torek at torek.net
Sat Sep 23 06:57:48 AEST 2017

>In that sense, job control and process groups *are* independent of
>the terminal device.
>The complication arises when you have to multiplex one terminal
>between several different jobs in an interactive shell. Setting
>the terminal process group correctly -- the only way to accomplish
>that -- is fragile and the consequences of setting it to the wrong
>value are inconvenient, to say the least.

Sure, but here again you can have the shell hang on to the
(kernel allocated) pgroup, and any control operation amounts
to, e.g., "set tty pgroup to the one for my pgroupid X".
Since the shell is waiting for everything in the pipeline
to exit, the shell knows when to close its "pgid descriptor".

(If you abandon the pipeline entirely, you also abandon the
ability to attach it to a tty.  There should be some way to
"rejoin" pgroups, which would let you attach them to new tty
sessions, which is something that is missing from the current
system.  But that's another thing entirely.)


More information about the TUHS mailing list