[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] file-size not reporting correct size on big files
From: |
Zbigniew |
Subject: |
Re: [Chicken-hackers] file-size not reporting correct size on big files |
Date: |
Sun, 28 Oct 2007 20:41:25 -0500 |
ok, there are 2 issues here: first, your 32-bit app needs to be
compiled with large file support to transparently recognize >32-bit
sizes. second, chicken's using an unsigned-int as a substitute for
off_t which is strictly speaking incorrect. i attached a kludgy patch
which happens to make 32-bit Linux work by defining
_FILE_OFFSET_BITS=64 and additionally changing the type of st_size to
integer64.
do not use this patch in production. 1) width of st_size is not
properly set according to actual size of off_t. 2) 32-bit values are
still used for other fields, and an error will no longer be signaled
when the 32-bit limit is exceeded (see below).
with some elbow grease this a proper change could be done.
$ uname -a
Linux 2.6.7-j1 #1 Sat Aug 14 17:33:52 CDT 2004 i686 GNU/Linux
$ ll big.txt
-rw-r--r-- 1 jim jim 10,737,418,241 2007-10-28 19:28 big.txt
$ csi -R posix
#;1> (file-size "big.txt")
Error: (file-size) cannot access file - Value too large for defined
data type: "big.txt"
w/patch:
$ csi -R posix
#;1> (file-size "/tmp/big.txt")
10737418241.0
On 10/28/07, Peter Bex <address@hidden> wrote:
> 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.
big.diff
Description: Binary data