delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/11/22/02:33:09

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
To: cygwin AT cygwin DOT com
From: Jason Curl <j DOT m DOT curl AT optusnet DOT com DOT au>
Subject: Re: select() read() and write() on /dev/console
Date: Mon, 22 Nov 2004 07:32:45 +0000 (UTC)
Lines: 68
Message-ID: <loom.20041122T082640-84@post.gmane.org>
References: <Pine DOT LNX DOT 4 DOT 44 DOT 0411191834400 DOT 1687-100000 AT centurai DOT sps DOT mot DOT com> <20041119183842 DOT GB26102 AT trixie DOT casa DOT cgf DOT cx> <cnql46$3lm$1 AT sea DOT gmane DOT org> <20041121212544 DOT GB6384 AT trixie DOT casa DOT cgf DOT cx>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: main.gmane.org
User-Agent: Loom/3.14 (http://gmane.org/)
X-Loom-IP: 62.180.53.223 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0)
X-IsSubscribed: yes

Christopher Faylor <cgf-no-personal-reply-please <at> cygwin.com> writes:

> 
> On Sun, Nov 21, 2004 at 07:00:42PM +0100, Jason Curl wrote:
> >Christopher Faylor wrote:
> >>On Fri, Nov 19, 2004 at 06:46:56PM +0100, Jason Curl wrote:
> >>
> >>>My question, how do I go about investigating what the root cause is? Has 
> >>>anybody else seen similar issues and been able to work around it? I'm 
> >>>stuck and I've never seen the source code to cygwin before.
> >>
> >>
> >>If you suspect a problem with the cygwin DLL then you can build a
> >>debugging version of the cygwin DLL and debug it using gdb.
> >>
> >>Most of the console handling is in fhandler_console.cc.  The select
> >>handling is in select.cc.  Look for the string "console" there.
> >>
> >>Instructions for building the DLL are in the FAQ:
> >>
> >>http://cygwin.com/faq/faq_3.html#SEC101
> >>
> >Hello,
> >
> >Is there a way I can use debug_printf() inside C source (not C++). I've 
> >found <sys/strace.h> and <sys/ipctrace.h>.
> >
> >Googling and I don't find information about what I need to include, and 
> >probably what I need to link.
> >
> >#define TRACE
> >#include <stdio.h>
> >#include <sys/ipctrace.h>
> >
> >int main(void)
> >{
> >  debug_printf("TEST\n");
> >}
> >
> >It won't link, not finding _err_handler.
> 
> Just use regular printf or fprintf.  debug_printf is not intended for
> use outside of the cygwin DLL.
> 
> 


Hello Chris,

I'll see how I go. Printf's aren't very useful in this case as data is on the
console so rapid it's not easy to see what's going on. The problem occurs only
when there is serial input, console input and console output. Remove the serial
input or the console output and the problem goes away.

I did an 'strace' with everything. There appears some kind of race condition (my
software is not running any threads, it's using select() to completely manage
data). What I find interesting are error codes reported by Windows 995 "The I/O
operation has been aborted because of either a thread exit or an application
request." that occurs in the serial handler.

When I am running strace, the keyboard events are being missed completely (I
modified my code to quit in this case, but it doesn't when I'm running strace).
Also as a variant, I changed the behaviour of the console to have blocking reads
and it blocks without strace, but doesn't block with strace. Admittedly, just
about everything is being logged with strace.

Thanks,
Jason.


--
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