bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8938: make timeout and CTRL-C


From: Alan Curry
Subject: bug#8938: make timeout and CTRL-C
Date: Sat, 2 Jul 2011 15:14:46 -0500 (GMT+5)

shay shimony writes:
> 
> > With this patch the child is guaranteed to not be in the foreground (as far
> > as the tty knows) so it will be getting SIGTTIN and possibly SIGTTOU on tty
> > operations.
> 
> You may need to correct me. In practice we see that the "timeouted" program
> perform successfully writes to the terminal, though it belongs to a
> different group then the foreground (in my case "make"'s group is in the
> foreground and timeout+compiler/test group is in the background, and all
> output of the compiler and test seem to appear correctly on the terminal).
> And regarding read, I think it makes sense enough that users will not use
> timeout for interactive programs that wait for input from the user.
> So maybe the fact that the timeouted program will not be able to get SIGTTIN
> and SIGTTOU is not such a disaster?
> 

Notice that I wrote "possibly" before SIGTTOU. There was a reason for that.

A background process that writes to the tty will get SIGTTOU if "stty tostop"
is in effect. This is a user preference thing. You can set it if you get
annoyed by processes writing to the terminal after you backgrounded them
expecting them to be quiet. It's not enabled by default.

If the process ignores SIGTTOU, the write will proceed, overriding the user's
expressed preference.

SIGTTIN is more forceful. There's no stty flag to turn it off, and ignoring
it results in EIO. Keyboard input always belongs exclusively to the
foreground job.

For completeness I'll also mention that SIGTTOU will also be sent to a
background process that attempts to change the tty settings, even if tostop
is not enabled.

-- 
Alan Curry





reply via email to

[Prev in Thread] Current Thread [Next in Thread]