]> git.sesse.net Git - vlc/commitdiff
mmap: Use fnctl to set the READAHEAD flag when supported. This should speedup the...
authorDerk-Jan Hartman <hartman@videolan.org>
Fri, 19 Sep 2008 21:38:29 +0000 (23:38 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Fri, 19 Sep 2008 21:40:05 +0000 (23:40 +0200)
modules/access/mmap.c

index 220d5e7fd3442393ae2556277ef3fac93425f6c5..e49c0412e4a7b0f3bb6ec7dcc5c1c821bf8a3256 100644 (file)
@@ -119,6 +119,13 @@ static int Open (vlc_object_t *p_this)
         goto error;
     }
 
+# if defined(HAVE_FCNTL_H) && defined(F_FDAHEAD) && defined(F_NOCACHE)
+    /* We'd rather use any available memory for reading ahead
+     * than for caching what we've already mmap'ed */
+    fcntl (fd, F_RDAHEAD, 1);
+    fcntl (fd, F_NOCACHE, 1);
+# endif
+
     /* Autodetect mmap() support */
     if (st.st_size > 0)
     {