Boost logo

Boost :

Subject: [boost] [btree] Large file support
From: Beman Dawes (bdawes_at_[hidden])
Date: 2010-10-01 08:59:17


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.

So there is a line of code:

new_offset = ::lseek(handle(), offset, whence); // offset is a
variable of type int64_t

That needs to change to something like:

#if defined(SOMEOS)
    new_offset = ::|lseek(handle(), offset, whence);
#elif defined(ANOTHEROS)
    new_offset = ::whatever(handle(), offset, whence);
#else
    new_offset = ::lseek(handle(), offset, whence);
#endif

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?

Thanks,

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk