64-bit seek()/tell()?

G

Glenn

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?
 
X

xhoster

Glenn said:
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.
 
G

Glenn

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top