fsync() doesn't exist on Windows. bencode had a private function, tr_fsync(), that is a portability wrapper around fsync() on *nix and _commit() on win32. Make this function package-visible, rather than private, so fdlimit.c can use it too.
#endif
}
-/* portability wrapper for fsync(). */
-static void
-tr_fsync( int fd )
-{
-#ifdef WIN32
- _commit( fd );
-#else
- fsync( fd );
-#endif
-}
-
int
tr_bencToFile( const tr_benc * top, tr_fmt_mode mode, const char * filename )
{
return success;
}
+
+/* portability wrapper for fsync(). */
+int
+tr_fsync( int fd )
+{
+#ifdef WIN32
+ return _commit( fd );
+#else
+ return fsync( fd );
+#endif
+}
+
+
/* Like pread and pwrite, except that the position is undefined afterwards.
And of course they are not thread-safe. */
* but it couldn't hurt... */
fcntl( fd, F_NOCACHE, 1 );
#endif
- fsync( fd );
+ tr_fsync( fd );
close( fd );
}
void tr_close_file( int fd );
+int tr_fsync(int fd);
+
ssize_t tr_pread(int fd, void *buf, size_t count, off_t offset);
ssize_t tr_pwrite(int fd, const void *buf, size_t count, off_t offset);
int tr_prefetch(int fd, off_t offset, size_t count);