]> git.sesse.net Git - vlc/commitdiff
Read-ahead only makes sense for seekable file descriptors
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 16 Jan 2010 09:38:17 +0000 (11:38 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 16 Jan 2010 09:38:17 +0000 (11:38 +0200)
(You can't read ahead a pipe)

modules/access/file.c

index 61f4f89253c88f36a5d1bb9a7ec3f0a49553a572..640b4790657637590da9f6301eea2d8dc525082b 100644 (file)
@@ -249,6 +249,16 @@ static int Open( vlc_object_t *p_this )
         posix_fadvise (fd, 0, 4096, POSIX_FADV_WILLNEED);
         /* In most cases, we only read the file once. */
         posix_fadvise (fd, 0, 0, POSIX_FADV_NOREUSE);
+#if defined(HAVE_FCNTL)
+        /* We'd rather use any available memory for reading ahead
+         * than for caching what we've already seen/heard */
+# if defined(F_RDAHEAD)
+        fcntl (fd, F_RDAHEAD, 1);
+# endif
+# if defined(F_NOCACHE)
+        fcntl (fd, F_NOCACHE, 1);
+# endif
+#endif
     }
     return VLC_SUCCESS;
 
@@ -416,16 +426,5 @@ static int open_file (access_t *p_access, const char *path)
         return -1;
     }
 
-#if defined(HAVE_FCNTL)
-    /* We'd rather use any available memory for reading ahead
-     * than for caching what we've already seen/heard */
-# if defined(F_RDAHEAD)
-    fcntl (fd, F_RDAHEAD, 1);
-# endif
-# if defined(F_NOCACHE)
-    fcntl (fd, F_NOCACHE, 1);
-# endif
-#endif
-
     return fd;
 }