Commit 51d7ab02 authored by Avuton Olrich's avatar Avuton Olrich

Committing posix_fadvise(); normalperson/jat reviewed. Appears fine. Fixes bug #1428.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5265 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 9a222cab
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#define _XOPEN_SOURCE 600
#include <fcntl.h>
void inputStream_initFile(void) void inputStream_initFile(void)
{ {
...@@ -46,6 +48,10 @@ int inputStream_fileOpen(InputStream * inStream, char *filename) ...@@ -46,6 +48,10 @@ int inputStream_fileOpen(InputStream * inStream, char *filename)
inStream->size = ftell(fp); inStream->size = ftell(fp);
fseek(fp, 0, SEEK_SET); fseek(fp, 0, SEEK_SET);
#ifdef POSIX_FADV_SEQUENTIAL
posix_fadvise(fileno(fp), (off_t)0, inStream->size, POSIX_FADV_SEQUENTIAL);
#endif
inStream->data = fp; inStream->data = fp;
inStream->seekFunc = inputStream_fileSeek; inStream->seekFunc = inputStream_fileSeek;
inStream->closeFunc = inputStream_fileClose; inStream->closeFunc = inputStream_fileClose;
......
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