diff --git a/libc-test/build.rs b/libc-test/build.rs index d9965d39f80db..c85c7c8088358 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -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, } }); diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index bbc3c73c97355..81942df1b3584 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -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 @@ -1715,6 +1719,7 @@ if_freenameindex if_msghdr if_nameindex ifaddrs +image_offset in6_pktinfo in_pktinfo initgroups diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 0626398864a8a..1d10a11562055 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -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! { @@ -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"