delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/11/19/03:46:06

Date: Mon, 19 Nov 2001 10:44:24 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
cc: djgpp-workers AT delorie DOT com
Subject: Re: RESEND: Patch to computer st_blksize in struct stat
In-Reply-To: <3BF82D64.84C50E28@phekda.freeserve.co.uk>
Message-ID: <Pine.SUN.3.91.1011119104341.8761J-100000@is>
MIME-Version: 1.0
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

On Sun, 18 Nov 2001, Richard Dawe wrote:

> Using gprof on src/libc/sys/stat/*stat.c I managed to get the following
> information. Here is the time spent in __dpmi_int() for running the
> fstat.c test on a file with the new block size support in *stat():
> 
> HD, CD-ROM drives: 0s (probably too short to measure)
> Floppy drive:      0.11s
> Network drive:     0.06s
> 
> In all cases the current code in CVS takes 0s on my machine (Athlon
> 850MHz) for the same files.

Perhaps it would be useful to run the test program on many files, not
only one file (unless you already tried that).

> I've added code to return 512 bytes as the block size for A:, B:.

This fact should be documented in libc.info.  Some rare configurations
might have unusual drive types mapped to A: or B:, and they might be
surprised by this default.

> I've also defaulted the block size to 32K for remote drives. If you
> don't think 0.06s is much overhead, then I can remove the hard-coded
> size for remote drives.

I think a constant default for networked drives is okay, since it
isn't meaningful in many cases, anyway.  However, 32K seems a bit
large; how about 4KB instead?

> Shouldn't xstat.c include sys/stat.h, to get common
> definitions for _STAT_*?

Yes, it should.  Thanks for catching this.

> BTW there seems to be some cruft in include/dos.h - should this be
> removed?
> 
>     /* int _get_default_drive(void);
>     void _fixpath(const char *, char *); */

Yes, definitely.

> +@findex stat AT r{, and block size}
> +@findex lstat AT r{, and block size}
> +@findex fstat AT r{, and block size}
> +The functions @code{stat}, @code{lstat} and @code{fstat} now fill
> +the @code{st_blksize} member of @code{struct stat} with the correct block
> +size for the device where the file is located.

I think we should mention the introduction of the new data types
blkcnt_t and blksize_t here.

- Raw text -


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