]> git.vomp.tv Git - vompserver.git/commitdiff
Update to advise Linux about FS caching
authorChris Tallon <chris@vomp.tv>
Tue, 25 Mar 2008 20:08:40 +0000 (20:08 +0000)
committerChris Tallon <chris@vomp.tv>
Tue, 25 Mar 2008 20:08:40 +0000 (20:08 +0000)
recplayer.c

index 66475891748dda4ae609325a029cd3ca84274e6f..3c550ef44fcd8f9114b6d944dc87ccbc8394cfa1 100644 (file)
@@ -20,6 +20,9 @@
 
 #include "recplayer.h"
 
+#define _XOPEN_SOURCE 600
+#include <fcntl.h>
+
 RecPlayer::RecPlayer(cRecording* rec)
 {
   log = Log::getInstance();
@@ -163,7 +166,10 @@ unsigned long RecPlayer::getBlock(unsigned char* buffer, ULLONG position, unsign
     filePosition = currentPosition - segments[segmentNumber]->start;
     fseek(file, filePosition, SEEK_SET);
     if (fread(&buffer[got], getFromThisSegment, 1, file) != 1) return 0; // umm, big problem.
-
+    // Tell linux not to bother keeping the data in the FS cache
+    posix_fadvise(file->_fileno, filePosition, getFromThisSegment, POSIX_FADV_DONTNEED);
     got += getFromThisSegment;
     currentPosition += getFromThisSegment;
     yetToGet -= getFromThisSegment;