Skip to content

Commit

Permalink
Auto merge of #2629 - devnexen:apple_execinfo_upd, r=Amanieu
Browse files Browse the repository at this point in the history
macOs update backtrace api.
  • Loading branch information
bors committed Jan 17, 2022
2 parents e469fc2 + 6cce830 commit 5617b46
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ fn test_apple(target: &str) {
// close calls the close_nocancel system call
"close" => true,

// macOs 12 minimum
"backtrace_async" => true,

_ => false,
}
});
Expand Down
5 changes: 5 additions & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,10 @@ arc4random_uniform
arphdr
atof
backtrace
backtrace_from_fp
backtrace_image_offsets
backtrace_symbols
backtrace_symbols_fd
boolean_t
bpf_hdr
brk
Expand Down Expand Up @@ -1715,6 +1719,7 @@ if_freenameindex
if_msghdr
if_nameindex
ifaddrs
image_offset
in6_pktinfo
in_pktinfo
initgroups
Expand Down
22 changes: 22 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,11 @@ s! {
pub ri_interval_max_phys_footprint: u64,
pub ri_runnable_time: u64,
}

pub struct image_offset {
pub uuid: ::uuid_t,
pub offset: u32,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -4945,6 +4950,23 @@ extern "C" {
) -> kern_return_t;
pub fn __error() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
pub fn backtrace_symbols(addrs: *const *mut ::c_void, sz: ::c_int) -> *mut *mut ::c_char;
pub fn backtrace_symbols_fd(addrs: *const *mut ::c_void, sz: ::c_int, fd: ::c_int);
pub fn backtrace_from_fp(
startfp: *mut ::c_void,
array: *mut *mut ::c_void,
size: ::c_int,
) -> ::c_int;
pub fn backtrace_image_offsets(
array: *const *mut ::c_void,
image_offsets: *mut image_offset,
size: ::c_int,
);
pub fn backtrace_async(
array: *mut *mut ::c_void,
length: ::size_t,
task_id: *mut u32,
) -> ::size_t;
#[cfg_attr(
all(target_os = "macos", not(target_arch = "aarch64")),
link_name = "statfs$INODE64"
Expand Down

0 comments on commit 5617b46

Please sign in to comment.