1 #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 
8 #include <linux/types.h>
9 
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 
56 #define PTRACE_PEEKSIGINFO	0x4209
57 
58 struct ptrace_peeksiginfo_args {
59 	__u64 off;	/* from which siginfo to start */
60 	__u32 flags;
61 	__s32 nr;	/* how may siginfos to take */
62 };
63 
64 #define PTRACE_GETSIGMASK	0x420a
65 #define PTRACE_SETSIGMASK	0x420b
66 
67 #define PTRACE_SECCOMP_GET_FILTER	0x420c
68 
69 /* Read signals from a shared (process wide) queue */
70 #define PTRACE_PEEKSIGINFO_SHARED	(1 << 0)
71 
72 /* 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 
93 /* eventless options */
94 #define PTRACE_O_EXITKILL		(1 << 20)
95 #define PTRACE_O_SUSPEND_SECCOMP	(1 << 21)
96 
97 #define PTRACE_O_MASK		(\
98 	0x000000ff | PTRACE_O_EXITKILL | PTRACE_O_SUSPEND_SECCOMP)
99 
100 #include <asm/ptrace.h>
101 
102 
103 #endif /* _UAPI_LINUX_PTRACE_H */
104