pty/tty or signal strangeness, or grep/bsdgrep bug?

Ed Schouten ed at 80386.nl
Tue Oct 23 20:42:49 UTC 2012


Hi Kostik,

2012/10/23 Konstantin Belousov <kostikbel at gmail.com>:
> This is reproducable with the cat(1) as well. The telling part is that
> the backgrounded process stays on the "ttyin" cv. The code for e.g.
> tty read currently is structured as follows:
>         check for background process reading from CTTY, send SIGTTYIN
>         loop {
>                 sleep waiting for input
>                 process input
>         }
> The problem is that the SIGCONT does not remove the sleeping process from
> the sleep queue, so the sleep is not interrupted with error. Instead, the
> process is woken up later when input is available.
>
> Old tty code did the recheck for background state inside the loop after
> the sleep.

Exactly. Was just debugging this as well and came to the same
conclusion. Will try to come up with a decent patch tomorrow evening.

Thanks for reporting the issue!

-- 
Ed Schouten <ed at 80386.nl>


More information about the freebsd-stable mailing list