delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/11/11/15:18:02

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10111111931.AA17953@clio.rice.edu>
Subject: Re: RESEND: Patch to computer st_blksize in struct stat
To: djgpp-workers AT delorie DOT com
Date: Sun, 11 Nov 2001 13:31:30 -0600 (CST)
Cc: rich AT phekda DOT freeserve DOT co DOT uk
In-Reply-To: <3BEE6BCC.C6164CD0@phekda.freeserve.co.uk> from "Richard Dawe" at Nov 11, 2001 12:15:08 PM
X-Mailer: ELM [version 2.5 PL2]
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

> Below is a patch to compute st_blksize in struct stat. This is basically
> the st_blocks patch with the st_blocks stuff removed.

Since we fill out st_rdev, should the comment /* unused */ be removed?
I know it's not related to this patch, but it removes incorrect 
information in the header:

> *** include/sys/stat.h  2000/12/05 14:05:53     1.4
...
>     off_t               st_size;
> !   blksize_t   st_blksize;
>     uid_t               st_uid;
>     dev_t               st_rdev; /* unused */
>   };

In stat.txh and lstat.txh this field should also be documented. 

> Index: src/libc/posix/sys/stat/xstat.c
...
> + 
> +   _fixpath(path, fixed_path);
> +   d = tolower(path[0]) - 'a';

Calling fixpath just to get the drive letter seems like overkill here.
If the in path has a ':' in the second char we could use it; else get
the current drive.  If you do call fixpath there is no need to tolower
the character since it will always be lower case.  But for drives > 26
this algorithm also returns the wrong drive number (must subtract 'A' -
a minor issue since I've never worked on a system that supported these).

- Raw text -


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