Skip to content

Commit

Permalink
Move common Linux ptrace definitions to linux_like/mod.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbyzhang committed Nov 13, 2024
1 parent ffb7f0c commit 1e3c4a4
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 320 deletions.
39 changes: 0 additions & 39 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1958,43 +1958,6 @@ PTHREAD_MUTEX_NORMAL
PTHREAD_MUTEX_RECURSIVE
PTHREAD_RWLOCK_INITIALIZER
PTHREAD_STACK_MIN
PTRACE_ATTACH
PTRACE_CONT
PTRACE_DETACH
PTRACE_EVENT_CLONE
PTRACE_EVENT_EXEC
PTRACE_EVENT_EXIT
PTRACE_EVENT_FORK
PTRACE_EVENT_SECCOMP
PTRACE_EVENT_STOP
PTRACE_EVENT_VFORK
PTRACE_EVENT_VFORK_DONE
PTRACE_GETEVENTMSG
PTRACE_GETSIGINFO
PTRACE_KILL
PTRACE_O_EXITKILL
PTRACE_O_MASK
PTRACE_O_SUSPEND_SECCOMP
PTRACE_O_TRACECLONE
PTRACE_O_TRACEEXEC
PTRACE_O_TRACEEXIT
PTRACE_O_TRACEFORK
PTRACE_O_TRACESECCOMP
PTRACE_O_TRACESYSGOOD
PTRACE_O_TRACEVFORK
PTRACE_O_TRACEVFORKDONE
PTRACE_PEEKDATA
PTRACE_PEEKTEXT
PTRACE_PEEKUSER
PTRACE_POKEDATA
PTRACE_POKETEXT
PTRACE_POKEUSER
PTRACE_SECCOMP_GET_METADATA
PTRACE_SETOPTIONS
PTRACE_SETSIGINFO
PTRACE_SINGLESTEP
PTRACE_SYSCALL
PTRACE_TRACEME
PT_DYNAMIC
PT_GNU_EH_FRAME
PT_GNU_RELRO
Expand Down Expand Up @@ -3633,7 +3596,6 @@ pthread_spin_unlock
pthread_spinlock_t
pthread_t
ptrace
ptrace_peeksiginfo_args
ptrdiff_t
ptsname
ptsname_r
Expand Down Expand Up @@ -3697,7 +3659,6 @@ sched_setparam
sched_setscheduler
sched_yield
seccomp_data
seccomp_metadata
seekdir
select
sem_close
Expand Down
2 changes: 0 additions & 2 deletions libc-test/semver/linux-gnu-x86_64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ NFT_MSG_NEWOBJ
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
PTRACE_GET_RSEQ_CONFIGURATION
PTRACE_SYSEMU
PTRACE_SYSEMU_SINGLESTEP
_libc_fpstate
flock64
getcontext
makecontext
ptrace_rseq_configuration
setcontext
swapcontext
termios2
7 changes: 0 additions & 7 deletions libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,6 @@ PROC_SUPER_MAGIC
PR_SET_VMA
PR_SET_VMA_ANON_NAME
PTHREAD_MUTEX_ADAPTIVE_NP
PTRACE_GET_SYSCALL_INFO
PTRACE_SYSCALL_INFO_ENTRY
PTRACE_SYSCALL_INFO_EXIT
PTRACE_SYSCALL_INFO_NONE
PTRACE_SYSCALL_INFO_SECCOMP
QNX4_SUPER_MAGIC
QNX6_SUPER_MAGIC
RDTGROUP_SUPER_MAGIC
Expand Down Expand Up @@ -680,8 +675,6 @@ pthread_attr_setaffinity_np
pthread_rwlockattr_getkind_np
pthread_rwlockattr_getpshared
pthread_rwlockattr_setkind_np
ptrace_peeksiginfo_args
ptrace_syscall_info
putgrent
putpwent
pututxline
Expand Down
12 changes: 12 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2267,6 +2267,8 @@ PTRACE_GETEVENTMSG
PTRACE_GETREGSET
PTRACE_GETSIGINFO
PTRACE_GETSIGMASK
PTRACE_GET_RSEQ_CONFIGURATION
PTRACE_GET_SYSCALL_INFO
PTRACE_INTERRUPT
PTRACE_KILL
PTRACE_LISTEN
Expand All @@ -2288,13 +2290,19 @@ PTRACE_PEEKUSER
PTRACE_POKEDATA
PTRACE_POKETEXT
PTRACE_POKEUSER
PTRACE_SECCOMP_GET_FILTER
PTRACE_SECCOMP_GET_METADATA
PTRACE_SEIZE
PTRACE_SETOPTIONS
PTRACE_SETREGSET
PTRACE_SETSIGINFO
PTRACE_SETSIGMASK
PTRACE_SINGLESTEP
PTRACE_SYSCALL
PTRACE_SYSCALL_INFO_ENTRY
PTRACE_SYSCALL_INFO_EXIT
PTRACE_SYSCALL_INFO_NONE
PTRACE_SYSCALL_INFO_SECCOMP
PTRACE_TRACEME
PT_DYNAMIC
PT_GNU_EH_FRAME
Expand Down Expand Up @@ -3916,6 +3924,9 @@ pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
ptrace
ptrace_peeksiginfo_args
ptrace_rseq_configuration
ptrace_syscall_info
ptsname_r
pwrite64
pwritev
Expand Down Expand Up @@ -3956,6 +3967,7 @@ sched_setparam
sched_setscheduler
sctp_assoc_t
seccomp_data
seccomp_metadata
seccomp_notif
seccomp_notif_addfd
seccomp_notif_resp
Expand Down
36 changes: 0 additions & 36 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,6 @@ s! {
pub args: [::__u64; 6],
}

