X-Spam-Check-By: sourceware.org
Date: Thu, 5 Apr 2007 19:31:39 -0400
From: Bob Rossi <bob_rossi@cox.net>
To: cygwin@cygwin.com
Subject: Re: SIGTSTP and select
Message-ID: <20070405233139.GI20569@cox.net>
Mail-Followup-To: cygwin@cygwin.com
References: <20070403000723.GG24160@cox.net> <20070403003753.GA11244@ednor.casa.cgf.cx> <20070403141320.GA3459@cox.net> <20070403144239.GB3459@cox.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20070403144239.GB3459@cox.net>
User-Agent: Mutt/1.5.12-2006-07-14
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Tue, Apr 03, 2007 at 10:42:39AM -0400, Bob Rossi wrote:
> On Tue, Apr 03, 2007 at 10:13:20AM -0400, Bob Rossi wrote:
> > On Mon, Apr 02, 2007 at 08:37:53PM -0400, Christopher Faylor wrote:
> > > 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.
> > 
> > Hi Christopher,
> > 
> > Attached is the test case. If I run it under linux, and then type ctrl-z, I 
> > never get into the user_input_loop call. If I run it in cygwin, I do.
> > 
> > Hopefully I'm doing something wrong here. Please advise!
> 
> Ouch. Attached.

Any idea if this is a bug in cygwin?

I'm considering if I should rework my code to handle this case...

Thanks,
Bob Rossi

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

