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 Dec 4, 2023
1 parent 497ac42 commit 62e017f
Show file tree
Hide file tree
Showing 20 changed files with 146 additions and 325 deletions.
39 changes: 0 additions & 39 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1889,43 +1889,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_HIOS
PT_LOPROC
PT_HIPROC
Expand Down Expand Up @@ -3474,7 +3437,6 @@ pthread_spin_unlock
pthread_spinlock_t
pthread_t
ptrace
ptrace_peeksiginfo_args
ptrdiff_t
ptsname
ptsname_r
Expand Down Expand Up @@ -3538,7 +3500,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 @@ -363,11 +363,6 @@ PR_SET_VMA
PR_SET_VMA_ANON_NAME
PROC_SUPER_MAGIC
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 @@ -644,8 +639,6 @@ pthread_attr_setaffinity_np
pthread_rwlockattr_getkind_np
pthread_rwlockattr_getpshared
pthread_rwlockattr_setkind_np
ptrace_peeksiginfo_args
ptrace_syscall_info
pututxline
pwritev2
pwritev64
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 @@ -2005,6 +2005,8 @@ PTRACE_GETEVENTMSG
PTRACE_GETREGSET
PTRACE_GETSIGINFO
PTRACE_GETSIGMASK
PTRACE_GET_SYSCALL_INFO
PTRACE_GET_RSEQ_CONFIGURATION
PTRACE_INTERRUPT
PTRACE_KILL
PTRACE_LISTEN
Expand All @@ -2026,13 +2028,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_HIOS
PT_HISUNW
Expand Down Expand Up @@ -3707,6 +3715,9 @@ pthread_barrier_t
pthread_once
pthread_once_t
ptrace
ptrace_rseq_configuration
ptrace_peeksiginfo_args
ptrace_syscall_info
ptsname_r
pwrite64
pwritev
Expand Down Expand Up @@ -3747,6 +3758,7 @@ sched_setparam
sched_setscheduler
sctp_assoc_t
seccomp_data
seccomp_metadata
seed48
seekdir
sem_close
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 @@ -352,17 +352,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 @@ -1511,31 +1500,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 @@ -352,8 +352,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 @@ -774,7 +774,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 @@ -795,7 +795,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 @@ -477,8 +477,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 @@ -265,14 +265,6 @@ s! {
pub seccomp_notif_resp: ::__u16,
pub seccomp_data: ::__u16,
}

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 @@ -542,9 +534,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 62e017f

Please sign in to comment.