Avoid conflict with getdents64 defined by libc
When dirent.h is included before linux_syscall_support.h (for example
in google-breakpad), getdents64 might be defined as a macro to
getdents. To prevent this unintended macro replacement, save and
undefine getdents64 at the beginning of the header, and restore at
the end.
Change-Id: Ia02cd51fa453a61103270a5ad0025f65b63e2944
Reviewed-on: https://chromium-review.googlesource.com/c/linux-syscall-support/+/2097180
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/linux_syscall_support.h b/linux_syscall_support.h
index be7ea9d..a177cfb 100644
--- a/linux_syscall_support.h
+++ b/linux_syscall_support.h
@@ -142,11 +142,13 @@
#pragma push_macro("lstat64")
#pragma push_macro("pread64")
#pragma push_macro("pwrite64")
+#pragma push_macro("getdents64")
#undef stat64
#undef fstat64
#undef lstat64
#undef pread64
#undef pwrite64
+#undef getdents64
#if defined(__ANDROID__) && defined(__x86_64__)
// A number of x86_64 syscalls are blocked by seccomp on recent Android;
@@ -4524,6 +4526,7 @@
#pragma pop_macro("lstat64")
#pragma pop_macro("pread64")
#pragma pop_macro("pwrite64")
+#pragma pop_macro("getdents64")
#if defined(__cplusplus) && !defined(SYS_CPLUSPLUS)
}