List Info

Thread: Re: Sane exit from a program on receipt of a signal




Re: Sane exit from a program on receipt of a signal
user name
2007-07-21 07:27:24
mouseRodents.Montreal.QC.CA writes:
> > As for SIGTSTP and other tty signals, the signal
should be sent to
> > the process group rather than to just the current
process.
> 
> I disagree.

Take a look at curses(3) and other SIGTSTP-aware software.
You will easily find kill(0, SIGTSTP).

Stopping only one process of a process group will cause
serious problems
with BSD job control and must be avoided.

> If it was generated from the tty, it's *already* been
sent to other
> processes in the foreground process group; sending it
again would be
> wrong (and could lose big due to our send racing
against the other
> process handling it).  If it was sent to this process
specifically,
> rebroadcasting it to the whole process group just so
*we* can handle it
> with the default action is equally wrong.

Neither is wrong.

BSD is carefully designed to allow kill(0, SIGTSTP) in the
former case.
Sending SIGTSTP to already stopped processes is ignored
happily.

In the latter case, stopping one process of a process group
may left
the terminal in unusable state, and stopping the process
group is
user's benefit.

Regards,
-- 
ITOH Yasufumi

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )