poll()/select() on a tty fd in a backgrounded process raises SIGTTIN

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jul 25 16:55:00 GMT 2016

On Jul 25 17:52, Jon Turney wrote:
> > > This test case is reduced from a problem seen with gdb, since commit
> > > 0b333c5e, where gdb stops with SIGTTIN when the inferior is started.
> > 
> > Did you find out where it stops and do you have any ideas how we could
> > fix this?
> Um.
> gdb stops because a poll() on stdin (even when stdin is not ready to read)
> while backgrounded causes a SIGTTIN to be raised.
> I think this caused by select.cc:peek_console/peek_pipe calling
> fhandler_termios::bg_check(SIGTTIN).
> My idea for fixing it is to remove that behaviour from cygwin, assuming I'm
> right in thinking that the behaviour is incorrect, although I'm wary of
> touching something that's so old, and I don't understand why that call to
> bg_check is in there at all...

This may be an (old) misunderstanding how that's supposed to work.

Just removing sounds a bit dangerous, but we can try it.  Maybe it
just isn't necessary, but we need to check if it doesn't break
something else.  Like, say, not stopping at all anymore...


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20160725/c0a1b654/attachment.sig>

More information about the Cygwin-developers mailing list