access to stat from open() call

E

ekolve

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
 
M

Mr P

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
 
E

ekolve

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.
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top