From c199251fbd9328e912a5d92859e9f5ed80bcc422 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 6 Nov 2021 18:53:05 +0000 Subject: [PATCH] freebsd ptrace request update --- libc-test/build.rs | 6 ++++++ libc-test/semver/freebsd.txt | 3 +++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 651f25039c74c..2bf23876103d2 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2034,6 +2034,9 @@ fn test_freebsd(target: &str) { true } + // Added in FreeBSD 12.1 + "PT_GET_SC_RET" | "PT_GET_SC_ARGS" if Some(11) == freebsd_ver => true, + // Added in in FreeBSD 13.0 (r367776 and r367287) "SCM_CREDS2" | "LOCAL_CREDS_PERSISTENT" if Some(13) > freebsd_ver => true, @@ -2065,6 +2068,9 @@ fn test_freebsd(target: &str) { // `procstat` is a private struct "procstat" => true, + // `ptrace_sc_ret` is not available in FreeBSD 11 + "ptrace_sc_ret" if Some(11) == freebsd_ver => true, + _ => false, } }); diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 9413be71553f0..04359e1d9041f 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -916,6 +916,8 @@ PT_GETLWPLIST PT_GETNUMLWPS PT_GETREGS PT_GET_EVENT_MASK +PT_GET_SC_ARGS +PT_GET_SC_RET PT_IO PT_KILL PT_LWPINFO @@ -1691,6 +1693,7 @@ pthread_spinlock_t ptrace ptrace_io_desc ptrace_lwpinfo +ptrace_sc_ret ptrace_vm_entry pututxline pwritev diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 57ce5ab96bef5..0f23d2c383c98 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -153,6 +153,11 @@ s! { pub pl_syscall_narg: ::c_uint, } + pub struct ptrace_sc_ret { + pub sr_retval: [::register_t; 2], + pub sr_error: ::c_int, + } + pub struct cpuset_t { #[cfg(target_pointer_width = "64")] __bits: [::c_long; 4], @@ -1139,6 +1144,8 @@ pub const PT_FOLLOW_FORK: ::c_int = 23; pub const PT_LWP_EVENTS: ::c_int = 24; pub const PT_GET_EVENT_MASK: ::c_int = 25; pub const PT_SET_EVENT_MASK: ::c_int = 26; +pub const PT_GET_SC_ARGS: ::c_int = 27; +pub const PT_GET_SC_RET: ::c_int = 28; pub const PT_GETREGS: ::c_int = 33; pub const PT_SETREGS: ::c_int = 34; pub const PT_GETFPREGS: ::c_int = 35;