Subject: Re: SIGINFO and NOKERNINFO
To: None <email@example.com>
From: Valeriy E. Ushakov <firstname.lastname@example.org>
Date: 06/03/2006 20:47:55
On Fri, Jun 02, 2006 at 12:42:09 -0400, Christos Zoulas wrote:
> Chuck found a bug in ping where if ping was backgrounded, it would stop.
> This exposed an issue in the SIGINFO functionality. Ping wants to trap
> siginfo to print statistics, but at the same time it does not want the
> kernel to print statistics. This is currently accomplished by ping
> setting the tty flag NOKERNINFO. Unfortunately, in order to set this
> flag we need to call tcsetattr, and this causes the process to stop
> if it has a tty, but the tty is not in the current tty control group.
> Well, one can detect if the process is in the current tty control group
> and choose not to set the flag. This is not good enough, because the
> process can start in the foreground, and then be placed in the background.
> In this case, not restoring the flag will end up modifying the tty
> In the end, the more basic issue is that there should be a way to
> avoid printing kerninfo in the current process, that does not modify
> global state [the tty state] that persists after the process ends.
> Chuck had a good idea, indicating this via a signal flag. The following
> code does this.
Looks good (though I didn't verified the patch thoroughly).
email@example.com | Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/ | Ist zu Grunde gehen