github.com/afumu/libc@v0.0.6/musl/include/sys/ptrace.h (about)

     1  #ifndef _SYS_PTRACE_H
     2  #define _SYS_PTRACE_H
     3  #ifdef __cplusplus
     4  extern "C" {
     5  #endif
     6  
     7  #include <stdint.h>
     8  
     9  #define PTRACE_TRACEME 0
    10  #define PT_TRACE_ME PTRACE_TRACEME
    11  
    12  #define PTRACE_PEEKTEXT 1
    13  #define PTRACE_PEEKDATA 2
    14  #define PTRACE_PEEKUSER 3
    15  #define PTRACE_POKETEXT 4
    16  #define PTRACE_POKEDATA 5
    17  #define PTRACE_POKEUSER 6
    18  #define PTRACE_CONT 7
    19  #define PTRACE_KILL 8
    20  #define PTRACE_SINGLESTEP 9
    21  #define PTRACE_GETREGS 12
    22  #define PTRACE_SETREGS 13
    23  #define PTRACE_GETFPREGS 14
    24  #define PTRACE_SETFPREGS 15
    25  #define PTRACE_ATTACH 16
    26  #define PTRACE_DETACH 17
    27  #define PTRACE_GETFPXREGS 18
    28  #define PTRACE_SETFPXREGS 19
    29  #define PTRACE_SYSCALL 24
    30  #define PTRACE_SETOPTIONS 0x4200
    31  #define PTRACE_GETEVENTMSG 0x4201
    32  #define PTRACE_GETSIGINFO 0x4202
    33  #define PTRACE_SETSIGINFO 0x4203
    34  #define PTRACE_GETREGSET 0x4204
    35  #define PTRACE_SETREGSET 0x4205
    36  #define PTRACE_SEIZE 0x4206
    37  #define PTRACE_INTERRUPT 0x4207
    38  #define PTRACE_LISTEN 0x4208
    39  #define PTRACE_PEEKSIGINFO 0x4209
    40  #define PTRACE_GETSIGMASK 0x420a
    41  #define PTRACE_SETSIGMASK 0x420b
    42  #define PTRACE_SECCOMP_GET_FILTER 0x420c
    43  #define PTRACE_SECCOMP_GET_METADATA 0x420d
    44  #define PTRACE_GET_SYSCALL_INFO 0x420e
    45  
    46  #define PT_READ_I PTRACE_PEEKTEXT
    47  #define PT_READ_D PTRACE_PEEKDATA
    48  #define PT_READ_U PTRACE_PEEKUSER
    49  #define PT_WRITE_I PTRACE_POKETEXT
    50  #define PT_WRITE_D PTRACE_POKEDATA
    51  #define PT_WRITE_U PTRACE_POKEUSER
    52  #define PT_CONTINUE PTRACE_CONT
    53  #define PT_KILL PTRACE_KILL
    54  #define PT_STEP PTRACE_SINGLESTEP
    55  #define PT_GETREGS PTRACE_GETREGS
    56  #define PT_SETREGS PTRACE_SETREGS
    57  #define PT_GETFPREGS PTRACE_GETFPREGS
    58  #define PT_SETFPREGS PTRACE_SETFPREGS
    59  #define PT_ATTACH PTRACE_ATTACH
    60  #define PT_DETACH PTRACE_DETACH
    61  #define PT_GETFPXREGS PTRACE_GETFPXREGS
    62  #define PT_SETFPXREGS PTRACE_SETFPXREGS
    63  #define PT_SYSCALL PTRACE_SYSCALL
    64  #define PT_SETOPTIONS PTRACE_SETOPTIONS
    65  #define PT_GETEVENTMSG PTRACE_GETEVENTMSG
    66  #define PT_GETSIGINFO PTRACE_GETSIGINFO
    67  #define PT_SETSIGINFO PTRACE_SETSIGINFO
    68  
    69  #define PTRACE_O_TRACESYSGOOD   0x00000001
    70  #define PTRACE_O_TRACEFORK      0x00000002
    71  #define PTRACE_O_TRACEVFORK     0x00000004
    72  #define PTRACE_O_TRACECLONE     0x00000008
    73  #define PTRACE_O_TRACEEXEC      0x00000010
    74  #define PTRACE_O_TRACEVFORKDONE 0x00000020
    75  #define PTRACE_O_TRACEEXIT      0x00000040
    76  #define PTRACE_O_TRACESECCOMP   0x00000080
    77  #define PTRACE_O_EXITKILL       0x00100000
    78  #define PTRACE_O_SUSPEND_SECCOMP 0x00200000
    79  #define PTRACE_O_MASK           0x003000ff
    80  
    81  #define PTRACE_EVENT_FORK 1
    82  #define PTRACE_EVENT_VFORK 2
    83  #define PTRACE_EVENT_CLONE 3
    84  #define PTRACE_EVENT_EXEC 4
    85  #define PTRACE_EVENT_VFORK_DONE 5
    86  #define PTRACE_EVENT_EXIT 6
    87  #define PTRACE_EVENT_SECCOMP 7
    88  #define PTRACE_EVENT_STOP 128
    89  
    90  #define PTRACE_PEEKSIGINFO_SHARED 1
    91  
    92  #define PTRACE_SYSCALL_INFO_NONE 0
    93  #define PTRACE_SYSCALL_INFO_ENTRY 1
    94  #define PTRACE_SYSCALL_INFO_EXIT 2
    95  #define PTRACE_SYSCALL_INFO_SECCOMP 3
    96  
    97  #include <bits/ptrace.h>
    98  
    99  struct __ptrace_peeksiginfo_args {
   100  	uint64_t off;
   101  	uint32_t flags;
   102  	int32_t nr;
   103  };
   104  
   105  struct __ptrace_seccomp_metadata {
   106  	uint64_t filter_off;
   107  	uint64_t flags;
   108  };
   109  
   110  struct __ptrace_syscall_info {
   111  	uint8_t op;
   112  	uint8_t __pad[3];
   113  	uint32_t arch;
   114  	uint64_t instruction_pointer;
   115  	uint64_t stack_pointer;
   116  	union {
   117  		struct {
   118  			uint64_t nr;
   119  			uint64_t args[6];
   120  		} entry;
   121  		struct {
   122  			int64_t rval;
   123  			uint8_t is_error;
   124  		} exit;
   125  		struct {
   126  			uint64_t nr;
   127  			uint64_t args[6];
   128  			uint32_t ret_data;
   129  		} seccomp;
   130  	};
   131  };
   132  
   133  long ptrace(int, ...);
   134  
   135  #ifdef __cplusplus
   136  }
   137  #endif
   138  #endif