delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/07/30/09:17:19

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
Date: Fri, 30 Jul 2004 09:15:39 -0400
From: "Pierre A. Humblet" <pierre DOT humblet AT ieee DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: text/binmode endless loop
Message-ID: <20040730131539.GA699357@Worldnet>
References: <Pine DOT LNX DOT 4 DOT 58 DOT 0407292214020 DOT 9508 AT odoaker DOT hrz DOT tu-chemnitz DOT de> <20040729232510 DOT GA19261 AT trixie DOT casa DOT cgf DOT cx> <ced4lp$bas$1 AT sea DOT gmane DOT org> <20040730101454 DOT GC1762 AT cygbert DOT vinschen DOT de>
Mime-Version: 1.0
In-Reply-To: <20040730101454.GC1762@cygbert.vinschen.de>
User-Agent: Mutt/1.4.1i

On Fri, Jul 30, 2004 at 12:14:54PM +0200, Corinna Vinschen wrote:
> On Jul 30 09:33, Alexander Gottwald wrote:
> > Christopher Faylor wrote:
> > > 
> > > This shows write() being called repeatedly.  The fact that
> > > setmode_helper shows up a bunch of time doesn't mean that it is caught
> > > in a loop.  You can't infer that from strace.  You'd need to confirm
> > > that with gdb.
> > 
> > But why does it change repeatedly from text to bin and back to text?
> 
> That's a good question.  The output is generated by calls to the setmode
> function.  Since setmode isn't called from inside Cygwin, it must be
> called from the application.  It looks like a race but actually that's
> something you will have to debug.  Concentrate on calls to getmode and
> setmode for the beginning.

I think it's because newlib handles textmode itself, instead of relying
on Cygwin. So before every write it changes the mode to binmode, then it
calls write, and finally puts the mode back into text mode.
In addition setmode calls setmode_helper in syscalls.cc, and it walks all
file descriptors. The word "improbable" in the strace output should be
removed! However the loop seems to be run twice, not sure why.

Pierre

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