Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/addr_validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn create_pipe() -> nix::Result<(i32, i32)> {
}

#[inline]
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
#[cfg(any(target_os = "freebsd", target_os = "macos", target_os = "netbsd"))]
fn create_pipe() -> nix::Result<(i32, i32)> {
use nix::fcntl::{fcntl, FcntlArg, FdFlag, OFlag};
use nix::unistd::pipe;
Expand Down
12 changes: 8 additions & 4 deletions src/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ struct ErrnoProtector(libc::c_int);
impl ErrnoProtector {
fn new() -> Self {
unsafe {
#[cfg(target_os = "android")]
#[cfg(any(target_os = "android", target_os = "netbsd"))]
{
let errno = *libc::__errno();
Self(errno)
Expand All @@ -255,7 +255,7 @@ impl ErrnoProtector {
impl Drop for ErrnoProtector {
fn drop(&mut self) {
unsafe {
#[cfg(target_os = "android")]
#[cfg(any(target_os = "android", target_os = "netbsd"))]
{
*libc::__errno() = self.0;
}
Expand Down Expand Up @@ -304,9 +304,13 @@ extern "C" fn perf_signal_handler(
let addr =
unsafe { (*ucontext).uc_mcontext.gregs[libc::REG_RIP as usize] as usize };

#[cfg(all(target_arch = "x86_64", target_os = "freebsd"))]
#[cfg(target_os = "freebsd")]
let addr = unsafe { (*ucontext).uc_mcontext.mc_rip as usize };

#[cfg(all(target_arch = "x86_64", target_os = "netbsd"))]
let addr =
unsafe { (*ucontext).uc_mcontext.__gregs[libc::_REG_RIP as usize] as usize };

#[cfg(all(target_arch = "x86_64", target_os = "macos"))]
let addr = unsafe {
let mcontext = (*ucontext).uc_mcontext;
Expand All @@ -323,7 +327,7 @@ extern "C" fn perf_signal_handler(
))]
let addr = unsafe { (*ucontext).uc_mcontext.pc as usize };

#[cfg(all(target_arch = "aarch64", target_os = "freebsd"))]
#[cfg(all(target_arch = "aarch64", any(target_os = "freebsd", target_os = "netbsd")))]
let addr = unsafe { (*ucontext).mc_gpregs.gp_elr as usize };

#[cfg(all(target_arch = "aarch64", target_os = "macos"))]
Expand Down
Loading