/usr/lib/x86_64-linux-gnu/perl5/5.26/File/Sync.pm is in libfile-sync-perl 0.11-2build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | # File::Sync.pm
#
# Copyright © 1997,1999 Carey Evans. All rights reserved. This module is
# free software; you can redistribute it and/or modify it under the same
# terms as Perl itself.
package File::Sync;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
require Exporter;
require DynaLoader;
require AutoLoader;
use Carp;
use Symbol qw(qualify_to_ref);
@ISA = qw(Exporter DynaLoader);
# Items to export into callers namespace by default.
@EXPORT = ();
@EXPORT_OK = qw(
sync
fdatasync
fsync
fdatasync_fd
fsync_fd
);
$VERSION = '0.11';
bootstrap File::Sync $VERSION;
# Preloaded methods go here.
# Interface from Perl filehandle to POSIX file descriptor.
sub fsync(*) {
@_ == 1 or croak "usage: fsync FILEHANDLE";
fsync_fd(fileno(qualify_to_ref($_[0], caller())));
}
sub fdatasync(*) {
@_ == 1 or croak "usage: fdatasync FILEHANDLE";
fdatasync_fd(fileno(qualify_to_ref($_[0], caller())));
}
## Make fsync available as a method of FileHandle
*FileHandle::fsync = \&fsync;
# note: we no longer clobber IO::Handle::fsync. see POD for more.
1;
__END__
=head1 NAME
File::Sync - Perl access to fsync() and sync() function calls
=head1 SYNOPSIS
use File::Sync qw(fsync sync);
sync();
fsync(\*FILEHANDLE) or die "fsync: $!";
# and if fdatasync() is available on your system:
fdatasync($fh) or die "fdatasync: $!";
use File::Sync qw(fsync);
use FileHandle;
$fh = new FileHandle("> /tmp/foo")
or die "new FileHandle: $!";
...
$fh->fsync() or die "fsync: $!";
=head1 DESCRIPTION
The fsync() function takes a Perl file handle as its only argument, and
passes its fileno() to the C function fsync(). It returns I<undef> on
failure, or I<true> on success. fdatasync() is identical in return value,
but it calls C fdatasync() instead of fsync(), synchronizing only the
data in the file, not the metadata.
The fsync_fd() function is used internally by fsync(); it takes a file
descriptor as its only argument.
The sync() function is identical to the C function sync().
This module does B<not> export any methods by default, but fsync()
is made available as a method of the I<FileHandle> class. Note carefully
that as of 0.11, we no longer clobber anything in I<IO::Handle>. You
can replace any calls to IO::Handle::fsync() with IO::Handle::sync():
https://rt.cpan.org/Public/Bug/Display.html?id=50418
=head1 NOTES
Doing fsync() if the stdio buffers aren't flushed (with C<$|> or the
I<autoflush> method) is probably pointless.
Calling sync() too often on a multi-user system is slightly antisocial.
=head1 AUTHOR
Carey Evans <I<c.evans@clear.net.nz>>
=head1 SEE ALSO
perl(1), fsync(2), sync(2), perlvar(1)
=cut
|