1 #ifdef NEED_PTRACE_PROTOTYPE_WORKAROUND
2 # define ptrace xptrace
3 # include <sys/ptrace.h>
5 extern long ptrace(int, int, char *, long);
7 # include <sys/ptrace.h>
10 #ifdef HAVE_STRUCT_IA64_FPREG
11 # define ia64_fpreg XXX_ia64_fpreg
13 #ifdef HAVE_STRUCT_PT_ALL_USER_REGS
14 # define pt_all_user_regs XXX_pt_all_user_regs
16 #ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
17 # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
20 #include <linux/ptrace.h>
22 #ifdef HAVE_STRUCT_IA64_FPREG
25 #ifdef HAVE_STRUCT_PT_ALL_USER_REGS
26 # undef pt_all_user_regs
28 #ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
29 # undef ptrace_peeksiginfo_args
32 #ifndef PTRACE_EVENT_FORK
33 # define PTRACE_EVENT_FORK 1
35 #ifndef PTRACE_EVENT_VFORK
36 # define PTRACE_EVENT_VFORK 2
38 #ifndef PTRACE_EVENT_CLONE
39 # define PTRACE_EVENT_CLONE 3
41 #ifndef PTRACE_EVENT_EXEC
42 # define PTRACE_EVENT_EXEC 4
44 #ifndef PTRACE_EVENT_VFORK_DONE
45 # define PTRACE_EVENT_VFORK_DONE 5
47 #ifndef PTRACE_EVENT_EXIT
48 # define PTRACE_EVENT_EXIT 6
50 #ifndef PTRACE_EVENT_SECCOMP
51 # define PTRACE_EVENT_SECCOMP 7
53 #ifdef PTRACE_EVENT_STOP
54 /* Linux 3.1 - 3.3 releases had a broken value. It was fixed in 3.4. */
55 # if PTRACE_EVENT_STOP == 7
56 # undef PTRACE_EVENT_STOP
59 #ifndef PTRACE_EVENT_STOP
60 # define PTRACE_EVENT_STOP 128
63 #ifndef PTRACE_O_TRACESYSGOOD
64 # define PTRACE_O_TRACESYSGOOD 1
66 #ifndef PTRACE_O_TRACEFORK
67 # define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
69 #ifndef PTRACE_O_TRACEVFORK
70 # define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
72 #ifndef PTRACE_O_TRACECLONE
73 # define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
75 #ifndef PTRACE_O_TRACEEXEC
76 # define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
78 #ifndef PTRACE_O_TRACEVFORKDONE
79 # define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
81 #ifndef PTRACE_O_TRACEEXIT
82 # define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
84 #ifndef PTRACE_O_TRACESECCOMP
85 # define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
87 #ifndef PTRACE_O_EXITKILL
88 # define PTRACE_O_EXITKILL (1 << 20)
90 #ifndef PTRACE_O_SUSPEND_SECCOMP
91 # define PTRACE_O_SUSPEND_SECCOMP (1 << 21)
94 #ifndef PTRACE_SETOPTIONS
95 # define PTRACE_SETOPTIONS 0x4200
97 #ifndef PTRACE_GETEVENTMSG
98 # define PTRACE_GETEVENTMSG 0x4201
100 #ifndef PTRACE_GETSIGINFO
101 # define PTRACE_GETSIGINFO 0x4202
103 #ifndef PTRACE_SETSIGINFO
104 # define PTRACE_SETSIGINFO 0x4203
106 #ifndef PTRACE_GETREGSET
107 # define PTRACE_GETREGSET 0x4204
109 #ifndef PTRACE_SETREGSET
110 # define PTRACE_SETREGSET 0x4205
113 # define PTRACE_SEIZE 0x4206
115 #ifndef PTRACE_INTERRUPT
116 # define PTRACE_INTERRUPT 0x4207
118 #ifndef PTRACE_LISTEN
119 # define PTRACE_LISTEN 0x4208
121 #ifndef PTRACE_PEEKSIGINFO
122 # define PTRACE_PEEKSIGINFO 0x4209
124 #ifndef PTRACE_GETSIGMASK
125 # define PTRACE_GETSIGMASK 0x420a
127 #ifndef PTRACE_SETSIGMASK
128 # define PTRACE_SETSIGMASK 0x420b
131 #if !HAVE_DECL_PTRACE_PEEKUSER
132 # define PTRACE_PEEKUSER PTRACE_PEEKUSR
134 #if !HAVE_DECL_PTRACE_POKEUSER
135 # define PTRACE_POKEUSER PTRACE_POKEUSR