delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/05/02:05:10

X-Authentication-Warning: new-smtp2.ihug.com.au: Host p58-max49.syd.ihug.com.au [203.173.144.122] claimed to be acceleron
Message-ID: <00e401c11d73$e11f3d50$0a02a8c0@acceleron>
From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
To: <djgpp-workers AT delorie DOT com>
Cc: "Charles Sandmann" <sandmann AT clio DOT rice DOT edu>,
"Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Subject: Windows 2000 utime query
Date: Sun, 5 Aug 2001 16:00:06 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Reply-To: djgpp-workers AT delorie DOT com

I  may have found another low level problem with Win2000, this time with
utime. The problem manifests itself when using touch and cp with the -p
option (used in building GCC stage 1). There may be other exe's affected.
This issue has stopped me building GCC on Windows 2000.

The output from my testing and the modified touch source is included below.
On Win98 the r.x.flags return 0x3002. The data from Win98 meachine is:
fildes = 5
dostime = 32358
date = 11013

As you can see the PC's are not in time sync, but the time still appears to
be valid. I modifed the utime in the test to see if the Windows 9x LFN
0x5705 returned a correct result, but it also failed.

Any suggestions or ideas?

WINDOWS 2000 output (modifed to save space):
DJGPP_204 D:\dj204\contrib\test>i:touch.exe  old.txt
touch.c 117
utime.c 39
seconds [0-60] = 55, minutes [0-59] = 45, hours [0-23] = 15, day [1-31] = 5,
months [0-11] = 7, years = 101, days since Sunday [0-6] = 0,  days since
January 1 [0-365] = 216
Daylight Savings Time flag = 0, offset from GMT in seconds = 36000, timezone
abbreviation = EST
fildes = 5
dostime = 32187
dosdate = 11013
utime.c 79 r.x.flags = 0x3
utime.c 83
utime.c 89
fildes = 5
dostime = 32187
dosdate = 11013
utime.c 107 r.x.flags = 0x3
utime.c 111
utime.c 121
touch.c 168 file = "old.txt"status = -1
touch.c 196 status = -1
touch.c 200
i:/dj204/gnu/filutil4.0/src/touch: old.txt: Input or output error (EIO)

Modified source snippet from utime.c
  dosdate = tm->tm_mday + ((tm->tm_mon + 1) << 5) +
    ((tm->tm_year - 80) << 9);
  dostime = tm->tm_sec / 2 + (tm->tm_min << 5) +
    (tm->tm_hour << 11);

printf("seconds after the minute [0-60] = %d\n", tm->tm_sec);
printf("minutes after the hour [0-59] = %d\n",  tm->tm_min);
printf("hours since midnight [0-23] = %d\n",  tm->tm_hour);
printf("day of the month [1-31] = %d\n",    tm->tm_mday);
printf("months since January [0-11] = %d\n",   tm->tm_mon);
printf("years since 1900 = %d\n",   tm->tm_year);
printf("days since Sunday [0-6] = %d\n",    tm->tm_wday);
printf("days since January 1 [0-365] = %d\n",   tm->tm_yday);
printf("Daylight Savings Time flag = %d\n", tm->tm_isdst);
printf("offset from GMT in seconds = %d\n", tm->tm_gmtoff);
printf("timezone abbreviation = %s\n",tm->tm_zone);

printf("fildes = %d\n" ,fildes);
printf("dostime = %d\n", dostime);
printf("dosdate = %d\n", dosdate);

  /* Set the file timestamp */
  r.h.ah = 0x57; /* DOS FileTimes call */
  r.h.al = 0x01; /* Set date/time request */
  r.x.bx = fildes; /* File handle */
  r.x.cx = dostime; /* New time */
  r.x.dx = dosdate; /* New date */
  __dpmi_int(0x21, &r);
printf("%s 79 r.x.flags = 0x%X\n",__FILE__,r.x.flags);
  if (r.x.flags & 1)
  {
    e = EIO;
printf("%s 83\n",__FILE__);
    retval = -1;
  }
//  else
  if (_USE_LFN)
  {
printf("%s 89\n",__FILE__);
    /* We can set access time as well.  */
    if (times)
      modtime = times->actime;
    tm = localtime(&modtime);
    dosdate = tm->tm_mday + ((tm->tm_mon + 1) << 5) +
      ((tm->tm_year - 80) << 9);
    dostime = tm->tm_sec / 2 + (tm->tm_min << 5) +
      (tm->tm_hour << 11);

printf("fildes = %d\n" ,fildes);
printf("dostime = %d\n", dostime);
printf("dosdate = %d\n", dosdate);
    r.x.ax = 0x5705;
    r.x.bx = fildes;
    r.x.cx = dostime; /* this might be ignored */
    r.x.dx = dosdate;
    __dpmi_int(0x21, &r);
printf("%s 107 r.x.flags = 0x%X\n",__FILE__,r.x.flags);
    if (r.x.flags & 1)
    {
      e = EIO;
printf("%s 111\n",__FILE__);
      retval = -1;
    }
  }


Andrew

- Raw text -


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