|
Boost : |
Subject: Re: [boost] [btree] Large file support
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2010-10-01 09:31:25
On Fri, Oct 1, 2010 at 1:59 PM, Beman Dawes <bdawes_at_[hidden]> wrote:
> The btree library uses low level I/O. On POSIX-like systems that means
> read/write/lseek. lseek() won't support large files on systems where
> long is 32 bits.
>
> POSIX-like operating systems get around this problem by supply
> functions with names like llseek or lseek64 that traffic in long long
> instead of long.
>
[...]
> Up at the front of the source file there may also have to be special
> headers included or symbols defined, depending on the operating
> system.
>
> I'd appreciate some help from folks familiar with particular
> non-Windows operating systems. What is the preferred name for the
> 64-bit seek function and what is the preferred #if defined(symbol)? Do
> special headers have to be included or special symbols defined?
>
IIRC that today posix/SUSv4 simply declares
off_t lseek(int fildes, off_t offset, int whence);
Unistd.h has the following macros:
_XBS5_ILP32_OFF32
Implementation provides a C-language compilation environment with
32-bit int, long, pointer and off_t types.
_XBS5_ILP32_OFFBIG
Implementation provides a C-language compilation environment with
32-bit int, long and pointer types and an off_t type using at least 64
bits.
_XBS5_LP64_OFF64
Implementation provides a C-language compilation environment with
32-bit int and 64-bit long, pointer and off_t types.
_XBS5_LPBIG_OFFBIG
Implementation provides a C-language compilation environment with
an int type using at least 32 bits and long, pointer and off_t types
using at least 64 bits.
reference (and more) here:
http://opengroup.org/onlinepubs/007908799/xsh/unistd.h.html
llseek and lseek are non portable remainants of the move to large
files. Most unix systems should have moved to the standard interface.
Usually macros are available to map the lseek interface to the non
portable internal interface. I think linux uses _FILE_OFFSET_BITS.
HTH,
-- gpd
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk