blob: ddb46cb4010e2d7ec733c9d99825fdc6286c3cb1 [file] [log] [blame]
Dmitry V. Levin38a34c92015-12-17 17:56:48 +00001/*
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>
Dmitry V. Levin65f8d392016-01-12 02:04:44 +00008 * Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
Dmitry V. Levin38a34c92015-12-17 17:56:48 +00009 * Copyright (c) 2013 Ali Polatel <alip@exherbo.org>
10 * Copyright (c) 2015 Mike Frysinger <vapier@gentoo.org>
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
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.
23 *
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.
34 */
35
Eugene Syromyatnikov18907922016-08-07 06:44:19 +030036#ifndef STRACE_PTRACE_H
37#define STRACE_PTRACE_H
38
Dmitry V. Levinfadf3792015-02-13 00:26:38 +000039#ifdef NEED_PTRACE_PROTOTYPE_WORKAROUND
40# define ptrace xptrace
41# include <sys/ptrace.h>
42# undef ptrace
43extern long ptrace(int, int, char *, long);
44#else
45# include <sys/ptrace.h>
46#endif
47
48#ifdef HAVE_STRUCT_IA64_FPREG
49# define ia64_fpreg XXX_ia64_fpreg
50#endif
51#ifdef HAVE_STRUCT_PT_ALL_USER_REGS
52# define pt_all_user_regs XXX_pt_all_user_regs
53#endif
54#ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
55# define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
56#endif
57
58#include <linux/ptrace.h>
59
60#ifdef HAVE_STRUCT_IA64_FPREG
61# undef ia64_fpreg
62#endif
63#ifdef HAVE_STRUCT_PT_ALL_USER_REGS
64# undef pt_all_user_regs
65#endif
66#ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
67# undef ptrace_peeksiginfo_args
68#endif
69
James Clarkeb4a32f92016-08-30 00:50:33 +010070#if defined(SPARC) || defined(SPARC64)
71/*
72 * SPARC has a different PTRACE_DETACH value correctly defined in sys/ptrace.h,
73 * but linux/ptrace.h clobbers it with the standard one. PTRACE_SUNDETACH is
74 * also defined to the correct value by sys/ptrace.h, so use that instead.
75 */
76# undef PTRACE_DETACH
77# define PTRACE_DETACH PTRACE_SUNDETACH
78#endif
79
Dmitry V. Levinfadf3792015-02-13 00:26:38 +000080#ifndef PTRACE_EVENT_FORK
81# define PTRACE_EVENT_FORK 1
82#endif
83#ifndef PTRACE_EVENT_VFORK
84# define PTRACE_EVENT_VFORK 2
85#endif
86#ifndef PTRACE_EVENT_CLONE
87# define PTRACE_EVENT_CLONE 3
88#endif
89#ifndef PTRACE_EVENT_EXEC
90# define PTRACE_EVENT_EXEC 4
91#endif
92#ifndef PTRACE_EVENT_VFORK_DONE
93# define PTRACE_EVENT_VFORK_DONE 5
94#endif
95#ifndef PTRACE_EVENT_EXIT
96# define PTRACE_EVENT_EXIT 6
97#endif
98#ifndef PTRACE_EVENT_SECCOMP
99# define PTRACE_EVENT_SECCOMP 7
100#endif
Mike Frysingerd32e1b92015-02-26 23:31:37 -0500101#ifdef PTRACE_EVENT_STOP
102/* Linux 3.1 - 3.3 releases had a broken value. It was fixed in 3.4. */
103# if PTRACE_EVENT_STOP == 7
104# undef PTRACE_EVENT_STOP
105# endif
106#endif
Dmitry V. Levinfadf3792015-02-13 00:26:38 +0000107#ifndef PTRACE_EVENT_STOP
108# define PTRACE_EVENT_STOP 128
109#endif
110
111#ifndef PTRACE_O_TRACESYSGOOD
112# define PTRACE_O_TRACESYSGOOD 1
113#endif
114#ifndef PTRACE_O_TRACEFORK
115# define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
116#endif
117#ifndef PTRACE_O_TRACEVFORK
118# define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
119#endif
120#ifndef PTRACE_O_TRACECLONE
121# define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
122#endif
123#ifndef PTRACE_O_TRACEEXEC
124# define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
125#endif
126#ifndef PTRACE_O_TRACEVFORKDONE
127# define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
128#endif
129#ifndef PTRACE_O_TRACEEXIT
130# define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
131#endif
132#ifndef PTRACE_O_TRACESECCOMP
133# define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
134#endif
135#ifndef PTRACE_O_EXITKILL
136# define PTRACE_O_EXITKILL (1 << 20)
137#endif
Dmitry V. Levin8e0442d2015-09-14 14:42:28 +0000138#ifndef PTRACE_O_SUSPEND_SECCOMP
139# define PTRACE_O_SUSPEND_SECCOMP (1 << 21)
140#endif
Dmitry V. Levinfadf3792015-02-13 00:26:38 +0000141
142#ifndef PTRACE_SETOPTIONS
143# define PTRACE_SETOPTIONS 0x4200
144#endif
145#ifndef PTRACE_GETEVENTMSG
146# define PTRACE_GETEVENTMSG 0x4201
147#endif
148#ifndef PTRACE_GETSIGINFO
149# define PTRACE_GETSIGINFO 0x4202
150#endif
151#ifndef PTRACE_SETSIGINFO
152# define PTRACE_SETSIGINFO 0x4203
153#endif
154#ifndef PTRACE_GETREGSET
155# define PTRACE_GETREGSET 0x4204
156#endif
157#ifndef PTRACE_SETREGSET
158# define PTRACE_SETREGSET 0x4205
159#endif
160#ifndef PTRACE_SEIZE
161# define PTRACE_SEIZE 0x4206
162#endif
163#ifndef PTRACE_INTERRUPT
164# define PTRACE_INTERRUPT 0x4207
165#endif
166#ifndef PTRACE_LISTEN
167# define PTRACE_LISTEN 0x4208
168#endif
169#ifndef PTRACE_PEEKSIGINFO
170# define PTRACE_PEEKSIGINFO 0x4209
171#endif
172#ifndef PTRACE_GETSIGMASK
173# define PTRACE_GETSIGMASK 0x420a
174#endif
175#ifndef PTRACE_SETSIGMASK
176# define PTRACE_SETSIGMASK 0x420b
177#endif
Dmitry V. Levin65f8d392016-01-12 02:04:44 +0000178#ifndef PTRACE_SECCOMP_GET_FILTER
179# define PTRACE_SECCOMP_GET_FILTER 0x420c
180#endif
Dmitry V. Levinfadf3792015-02-13 00:26:38 +0000181
182#if !HAVE_DECL_PTRACE_PEEKUSER
183# define PTRACE_PEEKUSER PTRACE_PEEKUSR
184#endif
185#if !HAVE_DECL_PTRACE_POKEUSER
186# define PTRACE_POKEUSER PTRACE_POKEUSR
187#endif
Eugene Syromyatnikov18907922016-08-07 06:44:19 +0300188
Dmitry V. Levin42ceb0f2016-08-07 22:02:46 +0000189#endif /* !STRACE_PTRACE_H */