From cd79a4af0ad547be916acd61127e50ab0cf2ec5d Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 19 Nov 2021 18:12:08 +0000 Subject: [PATCH] couple of ptrace query for openbsd --- libc-test/semver/openbsd.txt | 7 +++++++ src/unix/bsd/netbsdlike/openbsd/mod.rs | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index 989bd026df649..5287d18ffb51b 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -615,10 +615,15 @@ PT_ATTACH PT_CONTINUE PT_DETACH PT_FIRSTMACH +PT_GET_EVENT_MASK +PT_GET_PROCESS_STATE +PT_GET_THREAD_FIRST +PT_GET_THREAD_NEXT PT_IO PT_KILL PT_READ_D PT_READ_I +PT_SET_EVENT_MASK PT_TRACE_ME PT_WRITE_D PT_WRITE_I @@ -1060,6 +1065,8 @@ pthread_spinlock_t pthread_stackseg_np ptrace ptrace_io_desc +ptrace_state +ptrace_thread_state pwritev qsort rand diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 1228683f63b76..1bd7ac720fe87 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -401,6 +401,16 @@ s! { pub kve_inheritance: ::c_int, pub kve_flags: u8, } + + pub struct ptrace_state { + pub pe_report_event: ::c_int, + pub pe_other_pid: ::pid_t, + pub pe_tid: ::pid_t, + } + + pub struct ptrace_thread_state { + pub pts_tid: ::pid_t, + } } impl siginfo_t { @@ -1428,6 +1438,11 @@ pub const PTHREAD_STACK_MIN: ::size_t = 1_usize << _MAX_PAGE_SHIFT; pub const MINSIGSTKSZ: ::size_t = 3_usize << _MAX_PAGE_SHIFT; pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + (1_usize << _MAX_PAGE_SHIFT) * 4; +pub const PT_SET_EVENT_MASK: ::c_int = 12; +pub const PT_GET_EVENT_MASK: ::c_int = 13; +pub const PT_GET_PROCESS_STATE: ::c_int = 14; +pub const PT_GET_THREAD_FIRST: ::c_int = 15; +pub const PT_GET_THREAD_NEXT: ::c_int = 16; pub const PT_FIRSTMACH: ::c_int = 32; pub const SOCK_CLOEXEC: ::c_int = 0x8000;