1Sync(3) User Contributed Perl Documentation Sync(3)
2
3
4
6 File::Sync - Perl access to fsync() and sync() function calls
7
9 use File::Sync qw(fsync sync);
10 fsync(\*FILEHANDLE) or die "fsync: $!";
11 sync();
12
13 use File::Sync qw(fsync);
14 use IO::File;
15 $fh = IO::File->new("> /tmp/foo")
16 or die "new IO::File: $!";
17 ...
18 fsync($fh) or die "fsync: $!";
19
21 The fsync() function takes a Perl file handle as its only argument, and
22 passes its fileno() to the C function fsync(). It returns undef on
23 failure, or true on success.
24
25 The fsync_fd() function is used internally by fsync(); it takes a file
26 descriptor as its only argument.
27
28 The sync() function is identical to the C function sync().
29
30 This module does not export any methods by default, but fsync() is made
31 available as a method of the FileHandle and IO::Handle classes.
32
34 Doing fsync() if the stdio buffers aren't flushed (with $| or the
35 autoflush method) is probably pointless.
36
37 Calling sync() too often on a multi-user system is slightly antisocial.
38
40 Carey Evans <c.evans@clear.net.nz>
41
43 perl(1), fsync(2), sync(2), perlvar(1)
44
45
46
47perl v5.12.0 1999-11-28 Sync(3)