delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/25/23:44:37

X-Authentication-Warning: new-smtp2.ihug.com.au: Host p234-tnt6.syd.ihug.com.au [203.173.146.234] claimed to be acceleron
Message-ID: <007401c12dd7$7fa4cd50$0a02a8c0@acceleron>
From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
To: "Charles Sandmann" <sandmann AT clio DOT rice DOT edu>,
"Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Cc: <djgpp-workers AT delorie DOT com>
References: <10108251652 DOT AA17486 AT clio DOT rice DOT edu>
Subject: Re: Read 3F00 STDIN problem on Win 2K ( was Re: Fseek on STDIN problem on Win 2K)
Date: Sun, 26 Aug 2001 12:33:30 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
Reply-To: djgpp-workers AT delorie DOT com

Charles & Eli,

Updated example, usgaeinfo and results below from my testing ysterday.

Yesterday I moved along with the testing and further refined the issue so
that in my testing I found that the 3F00 calls were causing the problem. I
hastely setup a home page at my ISP this morning and put the updated source
code there. The URL is http://homepages.ihug.com.au/~acottrel/ The code is
too large to include in this email.

I have further refined and at the same time expanded it to include all of
the relevant files so that I can modify the source and re-build without the
need to rebuild LIBC..

Let me explain:

1) I have refined the sample so that the problem can now be seen with either
a call to get_magic() or a _read(). As usual in my test program so that I
call the modified functions I have pre-appended 'ac' to them. The following
is the refined main sample code that IO am now using for testing:

    #if 0
        magic_number = ac_get_magic((const char *)0, STDIN_FILENO);
    #else
        ac_read(STDIN_FILENO,&c,1);
    #endif

        seeker = seekerprint(0);
        seeker = seekerprint(1);
        seeker = seekerprint(2);
        seeker = seekerprint(3);
        seeker = seekerprint(4);
        seeker = seekerprint(5);

Where seekerprint() does an lseek and then a read of one character  and
prints it.

2) I have expanded the sample to use the modified source files from the LIBC
locally which are used included in the build to produce seek.exe. This
ensures that I am testing with realistic LIBC source.

3) To turn off / on the poposed changes change the folloing line in main()
from 0 to 1 or vice versa.
    USE_EXTRA_4201_CALL = 0;

    I defined this variable in all uppper cases as it stands out as being
WRONG and as such is very easy to find and should not be included in the
final change. Better safe than sorry.

4) The seeksrc.zip includes the following files:
Archive:  seeksrc.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
     2451  26-08-01 02:44   d_read.c
    31160  26-08-01 02:19   fstat.c
     3779  26-08-01 02:44   int86.c
     7050  26-08-01 02:44   is_exec.c
     1559  26-08-01 01:45   lseek.c
     2590  26-08-01 02:45   seek.c
     8334  10-03-01 13:09   xstat.c
     1839  26-08-01 02:44   _read.c
     2717  10-03-01 13:09   xstat.h
    12024  26-08-01 02:20   makefile
       23  21-08-01 12:42   test
 --------                   -------
    73526                   11 files

5) If you download the code and leave it as and just compile it. It does the
following:
    a) does not include any extra calls to 4201
    b) reads one character from STDIN
    c) perfoms an lseek and reads the next character & then displays it
    d) repeats this as per the code snippet above

    The output I got was:
            DJGPP_204 D:\dj204\work\seek>seek <test
            USE_EXTRA_4201_CALL = False
            FAIL - Char at offset [0] = (2)
            FAIL - Char at offset [1] = (3)
            FAIL - Char at offset [2] = (4)
            FAIL - Char at offset [3] = (5)
            FAIL - Char at offset [4] = (6)
            FAIL - Char at offset [5] = (7)

6) If you turn on the extra 4201 call by modifying the USE_EXTRA_4201_CALL =
0 to USE_EXTRA_4201_CALL = 1, then the output becomes:

            DJGPP_204 D:\dj204\work\seek>seek <test
            USE_EXTRA_4201_CALL = True
            OKAY - Char at offset [0] = (1)
            OKAY - Char at offset [1] = (2)
            OKAY - Char at offset [2] = (3)
            OKAY - Char at offset [3] = (4)
            OKAY - Char at offset [4] = (5)
            OKAY - Char at offset [5] = (6)




- Raw text -


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