Skip to content

Commit

Permalink
freebsd ptrace request update
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Nov 6, 2021
1 parent 2af710a commit c199251
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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,
}
});
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1691,6 +1693,7 @@ pthread_spinlock_t
ptrace
ptrace_io_desc
ptrace_lwpinfo
ptrace_sc_ret
ptrace_vm_entry
pututxline
pwritev
Expand Down
7 changes: 7 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c199251

Please sign in to comment.