use IO::Handle; open my $f, '/tmp' or die $!; $f->sync or die "fsync: $!\n"; #### use IO::Handle; my $f = IO::Handle->new; opendir $f, '/tmp' or die $!; $f->sync or die "fsync: $!\n"; #### #include #include #include #include #include #include int main (void) { int fd = open("/tmp", 0); if (fd < 0) { perror("open: /tmp"); exit(1); } if (fsync(fd) < 0) { perror("fsync: /tmp"); exit(1); } return 0; }