aboutsummaryrefslogtreecommitdiffstats
path: root/linux/os.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-06-02 14:44:08 +0200
committerMattias Andrée <maandree@kth.se>2020-06-02 14:44:08 +0200
commit7198c7b9f01bbd5e8f8528440d290569e588b260 (patch)
treec4bbeb956b37965d589ffe3c0b4dbde94e0ccaca /linux/os.h
parentReject i386 and x32 applications (not yet supported) (diff)
downloadsctrace-7198c7b9f01bbd5e8f8528440d290569e588b260.tar.gz
sctrace-7198c7b9f01bbd5e8f8528440d290569e588b260.tar.bz2
sctrace-7198c7b9f01bbd5e8f8528440d290569e588b260.tar.xz
Some cleanup and preparation for support for multiple architectures (both host and client) and OSes
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'linux/os.h')
-rw-r--r--linux/os.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/linux/os.h b/linux/os.h
new file mode 100644
index 0000000..db22f10
--- /dev/null
+++ b/linux/os.h
@@ -0,0 +1,32 @@
+/* See LICENSE file for copyright and license details. */
+#include <linux/elf.h>
+#include <sys/ptrace.h>
+#include <linux/ptrace.h> /* after <sys/ptrace.h> */
+#include <sys/syscall.h>
+#include <sys/user.h>
+
+#ifndef ERESTARTSYS
+# define ERESTARTSYS 512
+# define ALSO_ERESTARTSYS
+#endif
+#ifndef ERESTARTNOINTR
+# define ERESTARTNOINTR 513
+# define ALSO_ERESTARTNOINTR
+#endif
+#ifndef ERESTARTNOHAND
+# define ERESTARTNOHAND 514
+# define ALSO_ERESTARTNOHAND
+#endif
+#ifndef ERESTART_RESTARTBLOCK
+# define ERESTART_RESTARTBLOCK 516
+# define ALSO_ERESTART_RESTARTBLOCK
+#endif
+
+#define RETURN_IS_ERROR(RET)\
+ ((RET) > -(unsigned long long int)PAGE_SIZE) /* Don't know the actual limit, but this seems safe */
+
+#if defined(__x86_64__) && !defined(__IPL32__)
+# include "x86-64.h"
+#else
+# error "This program is only implemented for x86-64 on Linux"
+#endif