Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > access to stat from open() call

Reply
Thread Tools

access to stat from open() call

 
 
ekolve@gmail.com
Guest
Posts: n/a
 
      11-30-2005
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:pen
into a perl filehandle without having a stat call performed?

thanks,
eric

 
Reply With Quote
 
 
 
 
Mr P
Guest
Posts: n/a
 
      11-30-2005

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: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

 
Reply With Quote
 
 
 
 
ekolve@gmail.com
Guest
Posts: n/a
 
      11-30-2005
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
os.stat() distorts filenames that end with period (nt.stat()) ruck Python 10 09-07-2012 05:54 AM
Why do I have to prefix stat from <sys/stat.h> with the keyword struct? Rolf Krüger C++ 2 03-12-2008 10:38 PM
Date & Time representation in "struct stat" - <sys/stat.h> Magesh C Programming 3 10-05-2007 12:13 PM
struct stat st; stat(fileName.c_str(), &st); hu? Steven T. Hatton C++ 3 06-02-2005 01:50 PM
os.stat('<filename>')[stat.ST_INO] on Windows Patrick Useldinger Python 6 03-03-2005 09:21 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57