chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] file-size not reporting correct size on big files


From: Peter Bex
Subject: [Chicken-hackers] file-size not reporting correct size on big files
Date: Sun, 28 Oct 2007 21:49:38 +0100
User-agent: Mutt/1.4.2.3i

Hi there,

When debugging the sendfile egg we discovered that Chicken itself does
not report correct file sizes on really big files (> 1Gb) on 32-bit
architectures.  We're not sure if this happens on all systems, but
we've tried on NetBSD and Linux.

We're still not sure what's going on here, but it looks like somehow the
stat.stat_st_size struct member is a regular integer and the
stat.stat_st_blocks is an int64.  (although testing it with a simple 
printf("off_t: %i, blkcnt_t: %i\n", sizeof(off_t), sizeof(blkcnt_t));
seems to indicate both are 64-bit on my machine, and both are 32-bit
on David's machine, oddly enough file-size is broken on both machines!)

Applying the attached patch to posixunix.scm fixes the problem - for us.
Unfortunately, according to the Single Unix Spec we can't assume the
blocksize is always 512 bytes:
http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html

David's thoughts were that we could check for definedness of DEV_BSIZE
and use that if possible, and fall back to a default of 512 bytes.

What do you guys think?

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: posixunix.scm.diff
Description: Text document

Attachment: pgpahNybKpIOs.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]