P1003 System V compatible BSD-style job control

Guy Harris guy at sun.uucp
Thu Sep 4 06:05:17 AEST 1986


> I recently looked at the IEEE proposal to the P1003 committee on UNIX 
> standards re a System V compatible BSD-style job control mechanism (#P.047)
> and it all seemed quite reasonable except for the fact that I could not
> discern whether there existed a means of associating an arbitrary process
> with the terminal. (BSD uses an ioctl).

The P1003 proposal actually consists of the job control stuff and stuff in
the "termios" proposal; the latter includes a TCSPGRP "ioctl" that works
pretty much like the 4BSD one (with some extra permission checks).

> The one system call that I thought might do this 'setpgrp2' quite clearly
> says that this "function does not affect the process's terminal
> affiliation".

"setpgrp2" is the 4BSD "setpgrp", renamed so that it doesn't collide with
the S5 "setpgrp".  Again, modulo extra permission checks, it does just what
the 4BSD "setpgrp" does.  The bit about "not affecting its terminal
affiliation is true, but then it's true in 4BSD also.  "setpgrp2" will not
affect a process' "controlling terminal".  The P1003 "termios" proposal's
definition of the "controlling terminal" of a process amounts to "the
terminal that '/dev/tty' refers to in that process", not "the terminal that,
when the interrupt character is typed, sends a SIGINT to that process."

A terminal may have a process group associated with it; all signals
generated by that terminal (with the possible exception of the S5R3 SIGPOLL
signal) will be send to that process group.  If a process does a "setpgrp"
call, that process becomes the leader ("session process group leader") of a
new process group, whose process group ID is the same number as the process
ID of the process doing the "setpgrp".  If that process has a controlling
terminal (i.e., a "/dev/tty"), it no longer has one after the "setpgrp".  If
it subsequently opens a terminal, that terminal becomes its controlling
terminal and the newly-created process group becomes the terminal's process
group.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.unix.wizards mailing list