access to stat from open() call

Discussion in 'Perl Misc' started by ekolve@gmail.com, Nov 30, 2005.

  1. Guest

    I notice that when I strace a perl script that has an open() call, a
    stat call is made. Is there anyway to access this information to avoid
    doing a second stat call?

    Alternatively, is there a way to turn a fd returned from POSIX::eek:pen
    into a perl filehandle without having a stat call performed?

    thanks,
    eric
     
    , Nov 30, 2005
    #1
    1. Advertising

  2. Mr P Guest

    wrote:
    > I notice that when I strace a perl script that has an open() call, a
    > stat call is made. Is there anyway to access this information to avoid
    > doing a second stat call?
    >
    > Alternatively, is there a way to turn a fd returned from POSIX::eek:pen
    > into a perl filehandle without having a stat call performed?
    >
    > thanks,
    > eric


    Hello Eric:

    I tried to trace an open call with "s" and it doesn't descend into the
    function. I have seen cases when an error occurs and it does descend.
    How did you discover the stat call?

    Mr P
     
    Mr P, Nov 30, 2005
    #2
    1. Advertising

  3. Guest

    Run the following script:

    #!/usr/bin/perl -w
    open(FILE, "<", "open.pl") || die "$!";
    close(FILE);

    >From the command line run:


    strace perl open.pl

    You should see the calls near the end. I am running Fedora Core 4 /
    perl 5.8.6.
     
    , Nov 30, 2005
    #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. Steven T. Hatton
    Replies:
    3
    Views:
    9,712
    Pete Becker
    Jun 2, 2005
  2. Patrick Useldinger

    os.stat('<filename>')[stat.ST_INO] on Windows

    Patrick Useldinger, Feb 27, 2005, in forum: Python
    Replies:
    6
    Views:
    1,178
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Mar 3, 2005
  3. Magesh
    Replies:
    3
    Views:
    444
    Gordon Burditt
    Oct 5, 2007
  4. Rolf Krüger
    Replies:
    2
    Views:
    616
    Ian Collins
    Mar 12, 2008
  5. ruck
    Replies:
    10
    Views:
    1,278
Loading...

Share This Page