pub struct seccomp_metadata {
pub filter_off: ::__u64,
pub flags: ::__u64,
}

pub struct ptrace_peeksiginfo_args {
pub off: ::__u64,
pub flags: ::__u32,
pub nr: ::__s32,
}

// linux/input.h
pub struct input_event {
pub time: ::timeval,
Expand Down Expand Up @@ -1613,31 +1602,6 @@ pub const EXTPROC: ::tcflag_t = 0o200000;

pub const MAP_HUGETLB: ::c_int = 0x040000;

pub const PTRACE_TRACEME: ::c_int = 0;
pub const PTRACE_PEEKTEXT: ::c_int = 1;
pub const PTRACE_PEEKDATA: ::c_int = 2;
pub const PTRACE_PEEKUSER: ::c_int = 3;
pub const PTRACE_POKETEXT: ::c_int = 4;
pub const PTRACE_POKEDATA: ::c_int = 5;
pub const PTRACE_POKEUSER: ::c_int = 6;
pub const PTRACE_CONT: ::c_int = 7;
pub const PTRACE_KILL: ::c_int = 8;
pub const PTRACE_SINGLESTEP: ::c_int = 9;
pub const PTRACE_GETREGS: ::c_int = 12;
pub const PTRACE_SETREGS: ::c_int = 13;
pub const PTRACE_ATTACH: ::c_int = 16;
pub const PTRACE_DETACH: ::c_int = 17;
pub const PTRACE_SYSCALL: ::c_int = 24;
pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
pub const PTRACE_GETREGSET: ::c_int = 0x4204;
pub const PTRACE_SETREGSET: ::c_int = 0x4205;
pub const PTRACE_SECCOMP_GET_METADATA: ::c_int = 0x420d;

pub const PTRACE_EVENT_STOP: ::c_int = 128;

pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
Expand Down
31 changes: 0 additions & 31 deletions src/unix/linux_like/emscripten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1250,37 +1250,6 @@ pub const CPU_SETSIZE: ::c_int = 128;

pub const QFMT_VFS_V1: ::c_int = 4;

pub const PTRACE_TRACEME: ::c_int = 0;
pub const PTRACE_PEEKTEXT: ::c_int = 1;
pub const PTRACE_PEEKDATA: ::c_int = 2;
pub const PTRACE_PEEKUSER: ::c_int = 3;
pub const PTRACE_POKETEXT: ::c_int = 4;
pub const PTRACE_POKEDATA: ::c_int = 5;
pub const PTRACE_POKEUSER: ::c_int = 6;
pub const PTRACE_CONT: ::c_int = 7;
pub const PTRACE_KILL: ::c_int = 8;
pub const PTRACE_SINGLESTEP: ::c_int = 9;
pub const PTRACE_ATTACH: ::c_int = 16;
pub const PTRACE_DETACH: ::c_int = 17;
pub const PTRACE_SYSCALL: ::c_int = 24;
pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
pub const PTRACE_GETREGSET: ::c_int = 0x4204;
pub const PTRACE_SETREGSET: ::c_int = 0x4205;
pub const PTRACE_SEIZE: ::c_int = 0x4206;
pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
pub const PTRACE_LISTEN: ::c_int = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;

pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;

pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;

pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
Expand Down
4 changes: 0 additions & 4 deletions src/unix/linux_like/linux/gnu/b32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ cfg_if! {

pub const SA_ONSTACK: ::c_int = 1;

pub const PTRACE_DETACH: ::c_uint = 11;

pub const F_SETLK: ::c_int = 8;
pub const F_SETLKW: ::c_int = 9;

Expand Down Expand Up @@ -222,8 +220,6 @@ cfg_if! {

pub const SA_ONSTACK: ::c_int = 0x08000000;

pub const PTRACE_DETACH: ::c_uint = 17;

pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;

Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,6 @@ pub const POLLWRBAND: ::c_short = 0x200;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;

pub const PTRACE_DETACH: ::c_uint = 17;

pub const EFD_NONBLOCK: ::c_int = 0x800;

pub const F_GETLK: ::c_int = 5;
Expand Down
1 change: 0 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,6 @@ pub const POLLWRBAND: ::c_short = 0x200;

pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
pub const PTRACE_DETACH: ::c_uint = 17;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
Expand Down
1 change: 0 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/mips64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,6 @@ pub const TCSAFLUSH: ::c_int = 0x5410;

pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
pub const PTRACE_DETACH: ::c_uint = 17;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ pub const POLLWRBAND: ::c_short = 0x200;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;

pub const PTRACE_DETACH: ::c_uint = 17;

pub const EFD_NONBLOCK: ::c_int = 0x800;

pub const F_GETLK: ::c_int = 5;
Expand Down
1 change: 0 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ pub const POLLWRNORM: ::c_short = 256;
pub const POLLWRBAND: ::c_short = 512;
pub const O_ASYNC: ::c_int = 8192;
pub const O_NDELAY: ::c_int = 2048;
pub const PTRACE_DETACH: ::c_uint = 17;
pub const EFD_NONBLOCK: ::c_int = 2048;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,6 @@ pub const FLUSHO: ::tcflag_t = 0x00001000;

pub const EXTPROC: ::tcflag_t = 0x00010000;

pub const PTRACE_DETACH: ::c_uint = 17;

pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
pub const MCL_ONFAULT: ::c_int = 0x0004;
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ pub const POLLWRBAND: ::c_short = 0x100;
pub const O_ASYNC: ::c_int = 0x40;
pub const O_NDELAY: ::c_int = 0x4004;

pub const PTRACE_DETACH: ::c_uint = 17;

pub const EFD_NONBLOCK: ::c_int = 0x4000;

pub const F_GETLK: ::c_int = 7;
Expand Down
11 changes: 0 additions & 11 deletions src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,6 @@ s! {
__unused4: u64,
__unused5: u64
}

pub struct ptrace_rseq_configuration {
pub rseq_abi_pointer: ::__u64,
pub rseq_abi_size: ::__u32,
pub signature: ::__u32,
pub flags: ::__u32,
pub pad: ::__u32,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -536,9 +528,6 @@ pub const POLLWRBAND: ::c_short = 0x200;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;

pub const PTRACE_DETACH: ::c_uint = 17;
pub const PTRACE_GET_RSEQ_CONFIGURATION: ::c_uint = 0x420f;

pub const EFD_NONBLOCK: ::c_int = 0x800;

pub const F_GETLK: ::c_int = 5;
Expand Down
Loading

0 comments on commit 1e3c4a4

Please sign in to comment.