setpgrp question

Bob Lenk rml at hpfcdc.HP.COM
Wed Dec 27 11:53:58 AEST 1989


In article <6863 at cbnewsh.ATT.COM> skumar at cbnewsh.ATT.COM
(swaminathan.ravikumar) writes:

> By reading different sources I found out that a process can
> break its control terminal by calling "setpgrp". I don't
> understand this 100%. Why should the process lose the control
> terminal? why do you need "setpgrp"?
> I know that it is used to group processes to receive
> signals.

Process groups are used in two different ways on different
implementations.  In System V they are used to group the processes that
are logged in on a terminal.  In BSD they are used to group processes
into jobs.  While both versions permit sending a signal to a process
group, there are other effects based on the intended usage which may not
be expected if you just want to group processes for signals.
Disassociating from the controlling terminal is one effect that goes
with the System V usage.  The effects in BSD include distinguishing one
process group as the foreground process group of a tty and restricting
access from other (background) processes.

The IEEE 1003.1 (POSIX.1) standard includes both types of grouping.  The
System V style process groups are called sessions, while the BSD style are
called process groups.  The setpgrp() function is not in POSIX (to permit
backward compatibility with either version), but is replaced with the
two calls setsid() and setpgid().

		Bob Lenk
		rml at hpfcla.hp.com
		hplabs!hpfcla!rml



More information about the Comp.unix.questions mailing list