• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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  * Copyright (c) 2015-2018 The strace developers.
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  * 3. The name of the author may not be used to endorse or promote products
23  *    derived from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37 #ifndef STRACE_PTRACE_H
38 #define STRACE_PTRACE_H
39 
40 #include <sys/ptrace.h>
41 
42 #ifdef HAVE_STRUCT_IA64_FPREG
43 # define ia64_fpreg XXX_ia64_fpreg
44 #endif
45 #ifdef HAVE_STRUCT_PT_ALL_USER_REGS
46 # define pt_all_user_regs XXX_pt_all_user_regs
47 #endif
48 #ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
49 # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
50 #endif
51 
52 #include <linux/ptrace.h>
53 
54 #ifdef HAVE_STRUCT_IA64_FPREG
55 # undef ia64_fpreg
56 #endif
57 #ifdef HAVE_STRUCT_PT_ALL_USER_REGS
58 # undef pt_all_user_regs
59 #endif
60 #ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
61 # undef ptrace_peeksiginfo_args
62 #endif
63 
64 #if defined(SPARC) || defined(SPARC64)
65 /*
66  * SPARC has a different PTRACE_DETACH value correctly defined in sys/ptrace.h,
67  * but linux/ptrace.h clobbers it with the standard one.  PTRACE_SUNDETACH is
68  * also defined to the correct value by sys/ptrace.h, so use that instead.
69  */
70 # undef PTRACE_DETACH
71 # define PTRACE_DETACH PTRACE_SUNDETACH
72 #endif
73 
74 #ifndef PTRACE_EVENT_FORK
75 # define PTRACE_EVENT_FORK	1
76 #endif
77 #ifndef PTRACE_EVENT_VFORK
78 # define PTRACE_EVENT_VFORK	2
79 #endif
80 #ifndef PTRACE_EVENT_CLONE
81 # define PTRACE_EVENT_CLONE	3
82 #endif
83 #ifndef PTRACE_EVENT_EXEC
84 # define PTRACE_EVENT_EXEC	4
85 #endif
86 #ifndef PTRACE_EVENT_VFORK_DONE
87 # define PTRACE_EVENT_VFORK_DONE	5
88 #endif
89 #ifndef PTRACE_EVENT_EXIT
90 # define PTRACE_EVENT_EXIT	6
91 #endif
92 #ifndef PTRACE_EVENT_SECCOMP
93 # define PTRACE_EVENT_SECCOMP	7
94 #endif
95 #ifdef PTRACE_EVENT_STOP
96 /* Linux 3.1 - 3.3 releases had a broken value.  It was fixed in 3.4.  */
97 # if PTRACE_EVENT_STOP == 7
98 #  undef PTRACE_EVENT_STOP
99 # endif
100 #endif
101 #ifndef PTRACE_EVENT_STOP
102 # define PTRACE_EVENT_STOP	128
103 #endif
104 
105 #ifndef PTRACE_O_TRACESYSGOOD
106 # define PTRACE_O_TRACESYSGOOD	1
107 #endif
108 #ifndef PTRACE_O_TRACEFORK
109 # define PTRACE_O_TRACEFORK	(1 << PTRACE_EVENT_FORK)
110 #endif
111 #ifndef PTRACE_O_TRACEVFORK
112 # define PTRACE_O_TRACEVFORK	(1 << PTRACE_EVENT_VFORK)
113 #endif
114 #ifndef PTRACE_O_TRACECLONE
115 # define PTRACE_O_TRACECLONE	(1 << PTRACE_EVENT_CLONE)
116 #endif
117 #ifndef PTRACE_O_TRACEEXEC
118 # define PTRACE_O_TRACEEXEC	(1 << PTRACE_EVENT_EXEC)
119 #endif
120 #ifndef PTRACE_O_TRACEVFORKDONE
121 # define PTRACE_O_TRACEVFORKDONE	(1 << PTRACE_EVENT_VFORK_DONE)
122 #endif
123 #ifndef PTRACE_O_TRACEEXIT
124 # define PTRACE_O_TRACEEXIT	(1 << PTRACE_EVENT_EXIT)
125 #endif
126 #ifndef PTRACE_O_TRACESECCOMP
127 # define PTRACE_O_TRACESECCOMP	(1 << PTRACE_EVENT_SECCOMP)
128 #endif
129 #ifndef PTRACE_O_EXITKILL
130 # define PTRACE_O_EXITKILL	(1 << 20)
131 #endif
132 #ifndef PTRACE_O_SUSPEND_SECCOMP
133 # define PTRACE_O_SUSPEND_SECCOMP	(1 << 21)
134 #endif
135 
136 #ifndef PTRACE_SETOPTIONS
137 # define PTRACE_SETOPTIONS	0x4200
138 #endif
139 #ifndef PTRACE_GETEVENTMSG
140 # define PTRACE_GETEVENTMSG	0x4201
141 #endif
142 #ifndef PTRACE_GETSIGINFO
143 # define PTRACE_GETSIGINFO	0x4202
144 #endif
145 #ifndef PTRACE_SETSIGINFO
146 # define PTRACE_SETSIGINFO	0x4203
147 #endif
148 #ifndef PTRACE_GETREGSET
149 # define PTRACE_GETREGSET	0x4204
150 #endif
151 #ifndef PTRACE_SETREGSET
152 # define PTRACE_SETREGSET	0x4205
153 #endif
154 #ifndef PTRACE_SEIZE
155 # define PTRACE_SEIZE		0x4206
156 #endif
157 #ifndef PTRACE_INTERRUPT
158 # define PTRACE_INTERRUPT	0x4207
159 #endif
160 #ifndef PTRACE_LISTEN
161 # define PTRACE_LISTEN		0x4208
162 #endif
163 #ifndef PTRACE_PEEKSIGINFO
164 # define PTRACE_PEEKSIGINFO	0x4209
165 #endif
166 #ifndef PTRACE_GETSIGMASK
167 # define PTRACE_GETSIGMASK	0x420a
168 #endif
169 #ifndef PTRACE_SETSIGMASK
170 # define PTRACE_SETSIGMASK	0x420b
171 #endif
172 #ifndef PTRACE_SECCOMP_GET_FILTER
173 # define PTRACE_SECCOMP_GET_FILTER	0x420c
174 #endif
175 #ifndef PTRACE_SECCOMP_GET_METADATA
176 # define PTRACE_SECCOMP_GET_METADATA	0x420d
177 #endif
178 
179 #if !HAVE_DECL_PTRACE_PEEKUSER
180 # define PTRACE_PEEKUSER PTRACE_PEEKUSR
181 #endif
182 #if !HAVE_DECL_PTRACE_POKEUSER
183 # define PTRACE_POKEUSER PTRACE_POKEUSR
184 #endif
185 
186 #endif /* !STRACE_PTRACE_H */
187