blob: fb810650900029cf1a933a7eeec033e6dc7269d6 [file] [log] [blame]
David Howells607ca462012-10-13 10:46:48 +01001#ifndef _UAPI_LINUX_PTRACE_H
2#define _UAPI_LINUX_PTRACE_H
3/* ptrace.h */
4/* structs and defines to help the user use the ptrace system call. */
5
6/* has the defines to get at the registers. */
7
Andrey Vagin84c751b2013-04-30 15:27:59 -07008#include <linux/types.h>
David Howells607ca462012-10-13 10:46:48 +01009
10#define PTRACE_TRACEME 0
11#define PTRACE_PEEKTEXT 1
12#define PTRACE_PEEKDATA 2
13#define PTRACE_PEEKUSR 3
14#define PTRACE_POKETEXT 4
15#define PTRACE_POKEDATA 5
16#define PTRACE_POKEUSR 6
17#define PTRACE_CONT 7
18#define PTRACE_KILL 8
19#define PTRACE_SINGLESTEP 9
20
21#define PTRACE_ATTACH 16
22#define PTRACE_DETACH 17
23
24#define PTRACE_SYSCALL 24
25
26/* 0x4200-0x4300 are reserved for architecture-independent additions. */
27#define PTRACE_SETOPTIONS 0x4200
28#define PTRACE_GETEVENTMSG 0x4201
29#define PTRACE_GETSIGINFO 0x4202
30#define PTRACE_SETSIGINFO 0x4203
31
32/*
33 * Generic ptrace interface that exports the architecture specific regsets
34 * using the corresponding NT_* types (which are also used in the core dump).
35 * Please note that the NT_PRSTATUS note type in a core dump contains a full
36 * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
37 * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
38 * other user_regset flavors, the user_regset layout and the ELF core dump note
39 * payload are exactly the same layout.
40 *
41 * This interface usage is as follows:
42 * struct iovec iov = { buf, len};
43 *
44 * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
45 *
46 * On the successful completion, iov.len will be updated by the kernel,
47 * specifying how much the kernel has written/read to/from the user's iov.buf.
48 */
49#define PTRACE_GETREGSET 0x4204
50#define PTRACE_SETREGSET 0x4205
51
52#define PTRACE_SEIZE 0x4206
53#define PTRACE_INTERRUPT 0x4207
54#define PTRACE_LISTEN 0x4208
55
Andrey Vagin84c751b2013-04-30 15:27:59 -070056#define PTRACE_PEEKSIGINFO 0x4209
57
58struct ptrace_peeksiginfo_args {
59 __u64 off; /* from which siginfo to start */
60 __u32 flags;
61 __s32 nr; /* how may siginfos to take */
62};
63
Andrey Vagin29000ca2013-07-03 15:08:12 -070064#define PTRACE_GETSIGMASK 0x420a
65#define PTRACE_SETSIGMASK 0x420b
66
Tycho Andersenf8e529e2015-10-27 09:23:59 +090067#define PTRACE_SECCOMP_GET_FILTER 0x420c
68
Andrey Vagin84c751b2013-04-30 15:27:59 -070069/* Read signals from a shared (process wide) queue */
70#define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
71
David Howells607ca462012-10-13 10:46:48 +010072/* Wait extended result codes for the above trace options. */
73#define PTRACE_EVENT_FORK 1
74#define PTRACE_EVENT_VFORK 2
75#define PTRACE_EVENT_CLONE 3
76#define PTRACE_EVENT_EXEC 4
77#define PTRACE_EVENT_VFORK_DONE 5
78#define PTRACE_EVENT_EXIT 6
79#define PTRACE_EVENT_SECCOMP 7
80/* Extended result codes which enabled by means other than options. */
81#define PTRACE_EVENT_STOP 128
82
83/* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
84#define PTRACE_O_TRACESYSGOOD 1
85#define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
86#define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
87#define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
88#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
89#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
90#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
91#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
92
Oleg Nesterov992fb6e2012-12-17 16:03:07 -080093/* eventless options */
Tycho Andersen13c4a902015-06-13 09:02:48 -060094#define PTRACE_O_EXITKILL (1 << 20)
95#define PTRACE_O_SUSPEND_SECCOMP (1 << 21)
Oleg Nesterov992fb6e2012-12-17 16:03:07 -080096
Tycho Andersen13c4a902015-06-13 09:02:48 -060097#define PTRACE_O_MASK (\
98 0x000000ff | PTRACE_O_EXITKILL | PTRACE_O_SUSPEND_SECCOMP)
David Howells607ca462012-10-13 10:46:48 +010099
100#include <asm/ptrace.h>
101
102
103#endif /* _UAPI_LINUX_PTRACE_H */