Skip to content

Commit

Permalink
Add mach_error_string (and mach_error_t) (#3913)
Browse files Browse the repository at this point in the history
`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;
```
  • Loading branch information
stepancheg authored Oct 1, 2024
1 parent 1566923 commit d8ff07b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,8 @@ lockf
log2phys
login_tty
lutimes
mach_error_string
mach_error_t
madvise
malloc_default_zone
malloc_good_size
Expand Down
3 changes: 3 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d8ff07b

Please sign in to comment.