]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - include/uapi/linux/ptrace.h
ptrace: add ability to retrieve signals without removing from a queue (v4)
[mirror_ubuntu-zesty-kernel.git] / include / uapi / linux / ptrace.h
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 /* Read signals from a shared (process wide) queue */
65 #define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
66
67 /* Wait extended result codes for the above trace options. */
68 #define PTRACE_EVENT_FORK 1
69 #define PTRACE_EVENT_VFORK 2
70 #define PTRACE_EVENT_CLONE 3
71 #define PTRACE_EVENT_EXEC 4
72 #define PTRACE_EVENT_VFORK_DONE 5
73 #define PTRACE_EVENT_EXIT 6
74 #define PTRACE_EVENT_SECCOMP 7
75 /* Extended result codes which enabled by means other than options. */
76 #define PTRACE_EVENT_STOP 128
77
78 /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
79 #define PTRACE_O_TRACESYSGOOD 1
80 #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
81 #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
82 #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
83 #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
84 #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
85 #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
86 #define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
87
88 /* eventless options */
89 #define PTRACE_O_EXITKILL (1 << 20)
90
91 #define PTRACE_O_MASK (0x000000ff | PTRACE_O_EXITKILL)
92
93 #include <asm/ptrace.h>
94
95
96 #endif /* _UAPI_LINUX_PTRACE_H */