summaryrefslogtreecommitdiff
path: root/lib/intercept/intercept.h
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2018-02-20 21:49:13 -0500
committerReinhard Tartler <siretart@tauware.de>2018-02-20 21:49:13 -0500
commitf28f88e5e72ba1499409047a9d6985eb312c0232 (patch)
treec9c267f18264b3dfe715a363935bb6ac20904492 /lib/intercept/intercept.h
parente19a5db232e1ef90e9a02159d2fbd9707ffe4373 (diff)
parent6d7e9562e8485591a4888f1fc2d3c6c657dc7a01 (diff)
Merge tag 'BoxBackup-0.12.master.180102.6d7e956' into upstream
Diffstat (limited to 'lib/intercept/intercept.h')
-rw-r--r--lib/intercept/intercept.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/intercept/intercept.h b/lib/intercept/intercept.h
index 80a17d3f..4de5f9f2 100644
--- a/lib/intercept/intercept.h
+++ b/lib/intercept/intercept.h
@@ -13,6 +13,18 @@
#include <dirent.h>
+#ifdef __NetBSD__ //__NetBSD_Version__ is defined in sys/param.h
+#include <sys/param.h>
+#endif
+
+#if defined __NetBSD_Version__ && __NetBSD_Version__ >= 399000800 //3.99.8 vers.
+#define FUNC_OPENDIR "__opendir30"
+#define FUNC_READDIR "__readdir30"
+#else
+#define FUNC_OPENDIR "opendir"
+#define FUNC_READDIR "readdir"
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
@@ -50,5 +62,14 @@ void intercept_setup_stat_post_hook (lstat_post_hook_t hookfn);
void intercept_clear_setup();
+// Some newer architectures don't have an open() syscall, but use openat() instead.
+// In these cases we define SYS_open (which is otherwise undefined) to equal SYS_openat
+// (which is defined) so that everywhere else we can call intercept_setup_error(SYS_open)
+// without caring about the difference.
+// https://chromium.googlesource.com/linux-syscall-support/
+#if !HAVE_DECL_SYS_OPEN && HAVE_DECL_SYS_OPENAT
+# define SYS_open SYS_openat
+#endif
+
#endif // !PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
#endif // !INTERCEPT_H