diff --git a/libc-test/build.rs b/libc-test/build.rs index a847f46448938..7c2875d0e9056 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -239,8 +239,10 @@ fn test_apple(target: &str) { "netinet/ip.h", "netinet/tcp.h", "netinet/udp.h", + "os/clock.h", "os/lock.h", "os/signpost.h", + "os/os_sync_wait_on_address.h", "poll.h", "pthread.h", "pthread_spis.h", diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index a3b1c92c7d0cc..4ca721005f139 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1023,6 +1023,7 @@ OFDEL OFILL OLD_TIME ONOEOT +OS_CLOCK_MACH_ABSOLUTE_TIME OS_LOG_TYPE_DEBUG OS_LOG_TYPE_DEFAULT OS_LOG_TYPE_ERROR @@ -1031,6 +1032,10 @@ OS_LOG_TYPE_INFO OS_SIGNPOST_EVENT OS_SIGNPOST_INTERVAL_BEGIN OS_SIGNPOST_INTERVAL_END +OS_SYNC_WAKE_BY_ADDRESS_NONE +OS_SYNC_WAKE_BY_ADDRESS_SHARED +OS_SYNC_WAIT_ON_ADDRESS_NONE +OS_SYNC_WAIT_ON_ADDRESS_SHARED OS_UNFAIR_LOCK_INIT OXTABS O_ASYNC @@ -2049,6 +2054,7 @@ open_memstream open_wmemstream openat openpty +os_clockid_t os_log_create os_log_t os_log_type_enabled @@ -2058,6 +2064,13 @@ os_signpost_id_generate os_signpost_id_make_with_pointer os_signpost_id_t os_signpost_type_t +os_sync_wake_by_address_any +os_sync_wake_by_address_all +os_sync_wake_by_address_flags_t +os_sync_wait_on_address +os_sync_wait_on_address_flags_t +os_sync_wait_on_address_with_deadline +os_sync_wait_on_address_with_timeout os_unfair_lock os_unfair_lock_assert_not_owner os_unfair_lock_assert_owner diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 84143e1986bfb..70019ea0b313e 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -121,6 +121,11 @@ pub type pthread_introspection_hook_t = extern "C" fn(event: ::c_uint, thread: ::pthread_t, addr: *mut ::c_void, size: ::size_t); pub type pthread_jit_write_callback_t = ::Option ::c_int>; +pub type os_clockid_t = u32; + +pub type os_sync_wait_on_address_flags_t = u32; +pub type os_sync_wake_by_address_flags_t = u32; + pub type os_unfair_lock = os_unfair_lock_s; pub type os_unfair_lock_t = *mut os_unfair_lock; @@ -5441,6 +5446,15 @@ pub const VOL_CAP_INT_RENAME_SWAP: attrgroup_t = 0x00040000; pub const VOL_CAP_INT_RENAME_EXCL: attrgroup_t = 0x00080000; pub const VOL_CAP_INT_RENAME_OPENFAIL: attrgroup_t = 0x00100000; +// os/clock.h +pub const OS_CLOCK_MACH_ABSOLUTE_TIME: os_clockid_t = 32; + +// os/os_sync_wait_on_address.h +pub const OS_SYNC_WAIT_ON_ADDRESS_NONE: os_sync_wait_on_address_flags_t = 0x00000000; +pub const OS_SYNC_WAIT_ON_ADDRESS_SHARED: os_sync_wait_on_address_flags_t = 0x00000001; +pub const OS_SYNC_WAKE_BY_ADDRESS_NONE: os_sync_wake_by_address_flags_t = 0x00000000; +pub const OS_SYNC_WAKE_BY_ADDRESS_SHARED: os_sync_wake_by_address_flags_t = 0x00000001; + // /// Process being created by fork. pub const SIDL: u32 = 1; @@ -5834,6 +5848,40 @@ extern "C" { pub fn pthread_jit_write_freeze_callbacks_np(); pub fn pthread_cpu_number_np(cpu_number_out: *mut ::size_t) -> ::c_int; + // Available starting with macOS 14.4. + pub fn os_sync_wait_on_address( + addr: *mut ::c_void, + value: u64, + size: ::size_t, + flags: os_sync_wait_on_address_flags_t, + ) -> ::c_int; + pub fn os_sync_wait_on_address_with_deadline( + addr: *mut ::c_void, + value: u64, + size: ::size_t, + flags: os_sync_wait_on_address_flags_t, + clockid: os_clockid_t, + deadline: u64, + ) -> ::c_int; + pub fn os_sync_wait_on_address_with_timeout( + addr: *mut ::c_void, + value: u64, + size: ::size_t, + flags: os_sync_wait_on_address_flags_t, + clockid: os_clockid_t, + timeout_ns: u64, + ) -> ::c_int; + pub fn os_sync_wake_by_address_any( + addr: *mut ::c_void, + size: ::size_t, + flags: os_sync_wake_by_address_flags_t, + ) -> ::c_int; + pub fn os_sync_wake_by_address_all( + addr: *mut ::c_void, + size: ::size_t, + flags: os_sync_wake_by_address_flags_t, + ) -> ::c_int; + pub fn os_unfair_lock_lock(lock: os_unfair_lock_t); pub fn os_unfair_lock_trylock(lock: os_unfair_lock_t) -> bool; pub fn os_unfair_lock_unlock(lock: os_unfair_lock_t);