Add SEEK_DATA and SEEK_HOLE constants.
Without pulling in <linux/fs.h>, the UAPI source of these constants,
because it's full of pollution, in particular a macro called BLOCK_SIZE
that breaks a lot of stuff.
Test: treehugger
Change-Id: I7258ec57e91c67645c2b4d0ce44850d757c4bb12
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index c237d6d..01b4dba 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -19,6 +19,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
+#include <linux/fs.h>
#include <math.h>
#include <stdio.h>
#include <sys/types.h>
@@ -2599,3 +2600,13 @@
funlockfile(fp1);
fclose(fp1);
}
+
+TEST(STDIO_TEST, SEEK_macros) {
+ ASSERT_EQ(0, SEEK_SET);
+ ASSERT_EQ(1, SEEK_CUR);
+ ASSERT_EQ(2, SEEK_END);
+ ASSERT_EQ(3, SEEK_DATA);
+ ASSERT_EQ(4, SEEK_HOLE);
+ // So we'll notice if Linux grows another constant in <linux/fs.h>...
+ ASSERT_EQ(SEEK_MAX, SEEK_HOLE);
+}