From d57a8316cb82ed9dab7b88f2ee6f6637e5909b37 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Tue, 10 Sep 2024 22:13:03 +0100 Subject: [PATCH] Add mach_error_string (and mach_error_t) `mach_error_string` is defined in `/usr/include/mach/mach_error.h` It is not referenced in the documentation Apple website. ``` char *mach_error_string( /* * Returns a string appropriate to the error argument given */ mach_error_t error_value ); ``` `mach_error_t` is defined in `/usr/include/mach/error.h` https://developer.apple.com/documentation/kernel/mach_error_t ``` typedef kern_return_t mach_error_t; ``` --- libc-test/semver/apple.txt | 2 ++ src/unix/bsd/apple/mod.rs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index f022a006de401..1b548b594a2cb 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1913,6 +1913,8 @@ lockf log2phys login_tty lutimes +mach_error_string +mach_error_t madvise malloc_default_zone malloc_good_size diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index d991e379ba79a..48d6edd86aa6c 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -58,6 +58,7 @@ pub type thread_inspect_t = ::mach_port_t; pub type thread_act_t = ::mach_port_t; pub type thread_act_array_t = *mut ::thread_act_t; pub type policy_t = ::c_int; +pub type mach_error_t = ::kern_return_t; pub type mach_vm_address_t = u64; pub type mach_vm_offset_t = u64; pub type mach_vm_size_t = u64; @@ -6209,6 +6210,8 @@ extern "C" { pub fn copyfile_state_get(s: copyfile_state_t, flags: u32, dst: *mut ::c_void) -> ::c_int; pub fn copyfile_state_set(s: copyfile_state_t, flags: u32, src: *const ::c_void) -> ::c_int; + pub fn mach_error_string(error_value: ::mach_error_t) -> *mut ::c_char; + // Added in macOS 10.13 // ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1 pub fn memset_s(s: *mut ::c_void, smax: ::size_t, c: ::c_int, n: ::size_t) -> ::c_int;