aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputStream_file.c
diff options
context:
space:
mode:
authorAvuton Olrich <avuton@gmail.com>2007-01-19 01:40:02 +0000
committerAvuton Olrich <avuton@gmail.com>2007-01-19 01:40:02 +0000
commit51d7ab021c97993c62186257fc71ad4617b2ebea (patch)
tree48818c1f02543a6da93b6e43954a05ac2717cde0 /src/inputStream_file.c
parent9a222cab6c9d0892cf7b28deffd0eb465cd0829b (diff)
downloadmpd-51d7ab021c97993c62186257fc71ad4617b2ebea.tar.gz
mpd-51d7ab021c97993c62186257fc71ad4617b2ebea.tar.xz
mpd-51d7ab021c97993c62186257fc71ad4617b2ebea.zip
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
Diffstat (limited to '')
-rw-r--r--src/inputStream_file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/inputStream_file.c b/src/inputStream_file.c
index f4acd3a91..de1055eb2 100644
--- a/src/inputStream_file.c
+++ b/src/inputStream_file.c
@@ -25,6 +25,8 @@
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
+#define _XOPEN_SOURCE 600
+#include <fcntl.h>
void inputStream_initFile(void)
{
@@ -46,6 +48,10 @@ int inputStream_fileOpen(InputStream * inStream, char *filename)
inStream->size = ftell(fp);
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->seekFunc = inputStream_fileSeek;
inStream->closeFunc = inputStream_fileClose;