2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 2004 Roland McGrath <roland@redhat.com>
6 * Copyright (c) 2010 Wang Chao <wang.chao@cn.fujitsu.com>
7 * Copyright (c) 2011-2013 Denys Vlasenko <vda.linux@googlemail.com>
8 * Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
9 * Copyright (c) 2013 Ali Polatel <alip@exherbo.org>
10 * Copyright (c) 2015 Mike Frysinger <vapier@gentoo.org>
11 * All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #ifndef STRACE_PTRACE_H
37 #define STRACE_PTRACE_H
39 #ifdef NEED_PTRACE_PROTOTYPE_WORKAROUND
40 # define ptrace xptrace
41 # include <sys/ptrace.h>
43 extern long ptrace(int, int, char *, long);
45 # include <sys/ptrace.h>
48 #ifdef HAVE_STRUCT_IA64_FPREG
49 # define ia64_fpreg XXX_ia64_fpreg
51 #ifdef HAVE_STRUCT_PT_ALL_USER_REGS
52 # define pt_all_user_regs XXX_pt_all_user_regs
54 #ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
55 # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
58 #include <linux/ptrace.h>
60 #ifdef HAVE_STRUCT_IA64_FPREG
63 #ifdef HAVE_STRUCT_PT_ALL_USER_REGS
64 # undef pt_all_user_regs
66 #ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
67 # undef ptrace_peeksiginfo_args
70 #ifndef PTRACE_EVENT_FORK
71 # define PTRACE_EVENT_FORK 1
73 #ifndef PTRACE_EVENT_VFORK
74 # define PTRACE_EVENT_VFORK 2
76 #ifndef PTRACE_EVENT_CLONE
77 # define PTRACE_EVENT_CLONE 3
79 #ifndef PTRACE_EVENT_EXEC
80 # define PTRACE_EVENT_EXEC 4
82 #ifndef PTRACE_EVENT_VFORK_DONE
83 # define PTRACE_EVENT_VFORK_DONE 5
85 #ifndef PTRACE_EVENT_EXIT
86 # define PTRACE_EVENT_EXIT 6
88 #ifndef PTRACE_EVENT_SECCOMP
89 # define PTRACE_EVENT_SECCOMP 7
91 #ifdef PTRACE_EVENT_STOP
92 /* Linux 3.1 - 3.3 releases had a broken value. It was fixed in 3.4. */
93 # if PTRACE_EVENT_STOP == 7
94 # undef PTRACE_EVENT_STOP
97 #ifndef PTRACE_EVENT_STOP
98 # define PTRACE_EVENT_STOP 128
101 #ifndef PTRACE_O_TRACESYSGOOD
102 # define PTRACE_O_TRACESYSGOOD 1
104 #ifndef PTRACE_O_TRACEFORK
105 # define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
107 #ifndef PTRACE_O_TRACEVFORK
108 # define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
110 #ifndef PTRACE_O_TRACECLONE
111 # define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
113 #ifndef PTRACE_O_TRACEEXEC
114 # define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
116 #ifndef PTRACE_O_TRACEVFORKDONE
117 # define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
119 #ifndef PTRACE_O_TRACEEXIT
120 # define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
122 #ifndef PTRACE_O_TRACESECCOMP
123 # define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
125 #ifndef PTRACE_O_EXITKILL
126 # define PTRACE_O_EXITKILL (1 << 20)
128 #ifndef PTRACE_O_SUSPEND_SECCOMP
129 # define PTRACE_O_SUSPEND_SECCOMP (1 << 21)
132 #ifndef PTRACE_SETOPTIONS
133 # define PTRACE_SETOPTIONS 0x4200
135 #ifndef PTRACE_GETEVENTMSG
136 # define PTRACE_GETEVENTMSG 0x4201
138 #ifndef PTRACE_GETSIGINFO
139 # define PTRACE_GETSIGINFO 0x4202
141 #ifndef PTRACE_SETSIGINFO
142 # define PTRACE_SETSIGINFO 0x4203
144 #ifndef PTRACE_GETREGSET
145 # define PTRACE_GETREGSET 0x4204
147 #ifndef PTRACE_SETREGSET
148 # define PTRACE_SETREGSET 0x4205
151 # define PTRACE_SEIZE 0x4206
153 #ifndef PTRACE_INTERRUPT
154 # define PTRACE_INTERRUPT 0x4207
156 #ifndef PTRACE_LISTEN
157 # define PTRACE_LISTEN 0x4208
159 #ifndef PTRACE_PEEKSIGINFO
160 # define PTRACE_PEEKSIGINFO 0x4209
162 #ifndef PTRACE_GETSIGMASK
163 # define PTRACE_GETSIGMASK 0x420a
165 #ifndef PTRACE_SETSIGMASK
166 # define PTRACE_SETSIGMASK 0x420b
168 #ifndef PTRACE_SECCOMP_GET_FILTER
169 # define PTRACE_SECCOMP_GET_FILTER 0x420c
172 #if !HAVE_DECL_PTRACE_PEEKUSER
173 # define PTRACE_PEEKUSER PTRACE_PEEKUSR
175 #if !HAVE_DECL_PTRACE_POKEUSER
176 # define PTRACE_POKEUSER PTRACE_POKEUSR
179 #endif /* !STRACE_PTRACE_H */