Home | History | Annotate | Download | only in strace
      1 /*
      2  * Copyright (c) 1991, 1992 Paul Kranenburg <pk (at) cs.few.eur.nl>
      3  * Copyright (c) 1993 Branko Lankester <branko (at) hacktic.nl>
      4  * Copyright (c) 1993-1996 Rick Sladkey <jrs (at) world.std.com>
      5  * Copyright (c) 2004 Roland McGrath <roland (at) redhat.com>
      6  * Copyright (c) 2010 Wang Chao <wang.chao (at) cn.fujitsu.com>
      7  * Copyright (c) 2011-2013 Denys Vlasenko <vda.linux (at) googlemail.com>
      8  * Copyright (c) 2011-2016 Dmitry V. Levin <ldv (at) altlinux.org>
      9  * Copyright (c) 2013 Ali Polatel <alip (at) exherbo.org>
     10  * Copyright (c) 2015 Mike Frysinger <vapier (at) 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 
     36 #ifndef STRACE_PTRACE_H
     37 #define STRACE_PTRACE_H
     38 
     39 #include <sys/ptrace.h>
     40 
     41 #ifdef HAVE_STRUCT_IA64_FPREG
     42 # define ia64_fpreg XXX_ia64_fpreg
     43 #endif
     44 #ifdef HAVE_STRUCT_PT_ALL_USER_REGS
     45 # define pt_all_user_regs XXX_pt_all_user_regs
     46 #endif
     47 #ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
     48 # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
     49 #endif
     50 
     51 #include <linux/ptrace.h>
     52 
     53 #ifdef HAVE_STRUCT_IA64_FPREG
     54 # undef ia64_fpreg
     55 #endif
     56 #ifdef HAVE_STRUCT_PT_ALL_USER_REGS
     57 # undef pt_all_user_regs
     58 #endif
     59 #ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
     60 # undef ptrace_peeksiginfo_args
     61 #endif
     62 
     63 #if defined(SPARC) || defined(SPARC64)
     64 /*
     65  * SPARC has a different PTRACE_DETACH value correctly defined in sys/ptrace.h,
     66  * but linux/ptrace.h clobbers it with the standard one.  PTRACE_SUNDETACH is
     67  * also defined to the correct value by sys/ptrace.h, so use that instead.
     68  */
     69 # undef PTRACE_DETACH
     70 # define PTRACE_DETACH PTRACE_SUNDETACH
     71 #endif
     72 
     73 #ifndef PTRACE_EVENT_FORK
     74 # define PTRACE_EVENT_FORK	1
     75 #endif
     76 #ifndef PTRACE_EVENT_VFORK
     77 # define PTRACE_EVENT_VFORK	2
     78 #endif
     79 #ifndef PTRACE_EVENT_CLONE
     80 # define PTRACE_EVENT_CLONE	3
     81 #endif
     82 #ifndef PTRACE_EVENT_EXEC
     83 # define PTRACE_EVENT_EXEC	4
     84 #endif
     85 #ifndef PTRACE_EVENT_VFORK_DONE
     86 # define PTRACE_EVENT_VFORK_DONE	5
     87 #endif
     88 #ifndef PTRACE_EVENT_EXIT
     89 # define PTRACE_EVENT_EXIT	6
     90 #endif
     91 #ifndef PTRACE_EVENT_SECCOMP
     92 # define PTRACE_EVENT_SECCOMP	7
     93 #endif
     94 #ifdef PTRACE_EVENT_STOP
     95 /* Linux 3.1 - 3.3 releases had a broken value.  It was fixed in 3.4.  */
     96 # if PTRACE_EVENT_STOP == 7
     97 #  undef PTRACE_EVENT_STOP
     98 # endif
     99 #endif
    100 #ifndef PTRACE_EVENT_STOP
    101 # define PTRACE_EVENT_STOP	128
    102 #endif
    103 
    104 #ifndef PTRACE_O_TRACESYSGOOD
    105 # define PTRACE_O_TRACESYSGOOD	1
    106 #endif
    107 #ifndef PTRACE_O_TRACEFORK
    108 # define PTRACE_O_TRACEFORK	(1 << PTRACE_EVENT_FORK)
    109 #endif
    110 #ifndef PTRACE_O_TRACEVFORK
    111 # define PTRACE_O_TRACEVFORK	(1 << PTRACE_EVENT_VFORK)
    112 #endif
    113 #ifndef PTRACE_O_TRACECLONE
    114 # define PTRACE_O_TRACECLONE	(1 << PTRACE_EVENT_CLONE)
    115 #endif
    116 #ifndef PTRACE_O_TRACEEXEC
    117 # define PTRACE_O_TRACEEXEC	(1 << PTRACE_EVENT_EXEC)
    118 #endif
    119 #ifndef PTRACE_O_TRACEVFORKDONE
    120 # define PTRACE_O_TRACEVFORKDONE	(1 << PTRACE_EVENT_VFORK_DONE)
    121 #endif
    122 #ifndef PTRACE_O_TRACEEXIT
    123 # define PTRACE_O_TRACEEXIT	(1 << PTRACE_EVENT_EXIT)
    124 #endif
    125 #ifndef PTRACE_O_TRACESECCOMP
    126 # define PTRACE_O_TRACESECCOMP	(1 << PTRACE_EVENT_SECCOMP)
    127 #endif
    128 #ifndef PTRACE_O_EXITKILL
    129 # define PTRACE_O_EXITKILL	(1 << 20)
    130 #endif
    131 #ifndef PTRACE_O_SUSPEND_SECCOMP
    132 # define PTRACE_O_SUSPEND_SECCOMP	(1 << 21)
    133 #endif
    134 
    135 #ifndef PTRACE_SETOPTIONS
    136 # define PTRACE_SETOPTIONS	0x4200
    137 #endif
    138 #ifndef PTRACE_GETEVENTMSG
    139 # define PTRACE_GETEVENTMSG	0x4201
    140 #endif
    141 #ifndef PTRACE_GETSIGINFO
    142 # define PTRACE_GETSIGINFO	0x4202
    143 #endif
    144 #ifndef PTRACE_SETSIGINFO
    145 # define PTRACE_SETSIGINFO	0x4203
    146 #endif
    147 #ifndef PTRACE_GETREGSET
    148 # define PTRACE_GETREGSET	0x4204
    149 #endif
    150 #ifndef PTRACE_SETREGSET
    151 # define PTRACE_SETREGSET	0x4205
    152 #endif
    153 #ifndef PTRACE_SEIZE
    154 # define PTRACE_SEIZE		0x4206
    155 #endif
    156 #ifndef PTRACE_INTERRUPT
    157 # define PTRACE_INTERRUPT	0x4207
    158 #endif
    159 #ifndef PTRACE_LISTEN
    160 # define PTRACE_LISTEN		0x4208
    161 #endif
    162 #ifndef PTRACE_PEEKSIGINFO
    163 # define PTRACE_PEEKSIGINFO	0x4209
    164 #endif
    165 #ifndef PTRACE_GETSIGMASK
    166 # define PTRACE_GETSIGMASK	0x420a
    167 #endif
    168 #ifndef PTRACE_SETSIGMASK
    169 # define PTRACE_SETSIGMASK	0x420b
    170 #endif
    171 #ifndef PTRACE_SECCOMP_GET_FILTER
    172 # define PTRACE_SECCOMP_GET_FILTER	0x420c
    173 #endif
    174 
    175 #if !HAVE_DECL_PTRACE_PEEKUSER
    176 # define PTRACE_PEEKUSER PTRACE_PEEKUSR
    177 #endif
    178 #if !HAVE_DECL_PTRACE_POKEUSER
    179 # define PTRACE_POKEUSER PTRACE_POKEUSR
    180 #endif
    181 
    182 #endif /* !STRACE_PTRACE_H */
    183