{"id":6927,"date":"2022-12-20T19:34:22","date_gmt":"2022-12-20T22:34:22","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/sync-man3\/"},"modified":"2022-12-20T19:34:22","modified_gmt":"2022-12-20T22:34:22","slug":"sync-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/sync-man3\/","title":{"rendered":"Sync (man3)"},"content":{"rendered":"<h1 align=\"center\">Sync<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">File::Sync \u2212 Perl access to fsync() and sync() function calls<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use File::Sync qw(fsync sync); <br \/> sync(); <br \/> fsync(*FILEHANDLE) or die &#8220;fsync: $!&#8221;; <br \/> # and if fdatasync() is available on your system: <br \/> fdatasync($fh) or die &#8220;fdatasync: $!&#8221;; <br \/> use File::Sync qw(fsync); <br \/> use FileHandle; <br \/> $fh = new FileHandle(&#8220;> \/tmp\/foo&#8221;) <br \/> or die &#8220;new FileHandle: $!&#8221;; <br \/> &#8230; <br \/> $fh\u2212>fsync() or die &#8220;fsync: $!&#8221;;<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>fsync()<\/b> function takes a Perl file handle as its only argument, and passes its <b>fileno()<\/b> to the C function <b>fsync()<\/b>. It returns <i>undef<\/i> on failure, or <i>true<\/i> on success. <b>fdatasync()<\/b> is identical in return value, but it calls C <b>fdatasync()<\/b> instead of <b>fsync()<\/b>, synchronizing only the data in the file, not the metadata.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>fsync_fd()<\/b> function is used internally by <b>fsync()<\/b>; it takes a file descriptor as its only argument.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>sync()<\/b> function is identical to the C function <b>sync()<\/b>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This module does <b>not<\/b> export any methods by default, but <b>fsync()<\/b> is made available as a method of the <i>FileHandle<\/i> class. Note carefully that as of 0.11, we no longer clobber anything in <i>IO::Handle<\/i>. You can replace any calls to <b>IO::Handle::fsync()<\/b> with <b>IO::Handle::sync()<\/b>: <br \/> https:\/\/rt.cpan.org\/Public\/Bug\/Display.html?id=50418<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Doing <b>fsync()<\/b> if the stdio buffers aren\u2019t flushed (with $| or the <i>autoflush<\/i> method) is probably pointless.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Calling <b>sync()<\/b> too often on a multi-user system is slightly antisocial.<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Carey Evans <<i>c.evans@clear.net.nz<\/i>><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>perl<\/b>(1), <b>fsync<\/b>(2), <b>sync<\/b>(2), <b>perlvar<\/b>(1)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  File::Sync \u2212 Perl access to fsync() and sync() function calls <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3284,3007],"class_list":["post-6927","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-filesync","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6927"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6927\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}