]> granicus.if.org Git - transmission/commitdiff
(trunk libT) tweak tr_open_file_for_scanning() on OS X for sequential, non-cached...
authorCharles Kerr <charles@transmissionbt.com>
Sun, 26 Apr 2009 19:50:31 +0000 (19:50 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sun, 26 Apr 2009 19:50:31 +0000 (19:50 +0000)
libtransmission/fdlimit.c

index 2a22479ecfb44c635759384d2c6f480b47689ffd..1795d67400980839bfb901b70cb9b4d42d0d8587 100644 (file)
@@ -230,6 +230,10 @@ tr_open_file_for_scanning( const char * filename )
 #ifdef HAVE_POSIX_FADVISE
     posix_fadvise( fd, 0, 0, POSIX_FADV_SEQUENTIAL );
 #endif
+#ifdef SYS_DARWIN
+    fcntl( fd, F_NOCACHE, 1 );
+    fcntl( fd, F_RDAHEAD, 1 );
+#endif
 
     return fdopen( fd, "r" );
 }
@@ -239,8 +243,6 @@ flush_before_closing( int fd )
 {
 #if defined(HAVE_POSIX_FADVISE)
     posix_fadvise( fd, 0, 0, POSIX_FADV_DONTNEED );
-#elif defined(SYS_DARWIN)
-    fcntl( fd, F_NOCACHE, 1 );
 #endif
 }