Reputation: 125
A session in Linux can have a controlling terminal.
What I am interested in knowing is when you set the foreground process group (using tcsetpgrp()
) of a controlling terminal, is the variable that holds the process group id of the foreground process group belongs to the controlling terminal data structures or does it belong to the session data structures?
Upvotes: 2
Views: 508
Reputation: 30577
tcsetpgrp()
is implemented via the ioctl TIOCSPGRP
on the tty device.
This ioctl in turn is implemented in the kernel function tiocspgrp, sets member pgrp
of the struct tty_struct
for the terminal.
In short, the foreground process group is stored in the tty data structure. Which makes sense, since the effect of the foreground process group is to identify which process(es) will receive signals from the tty when the user presses key combinations such as ctrl-C and ctrl-Z.
Upvotes: 2