From 51d7ab021c97993c62186257fc71ad4617b2ebea Mon Sep 17 00:00:00 2001 From: Avuton Olrich Date: Fri, 19 Jan 2007 01:40:02 +0000 Subject: [PATCH] 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 --- src/inputStream_file.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 #include #include +#define _XOPEN_SOURCE 600 +#include 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;