develooper Front page | perl.perl5.porters | Postings from March 2000

Re: Tom Horsley <>

Jarkko Hietaniemi
March 15, 2000 15:14
Re: Tom Horsley <>
Message ID:

> I haven't had time to pay a lot of attention to p5p, but I did see the
> announcement of perl-5.6.0-RC1 and have briefly looked at it, but I'm not
> sure what I should be doing to try and get the 64 bit file access interfaces
> to work on my system, so I'm hoping someone can point me to the right place
> in the maze of docs :-).
> PowerMAX OS does have the various stat64, etc. functions, but you
> (apparently) need to #define _LARGEFILE64_SOURCE to see them (I'm not sure I

This is probably the define for large files in a pure/maximal/total  
64-bit environment, which is probably not what you want, not at least
in the first phase.  Look for _LARGEFILE_SOURCE and _FILE_OFFSET_BITS,
those are the usual defines.

> understand why, since they all have unique names anyway).
> If I give that in the hints for PowerMAX compile flags, will it be used by
> Configure when it is probing for 64 bit file routines?

Configure doesn't probe for 64 bit file routines.  It probes for 64
bit wide file offsets.  I first tried probing for 64 bit file routines
but that turned out to be a rather useless and funless exercise
because each vendor seemed to have a different opinion on how to
enable large files.  To add to the misery, there might be *two* sets
of large file routines: first those for the mixed 32/64-bit
environment, and then those for the pure 64-bit environment.

Ideally, there should be some compiler flags that do all the necessary
magic, so that lseek() starts using 64-bit offsets, so that stat()
starts using a stat struct with 64-bit integer st_size, and so on.  If
your vendor has been nice, your getconf(1) might be able to tell you
what those flags are.  For example "getconf LFS_CFLAGS" might work.
Near the other end of the niceness spectrum, there is a big cpp forest
in perl.h that does cpp renaming for the various IO routines (stat to
stat64, that sort of thing) that you can try playing with.

There are two sets of IO routines you want to migrate to large
fileness: the raw UNIX/POSIX IO and the stdio.  In the latter group
note especially the ftell() and fseek().  Due to a standardisation
thinko, these ended up having a 'long' as the offset, not an 'off_t'.
The workaround which many platforms have adopted is to have ftello()
and fseeko(), which use 'off_t'.

> Do I have to have 64 bit integer support turned on as well? (How much of
> it?). Or can it still run with 32 bit ints (probably much faster) and just


> use doubles for file offsets which would probably be adequate even if it
> doesn't get all the way to 64 bits?
> Thanks for putting up with these questions I'd probably already know the
> answers to if I had been paying attention :-).

$jhi++; #
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About