64-bit seek()/tell()?

64-bit seek()/tell()?

am 23.09.2007 04:36:14 von eponymousalias

Is a 64-bit file offset supported in seek() and/or tell()?

I thought the "no limits" philosophy of Perl would mean
this is no problem on my 64-bit Linux platform. But my
program seems to be acting as though file offsets are
only processed as 32-bit values.

Given that I want the buffering of the <> operator, and
thus don't want to use sysseek(), what are my options?

Re: 64-bit seek()/tell()?

am 23.09.2007 04:41:25 von Joe Smith

Glenn wrote:
> Is a 64-bit file offset supported in seek() and/or tell()?

Yes, provide that your copy of perl was compiled with largefile support.

linux% perl -V | egrep 'Summary|largefiles='
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef

-Joe

Re: 64-bit seek()/tell()?

am 23.09.2007 05:00:20 von xhoster

Glenn wrote:
> Is a 64-bit file offset supported in seek() and/or tell()?

On my system it is.

$ strace perl -le 'seek STDIN, 1<<63,0' |& tail -n 3
close(3) = 0
lseek(0, 9223372036854775808, SEEK_SET) = -1 ESPIPE (Illegal seek)
exit_group(0) = ?


> I thought the "no limits" philosophy of Perl would mean
> this is no problem on my 64-bit Linux platform. But my
> program seems to be acting as though file offsets are
> only processed as 32-bit values.

What specific observations is that based on? What compilation options
were used when you built Perl (perl -V)?

>
> Given that I want the buffering of the <> operator, and
> thus don't want to use sysseek(), what are my options?

On my system, seek and sysseek result in the same underlying system
call being issued. The difference is only in perl's internal
accounting, not the system's.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.

Re: 64-bit seek()/tell()?

am 23.09.2007 05:14:16 von eponymousalias

> > Is a 64-bit file offset supported in seek() and/or tell()?
>
> Yes, provide that your copy of perl was compiled with largefile support.
>
> linux% perl -V | egrep 'Summary|largefiles='
> Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
> useperlio=define d_sfio=undef uselargefiles=define usesocks=undef

Thanks. I'm using a properly compiled copy, but you just gave me
the clue that caused me to figure out the silly bug in my own code.