Created
April 23, 2010 01:16
-
-
Save kocolosk/376047 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _XOPEN_SOURCE 600 | |
#ifdef __APPLE__ | |
#define _DARWIN_C_SOURCE | |
#endif | |
#include <unistd.h> | |
#include <fcntl.h> | |
int main(int argc, char *argv[]) { | |
int fd; | |
fd = open(argv[1], O_RDONLY); | |
if(fd == -1) return 1; | |
#ifdef __linux__ | |
fdatasync(fd); | |
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED); | |
#endif | |
#ifdef __APPLE__ | |
fcntl(fd, F_GLOBAL_NOCACHE, 1); | |
#endif | |
close(fd); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment