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
This commit is contained in:
Avuton Olrich 2007-01-19 01:40:02 +00:00
parent 9a222cab6c
commit 51d7ab021c
1 changed files with 6 additions and 0 deletions

View File

@ -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;