Commit 6bd7922e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Read-ahead only makes sense for seekable file descriptors

(You can't read ahead a pipe)
parent 063a3bc8
...@@ -249,6 +249,16 @@ static int Open( vlc_object_t *p_this ) ...@@ -249,6 +249,16 @@ static int Open( vlc_object_t *p_this )
posix_fadvise (fd, 0, 4096, POSIX_FADV_WILLNEED); posix_fadvise (fd, 0, 4096, POSIX_FADV_WILLNEED);
/* In most cases, we only read the file once. */ /* In most cases, we only read the file once. */
posix_fadvise (fd, 0, 0, POSIX_FADV_NOREUSE); 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; return VLC_SUCCESS;
...@@ -416,16 +426,5 @@ static int open_file (access_t *p_access, const char *path) ...@@ -416,16 +426,5 @@ static int open_file (access_t *p_access, const char *path)
return -1; 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; return fd;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment