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:
parent
9a222cab6c
commit
51d7ab021c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue