When an application switches to raw mode, it's because it wants exclusive control over the terminal to run some kind of interface. To prevent that interface from being messed up by arbitrary background processes, we should set the TOSTOP bit.
This is not completely bulletproof: A really determined background process could block/ignore SIGTTOU to get around TOSTOP, but that's an edge case that we can't do anything about.
When an application switches to raw mode, it's because it wants exclusive control over the terminal to run some kind of interface. To prevent that interface from being messed up by arbitrary background processes, we should set the
TOSTOP
bit.This is not completely bulletproof: A really determined background process could block/ignore
SIGTTOU
to get aroundTOSTOP
, but that's an edge case that we can't do anything about.