[Raleigh-talk] lstat/stat problem
Ed Deloye
EDeloye at rfmd.com
Thu Mar 6 07:37:25 PST 2008
I am having a problem with lstat not working the way I think it should.
Here is the test script that I created to verify what is happening.
#!/usr/local/bin/perl
use File::Find;
find( \&wanted,
"/projects/lcasas/tsmc/tsmc90lp/cds/xor/ScottsValley_s_8906" ) ;
sub wanted {
no warnings;
my ( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev,
$size, $atime, $mtime, $ctime );
my ( $sec, $min, $hour, $mday, $mon, $timeyear );
return unless ( -f $_ or -l $_ );
( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
$atime, $mtime, $ctime ) = lstat($_);
( $sec, $min, $hour, $mday, $mon, $timeyear ) =
localtime($mtime);
$timeyear += 1900;
printf
"%s;%s;%s;%s-%02d-%02d;%02d:%02d:%02d;%d\n",
$File::Find::name, $uid, $gid,
$timeyear, ++$mon, $mday, $hour, $min, $sec, $size;
}
I ran strace and got this output (truncated):
lstat("/projects/lcasas/tsmc/tsmc90lp/cds/xor/ScottsValley_s_8906",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chdir("/projects/lcasas/tsmc/tsmc90lp/cds/xor/ScottsValley_s_8906") = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open(".", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
getdents64(3, /* 7 entries */, 32768) = 248
getdents64(3, /* 0 entries */, 32768) = 0
close(3) = 0
stat("ScottsValley_s_8906.gds", <unfinished ...>
The lstat function is called but a stat is invoked. Can anyone shed any
light on what is happening?
Thanks for your help,
Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/raleigh-talk/attachments/20080306/95c1af79/attachment.html
More information about the Raleigh-talk
mailing list