We are told that a tty can control at most one session and furthermore that ttys can be controlled not to allow background process groups within its controlled session to write or read from it, the former being controlled by the TOSTOP
option.
However, what is the position on other sessions writing to a tty? Can it be controlled in some way? Assume tty1
and tty2
, both with shells. I was surprised that the following command on shell2
on tty2
...
ls > /dev/tty1
...actually produced the output from ls
on tty1
, no matter what the TOSTOP
option was set to in tty1
. Since shell2
is altogether part of another session, I figured that might be it, because the TOSTOP
option indeed does what it's supposed to when attempting to write from a background process group. Could someone enlighten me what's going on?