1/* `ptrace' debugger support interface. Linux version,
2 not architecture-specific.
3 Copyright (C) 1996-2019 Free Software Foundation, Inc.
4
5 This file is part of the GNU C Library.
6
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
20
21#ifndef _SYS_PTRACE_H
22# error "Never use <bits/ptrace-shared.h> directly; include <sys/ptrace.h> instead."
23#endif
24
25/* Options set using PTRACE_SETOPTIONS. */
26enum __ptrace_setoptions
27{
28 PTRACE_O_TRACESYSGOOD = 0x00000001,
29 PTRACE_O_TRACEFORK = 0x00000002,
30 PTRACE_O_TRACEVFORK = 0x00000004,
31 PTRACE_O_TRACECLONE = 0x00000008,
32 PTRACE_O_TRACEEXEC = 0x00000010,
33 PTRACE_O_TRACEVFORKDONE = 0x00000020,
34 PTRACE_O_TRACEEXIT = 0x00000040,
35 PTRACE_O_TRACESECCOMP = 0x00000080,
36 PTRACE_O_EXITKILL = 0x00100000,
37 PTRACE_O_SUSPEND_SECCOMP = 0x00200000,
38 PTRACE_O_MASK = 0x003000ff
39};
40
41enum __ptrace_eventcodes
42{
43/* Wait extended result codes for the above trace options. */
44 PTRACE_EVENT_FORK = 1,
45 PTRACE_EVENT_VFORK = 2,
46 PTRACE_EVENT_CLONE = 3,
47 PTRACE_EVENT_EXEC = 4,
48 PTRACE_EVENT_VFORK_DONE = 5,
49 PTRACE_EVENT_EXIT = 6,
50 PTRACE_EVENT_SECCOMP = 7,
51/* Extended result codes enabled by means other than options. */
52 PTRACE_EVENT_STOP = 128
53};
54
55/* Arguments for PTRACE_PEEKSIGINFO. */
56struct __ptrace_peeksiginfo_args
57{
58 __uint64_t off; /* From which siginfo to start. */
59 __uint32_t flags; /* Flags for peeksiginfo. */
60 __int32_t nr; /* How many siginfos to take. */
61};
62
63enum __ptrace_peeksiginfo_flags
64{
65 /* Read signals from a shared (process wide) queue. */
66 PTRACE_PEEKSIGINFO_SHARED = (1 << 0)
67};
68
69/* Argument and results of PTRACE_SECCOMP_GET_METADATA. */
70struct __ptrace_seccomp_metadata
71{
72 __uint64_t filter_off; /* Input: which filter. */
73 __uint64_t flags; /* Output: filter's flags. */
74};
75
76/* Perform process tracing functions. REQUEST is one of the values
77 above, and determines the action to be taken.
78 For all requests except PTRACE_TRACEME, PID specifies the process to be
79 traced.
80
81 PID and the other arguments described above for the various requests should
82 appear (those that are used for the particular request) as:
83 pid_t PID, void *ADDR, int DATA, void *ADDR2
84 after REQUEST. */
85extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
86