ext4, fsync(2), and perl

Christopher Chan christopher.chan at bradbury.edu.hk
Fri Mar 5 02:41:53 UTC 2010


>> Any ideas how to properly fsync the directory in perl?
>
>     my $hd;
>     open($hd, $histdir);
>     link ($history, "$history-$ymd_hms") unless -e "$history-$ymd_hms";
>     rename "$history.$$", $history or die "Cant rename: $!";
>     unless (fsync($hd)) {
>       print STDERR "error: problem fsync-ing directory '$histdir': $!\n";
>       close($dh);

Oops, sorry, typo. That should be $hd

>       return 0;
>     }




More information about the ubuntu-users mailing list