Created
March 25, 2015 22:23
-
-
Save shulima/c45bc24af8e0291bfb95 to your computer and use it in GitHub Desktop.
Check if POSIX_FADVISE exists before using it
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
diff --git a/builder/pxzcat-c.c b/builder/pxzcat-c.c | |
index 42610c0..17886d6 100644 | |
--- a/builder/pxzcat-c.c | |
+++ b/builder/pxzcat-c.c | |
@@ -208,8 +208,10 @@ pxzcat (value filenamev, value outputfilev, unsigned nr_threads) | |
unix_error (err, "ftruncate", outputfilev); | |
} | |
+#if defined HAVE_POSIX_FADVISE | |
/* Tell the kernel we won't read the output file. */ | |
ignore_value (posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED)); | |
+#endif | |
/* Iterate over blocks. */ | |
iter_blocks (idx, nr_threads, filenamev, fd, outputfilev, ofd); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment