www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/20/10:27:51

Date: Mon, 20 Aug 2001 17:24:51 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: acottrel AT ihug DOT com DOT au
Message-Id: <2110-Mon20Aug2001172450+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: sandmann AT clio DOT rice DOT edu, djgpp-workers AT delorie DOT com
In-reply-to: <002501c12980$4c67fa80$0a02a8c0@acceleron> (acottrel@ihug.com.au)
Subject: Re: Fseek on STDIN problem on Win 2K
References: <10108200508 DOT AA15103 AT clio DOT rice DOT edu> <2950-Mon20Aug2001093159+0300-eliz AT is DOT elta DOT co DOT il> <002501c12980$4c67fa80$0a02a8c0 AT acceleron>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
> Date: Mon, 20 Aug 2001 23:58:40 +1000
> 
> > If _is_executable is the suspect, it can be disabled by setting the
> > _STAT_EXEC_MAGIC bit in _djstat_flags.
> In my testing I found that I can "fix" the problem by one of the following
> methods:
>     a) Commenting out the _is_executable() call in fstat.c
>     b) Setting the  _STAT_EXEC_MAGIC bit in _djstat_flags
>     b) adding a _read() to the  _is_executable() function before or after
> the second 4200 call.
>     c) Debug the new sample under Rhide

I don't understand the (c) above (it's probably due to the fact that
RHIDE and GDB use FSEXT to watch handle usage by the debuggee), but
otherwise it sounds like _is_executable is the prime suspect.  But I
cannot figure out why: all it does is move the file pointer (which is
actually a no-op, since stdin was not read yet), reads two bytes, and
then moves the file pointer again.  One idea would be to selectively
disable parts of _is_executable and see which one(s) cause the
problem.

> I tried to find where STDIN is setup, but I couldn't see it. I do not think
> I am looking for the right thing. I searched for STDIN and couldn't see
> anything useful, I loked in crt1.c. Could someone please point me in the
> direction of where STDIN is setup/configured?

What ``setup'' exactly are you looking for?

stdin is a buffered stream, and its set up in
src/libc/ansi/stdio/stdin.c.  But I don't think this is relevant to
the issue at hand, since we now know the problem is with lseek, not
with fseek.  And lseek works on the file handle, not on the FILE
object.  File handle zero is the one which corresponds to standard
input, and the shell connects that handle to the file when you
redirect it.

Does that answer your question?

- Raw text -


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