Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2012 22:42:47 +0200
From:      Ed Schouten <ed@80386.nl>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Jeremy Chadwick <jdc@koitsu.org>, freebsd-stable@freebsd.org, jhb@freebsd.org
Subject:   Re: pty/tty or signal strangeness, or grep/bsdgrep bug?
Message-ID:  <CAJOYFBDhDMwgPyWRrzj021eqN=meS3q2FfTi9=5xpVPcXrNxYg@mail.gmail.com>
In-Reply-To: <20121023203928.GZ35915@deviant.kiev.zoral.com.ua>
References:  <20121023142703.GA79098@icarus.home.lan> <20121023203928.GZ35915@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Kostik,

2012/10/23 Konstantin Belousov <kostikbel@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@80386.nl>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJOYFBDhDMwgPyWRrzj021eqN=meS3q2FfTi9=5xpVPcXrNxYg>