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

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jul 25 15:47:00 GMT 2016


On Jul 25 11:15, Jon Turney wrote:
> 
> Consider the following:
> 
> $ cat sigttin-test.c
> #include <unistd.h>
> #include <poll.h>
> 
> // gcc sigttin-test.c -o sigttin-test
> // ./sigttin-test &
> 
> int main()
> {
>     // poll stdin
>     struct pollfd fds;
>     fds.fd = STDIN_FILENO;
>     fds.events = POLLIN;
>     return poll (&fds, 1, 0);
> }
> 
> $ gcc sigttin-test.c -o sigttin-test
> 
> on cygwin:
> 
> $ ./sigttin-test &
> [1] 6120
> 
> [1]+  Stopped                 ./sigttin-test
> 
> $ jobs -l
> [1]+  6120 Stopped (tty input)     ./sigttin-test
> 
> 
> on linux:
> 
> $ ./sigttin-test &
> [1] 2779
> $
> 
> My reading seems to indicate that SIGTTIN should be raised when read() is
> made on a tty in a backgrounded process, not when it's polled, but looking
> at the Cygwin source code, it's been this way since the earliest versions in
> git...
> 
> 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?


Thanks,
Corinna

-- 
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/a7510a1d/attachment.sig>


More information about the Cygwin-developers mailing list