www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/11/23/23:52:31

Message-ID: <000b01c174a3$9ff1cdc0$0100a8c0@pentiumii>
From: "Dennis Louie" <dennis-louie AT att DOT net>
To: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Cc: <djgpp-workers AT delorie DOT com>
References: <000801c173e3$de003310$0100a8c0 AT pentiumii> <1438-Fri23Nov2001103147+0200-eliz AT is DOT elta DOT co DOT il>
Subject: Re: statfs not returning correct cluster size
Date: Fri, 23 Nov 2001 20:44:19 -0800
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-Mimeole: Produced By Microsoft MimeOLE V6.00.2600.0000
Reply-To: djgpp-workers AT delorie DOT com

Eli,

Is this is the info you wanted?  The DOS system call is Int 21h, Function
36h, called via __dpmi_int(0x21, &regs).  AX appears to be returning the
wrong number of sectors per cluster.  I determined experimentally and via
PartitionMagic that the cluster size for my C: drive is 1K, so I expect AX
to be 2 and CX to be 512, but AX is set to 64.  free*bsize gives a number
that's close to the free space, but blocks is about half what it should be
(assuming bsize is correct - which it isn't).

My libc.a is:
         DJGPP libc built Nov  5 2001 22:01:02 by gcc 2.95.3 20010315/djgpp
(release) $

Thanks,
Dennis

(gdb) s
statfs (path=0x1e01 "c:/", buf=0x93304) at statfs.c:146
146       if( 7 <= _osmajor && _osmajor < 10 ) /* Are INT21 AX=7303 and/or
(gdb) s
243         if( ! cdrom_calls_used )
(gdb) s
245           if( use_AH0x36( drive_number, &blocks, &free, &bsize ) == -1 )
(gdb) s
use_AH0x36 (drive_number=2, blocks=0x93274, free=0x93270, bsize=0x9326c)
    at statfs.c:104
104       regs.h.ah = 0x36;  /* DOS Get Free Disk Space call */
(gdb) s
105       regs.h.dl = drive_number + 1;
(gdb) s
106       __dpmi_int(0x21, &regs);
(gdb) s
109       if ((regs.x.ax & 0xffff) == 0xffff)
(gdb) s
114       *bsize = regs.x.cx * regs.x.ax;
(gdb) s
115       *free = regs.x.bx;
(gdb) s
116       *blocks = regs.x.dx;
(gdb) s
118       return 0;
(gdb) p regs.x.cx
$2 = 512
(gdb) p regs.x.ax
$3 = 64
(gdb) p bsize
$4 = (long *) 0x9326c
(gdb) p *bsize
$5 = 32768
(gdb) where
#0  use_AH0x36 (drive_number=2, blocks=0x93274, free=0x93270, bsize=0x9326c)
    at statfs.c:118
#1  0x26aa in statfs (path=0x1e01 "c:/", buf=0x93304) at statfs.c:245
#2  0x1ecf in main (argc=1, argv=0x93c44) at statfsdbg.c:16
#3  0x416f in __crt1_startup ()

----- Original Message -----
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
To: "Dennis Louie" <dennis-louie AT att DOT net>
Cc: <djgpp-workers AT delorie DOT com>
Sent: Friday, November 23, 2001 12:31 AM
Subject: Re: statfs not returning correct cluster size


> > From: "Dennis Louie" <dennis-louie AT att DOT net>
> > Date: Thu, 22 Nov 2001 21:58:24 -0800
> >
> > Has anyone encountered a problem with statfs not returning the correct
> > info in DJGPP 2.04 for Win2K/XP?  I'm running XP Pro.
> >
> > I have partitions with 1K and 4K cluster sizes, but statfs returns 32K
> > for both.  It also appears to be returning incorrect values for
> > f_blocks, even for disk sizes under 2GB.  I seem to be getting the
> > correct info for a 1.4MB floppy disk.
>
> Thanks for reporting this.
>
> Please step with a debugger into statfs, and see which system call
> returns the incorrect info.  Then post the results here.
>

- Raw text -


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