To: Richard Dawe Cc: Eli Zaretskii , DJGPP workers Subject: Re: struct stat and st_blocks In-Reply-To: <3E351138.4D0A67E5@phekda.freeserve.co.uk> (Richard Dawe's message of "Mon, 27 Jan 2003 11:00:08 +0000") References: <3E351138 DOT 4D0A67E5 AT phekda DOT freeserve DOT co DOT uk> From: Jim Meyering Date: Mon, 27 Jan 2003 14:34:46 +0100 Message-ID: <85d6mik96x.fsf@pi.meyering.net> Lines: 48 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 Precedence: bulk Richard Dawe wrote: > Hello. > > Jim: struct stat on DJGPP does not contain st_blocks. > > Eli Zaretskii wrote: > [snip] >> > coreutils 4.5.4 uses st_blocks in the 'stat' program. >> >> What does `stat' do if st_blocks is not supported? Is the degradation in >> functionality significant? > > It just reports the value of st_blocks. > > There is a configure-time check for the st_blocks and st_blksize members. If > st_blocks isn't present, but st_blksize is, I was going to make it return > st_size / st_blksize rounded up. If neither st_blocks nor st_blksize is > present, then I'm not sure what we can do: I was going to make it return 0. Hi Rich, Thanks for reporting that! I've just made the following change. I'm not sure it's enough, but it may well be, since that use of st_blocks in stat.c was the only one like it in all of src/*.c. * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'. Reported by Richard Dawe. Index: stat.c =================================================================== RCS file: /fetish/cu/src/stat.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -p -u -r1.34 -r1.35 --- stat.c 15 Dec 2002 20:45:57 -0000 1.34 +++ stat.c 27 Jan 2003 13:32:44 -0000 1.35 @@ -531,7 +531,7 @@ print_stat (char *pformat, char m, char break; case 'b': strcat (pformat, "u"); - printf (pformat, (unsigned int) statbuf->st_blocks); + printf (pformat, (unsigned int) ST_NBLOCKS (*statbuf)); break; case 'o': strcat (pformat, "d");