delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/04/13/10:12:19

X-Spam-Check-By: sourceware.org
Date: Fri, 13 Apr 2007 10:11:53 -0400
From: Bob Rossi <bob_rossi AT cox DOT net>
To: cygwin AT cygwin DOT com
Subject: Re: SIGTSTP and select
Message-ID: <20070413141153.GB25914@cox.net>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20070403000723 DOT GG24160 AT cox DOT net> <20070403003753 DOT GA11244 AT ednor DOT casa DOT cgf DOT cx> <20070403141320 DOT GA3459 AT cox DOT net> <20070413132501 DOT GG15801 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20070413132501.GG15801@calimero.vinschen.de>
User-Agent: Mutt/1.5.12-2006-07-14
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Fri, Apr 13, 2007 at 03:25:01PM +0200, Corinna Vinschen wrote:
> On Apr  3 10:13, 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:
> > > >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!
> 
> I'm a bit puzzled.  I don't see any difference in behaviour on Linux and
> Cygwin related to your testcase.  I have no problems to trigger the
> user_input_loop call on Linux and Cygwin.  After I press ctrl-z, I don't
> get into it on both systems.  After unsuspending the process, I get into
> user_input_loop on both systems again.  Either your testcase is wrong,
> or you should exactly specify what has to be typed to trigger the
> problem.  I tested this with Cygwin 1.5.24 and Linux 2.6.20.5, btw.

Hmmm, maybe I don't understand cygwin well enough. Does it require me to
have CYGWIN=tty to have this functionality work properly?

If I use the exact same test case I just sent in, and set CYGWIN=tty, I
still get different results than on linux, but it seems better. On
cygwin, select returns with value -1 and errno set to EINTR. On
linux, as I just posted, that doesn't seem to happen.

Should I assume that if cygwin users want to use cgdb that they must set
CYGWIN=tty, or is that a bad assumption to make?

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019