Subject: | 64-bit off_t map position |
Date: | Fri, 16 Apr 2010 09:53:03 +1000 |
To: | bug-File-Map [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
On debian i386 5.10 perl uses _FILE_OFFSET_BITS 64 so off_t is 64-bits
and mmap() does in fact support offsets up to 2**44 or some such amount.
It'd be good if File::Map passed such an offset through to the system
call, so as to get at portions of files bigger than 4Gbytes.
I see the typemap setup for off_t goes through an IV, which truncates to
32 bits. The easiest thing might be an NV and cast that to off_t,
perhaps like, untested,
(sizeof(off_t) > sizeof(IV) && NV_PRESERVES_UV
? (off_t) SvNV($arg)
: SvIV($arg))
That'd get 53 bits out of the scalar, and worry about a proper sv -> I64
later. The perl-glib wrappers go via a string and atoll(), maybe the
perl has something similar or better lurking.