64-bit seek()/tell()?

Discussion in 'Perl Misc' started by Glenn, Sep 23, 2007.

  1. Glenn

    Glenn Guest

    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?
     
    Glenn, Sep 23, 2007
    #1
    1. Advertising

  2. Glenn

    Guest

    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.
     
    , Sep 23, 2007
    #2
    1. Advertising

  3. Glenn

    Glenn Guest

    > > 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.
     
    Glenn, Sep 23, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Prabhu Ramachandran

    Trouble with file.seek/file.tell on Win32?

    Prabhu Ramachandran, Aug 15, 2004, in forum: Python
    Replies:
    0
    Views:
    442
    Prabhu Ramachandran
    Aug 15, 2004
  2. Tim Peters
    Replies:
    0
    Views:
    622
    Tim Peters
    Aug 15, 2004
  3. Prabhu Ramachandran

    Re: Trouble with file.seek/file.tell on Win32?

    Prabhu Ramachandran, Aug 16, 2004, in forum: Python
    Replies:
    2
    Views:
    513
    Christos TZOTZIOY Georgiou
    Aug 16, 2004
  4. N. Volbers
    Replies:
    3
    Views:
    376
    =?iso-8859-1?q?Lars_Gust=E4bel?=
    Jun 30, 2005
  5. Replies:
    3
    Views:
    152
    Andreas Perstinger
    May 14, 2013
Loading...

Share This Page