SIGTSTP and select

Christopher Faylor
Tue Apr 3 00:37:00 GMT 2007

On Mon, Apr 02, 2007 at 08:07:23PM -0400, Bob Rossi wrote:
>I'm not exactly sure what has changed since the last release to cause
>this issue. However, here it is.
>When ctrl-z is typed, CGDB receives a SIGTSTP on both linux and cygwin.
>When CGDB is at the select loop and this happens on linux select returns
>-1 and errno is set to EINTR. My code simple does a 'continue' when this
>happens and the select loop is reentered. All works well. On cygwin,
>select does not return with -1. (I didn't check the return value but I
>can, I just compare to -1 in an if statement). In fact, select also
>detects that input is ready on stdin. This causes CGDB to get to a read
>system call (which is non blocking) and the read system call fails with
>errno set to EAGAIN. This causes CGDB to exit.
>The main loop looks something like this,
>  if (select (max + 1, &rset, NULL, NULL, NULL) == -1)
>    { 
>      if (errno == EINTR)
>        continue;
>      ..
>    }
>  if (FD_ISSET (STDIN_FILENO, &rset)) {
>    handle_stdin
>  }
>So, my question is, is there a bug with select on cygwin? Is select
>working properly and I should handle the read call differently? Why does
>it act differently than linux?

You say that something changed between different releases but you don't
mention what those releases are.  Is this releases of Cygwin?  If so,
what releases?

If this is as easy to demonstrate as you say, then a simple test case
is definitely called for.


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list