blob: 065cbda1a8983a1fd5fbbe92ac8e9c08e68451f2 [file] [log] [blame]
Dmitry V. Levinfadf3792015-02-13 00:26:38 +00001#ifdef NEED_PTRACE_PROTOTYPE_WORKAROUND
2# define ptrace xptrace
3# include <sys/ptrace.h>
4# undef ptrace
5extern long ptrace(int, int, char *, long);
6#else
7# include <sys/ptrace.h>
8#endif
9
10#ifdef HAVE_STRUCT_IA64_FPREG
11# define ia64_fpreg XXX_ia64_fpreg
12#endif
13#ifdef HAVE_STRUCT_PT_ALL_USER_REGS
14# define pt_all_user_regs XXX_pt_all_user_regs
15#endif
16#ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
17# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
18#endif
19
20#include <linux/ptrace.h>
21
22#ifdef HAVE_STRUCT_IA64_FPREG
23# undef ia64_fpreg
24#endif
25#ifdef HAVE_STRUCT_PT_ALL_USER_REGS
26# undef pt_all_user_regs
27#endif
28#ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
29# undef ptrace_peeksiginfo_args
30#endif
31
32#ifndef PTRACE_EVENT_FORK
33# define PTRACE_EVENT_FORK 1
34#endif
35#ifndef PTRACE_EVENT_VFORK
36# define PTRACE_EVENT_VFORK 2
37#endif
38#ifndef PTRACE_EVENT_CLONE
39# define PTRACE_EVENT_CLONE 3
40#endif
41#ifndef PTRACE_EVENT_EXEC
42# define PTRACE_EVENT_EXEC 4
43#endif
44#ifndef PTRACE_EVENT_VFORK_DONE
45# define PTRACE_EVENT_VFORK_DONE 5
46#endif
47#ifndef PTRACE_EVENT_EXIT
48# define PTRACE_EVENT_EXIT 6
49#endif
50#ifndef PTRACE_EVENT_SECCOMP
51# define PTRACE_EVENT_SECCOMP 7
52#endif
Mike Frysingerd32e1b92015-02-26 23:31:37 -050053#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
57# endif
58#endif
Dmitry V. Levinfadf3792015-02-13 00:26:38 +000059#ifndef PTRACE_EVENT_STOP
60# define PTRACE_EVENT_STOP 128
61#endif
62
63#ifndef PTRACE_O_TRACESYSGOOD
64# define PTRACE_O_TRACESYSGOOD 1
65#endif
66#ifndef PTRACE_O_TRACEFORK
67# define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
68#endif
69#ifndef PTRACE_O_TRACEVFORK
70# define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
71#endif
72#ifndef PTRACE_O_TRACECLONE
73# define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
74#endif
75#ifndef PTRACE_O_TRACEEXEC
76# define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
77#endif
78#ifndef PTRACE_O_TRACEVFORKDONE
79# define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
80#endif
81#ifndef PTRACE_O_TRACEEXIT
82# define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
83#endif
84#ifndef PTRACE_O_TRACESECCOMP
85# define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
86#endif
87#ifndef PTRACE_O_EXITKILL
88# define PTRACE_O_EXITKILL (1 << 20)
89#endif
90
91#ifndef PTRACE_SETOPTIONS
92# define PTRACE_SETOPTIONS 0x4200
93#endif
94#ifndef PTRACE_GETEVENTMSG
95# define PTRACE_GETEVENTMSG 0x4201
96#endif
97#ifndef PTRACE_GETSIGINFO
98# define PTRACE_GETSIGINFO 0x4202
99#endif
100#ifndef PTRACE_SETSIGINFO
101# define PTRACE_SETSIGINFO 0x4203
102#endif
103#ifndef PTRACE_GETREGSET
104# define PTRACE_GETREGSET 0x4204
105#endif
106#ifndef PTRACE_SETREGSET
107# define PTRACE_SETREGSET 0x4205
108#endif
109#ifndef PTRACE_SEIZE
110# define PTRACE_SEIZE 0x4206
111#endif
112#ifndef PTRACE_INTERRUPT
113# define PTRACE_INTERRUPT 0x4207
114#endif
115#ifndef PTRACE_LISTEN
116# define PTRACE_LISTEN 0x4208
117#endif
118#ifndef PTRACE_PEEKSIGINFO
119# define PTRACE_PEEKSIGINFO 0x4209
120#endif
121#ifndef PTRACE_GETSIGMASK
122# define PTRACE_GETSIGMASK 0x420a
123#endif
124#ifndef PTRACE_SETSIGMASK
125# define PTRACE_SETSIGMASK 0x420b
126#endif
127
128#if !HAVE_DECL_PTRACE_PEEKUSER
129# define PTRACE_PEEKUSER PTRACE_PEEKUSR
130#endif
131#if !HAVE_DECL_PTRACE_POKEUSER
132# define PTRACE_POKEUSER PTRACE_POKEUSR
133#endif