[GRASS-dev] Re: vector large file support
Ivan Shmakov
oneingray at gmail.com
Sun Feb 8 03:14:14 EST 2009
>>>>> Glynn Clements <glynn at gclements.plus.com> writes:
>> Do I understand right that fseeko and ftello are only needed on
>> 32-bit systems that want D_FILE_OFFSET_BITS=64? fseek e.g. returns
>> long which is on my 64bit Linux 64bit, I guess that's why I can
>> write coor files > 2GB with the current vector libs.
> Yes. There's no point in using them unless off_t is larger than long
> (i.e. 64-bit off_t versus 32-bit long).
I think there is. Per POSIX, off_t is /the/ type to hold file
offsets and lengths. The intention is for the program to retain
portability whatever numeric types exists on a target. I guess,
it will even work if none of the standard C `int' types match
`off_t' (although it's probably quite unlikely to become an
issue for GRASS in a foreseeable future.)
>>> It's not worth using "raw" I/O just to avoid this issue. Apart from
>>> anything else, there's a potentially huge performance hit, as the
>>> vector library tends to use many small read/write operations. Using
>>> low-level I/O requires a system call for each operation, while the
>>> stdio interface will coalesce these, reading/writing whole blocks.
>> Interesting and good to know. So we do need G_fseek() and G_ftell()
> Yes. Those would be useful regardless of anything related to the
> vector format.
And, as it seems, Gnulib already has them:
http://www.gnu.org/software/gnulib/MODULES.html#module=ftello
http://www.gnu.org/software/gnulib/MODULES.html#module=fseeko
[...]
PS. ... And please forgive me for mentioning Gnulib with such a
persistence without investing a bit of time to further its
adoption into GRASS. Unfortunately, I'm somewhat overloaded
with my work lately.
More information about the grass-dev
mailing list