From 41f7f37a87b7aaf51b1151140cf6d57066a5118f Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Sun, 25 Feb 2024 06:52:56 -0800 Subject: [PATCH 1/3] xrOS support Swapped to visionOS target_os (apply to `main`) [ resolve conflicts - Trevor ] (cherry picked from commit b5b0f690a373e4615776413f68fccfc146179d02) --- build.rs | 2 +- src/unix/bsd/apple/mod.rs | 2 +- src/unix/bsd/mod.rs | 3 ++- src/unix/mod.rs | 8 ++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build.rs b/build.rs index f9eb898cca9cf..46f5dc8efff7c 100644 --- a/build.rs +++ b/build.rs @@ -22,7 +22,7 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ // Extra values to allow for check-cfg. const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[ - ("target_os", &["switch", "aix", "ohos", "hurd"]), + ("target_os", &["switch", "aix", "ohos", "hurd", "visionos"]), ("target_env", &["illumos", "wasi", "aix", "ohos"]), ( "target_arch", diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 758e069f05ce4..84e725a91cb9d 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -6427,7 +6427,7 @@ cfg_if! { } } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] { + if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "visionos"))] { extern "C" { pub fn memmem( haystack: *const ::c_void, diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 69a98e1c7e3db..487547d00540a 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -39,6 +39,7 @@ s! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "netbsd", target_os = "openbsd")))] pub pw_fields: ::c_int, @@ -924,7 +925,7 @@ cfg_if! { } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] { + if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))] { mod apple; pub use self::apple::*; } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd"))] { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 7b39e4784f96d..1e6daface673a 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -381,6 +381,7 @@ cfg_if! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "android", target_os = "openbsd", target_os = "nto", @@ -1043,7 +1044,8 @@ extern "C" { target_os = "macos", target_os = "ios", target_os = "tvos", - target_os = "watchos" + target_os = "watchos", + target_os = "visionos" ), link_name = "realpath$DARWIN_EXTSN" )] @@ -1218,7 +1220,8 @@ extern "C" { target_os = "macos", target_os = "ios", target_os = "tvos", - target_os = "watchos" + target_os = "watchos", + target_os = "visionos" ), link_name = "res_9_init" )] @@ -1581,6 +1584,7 @@ cfg_if! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", From 2b1ca4f9a78c50b5bca1a696eea0e2f151f3f954 Mon Sep 17 00:00:00 2001 From: Logan Magee Date: Mon, 25 Mar 2024 15:33:02 -0700 Subject: [PATCH 2/3] Add `SYS_lseek` and `SYS_mmap` for aarch64 Android Values are sourced from https://android.googlesource.com/platform/bionic/+/0339184/libc/kernel/uapi/asm-generic/unistd.h. (apply to `main`) [ resolve conflicts - Trevor ] (cherry picked from commit 0b08bd511e0879eb41828885c4d3a2249c4f5bb6) --- libc-test/semver/android-aarch64.txt | 2 ++ src/unix/linux_like/android/b64/aarch64/mod.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libc-test/semver/android-aarch64.txt b/libc-test/semver/android-aarch64.txt index 322f1bf69ff94..4dfedef857928 100644 --- a/libc-test/semver/android-aarch64.txt +++ b/libc-test/semver/android-aarch64.txt @@ -12,7 +12,9 @@ HWCAP2_SVESM4 PROT_BTI PROT_MTE SYS_arch_specific_syscall +SYS_lseek SYS_memfd_secret +SYS_mmap SYS_syscalls SYS_fcntl __system_property_wait diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index 6e5109e5a6e8c..718bf779bb908 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -192,6 +192,7 @@ pub const SYS_vhangup: ::c_long = 58; pub const SYS_pipe2: ::c_long = 59; pub const SYS_quotactl: ::c_long = 60; pub const SYS_getdents64: ::c_long = 61; +pub const SYS_lseek: ::c_long = 62; pub const SYS_read: ::c_long = 63; pub const SYS_write: ::c_long = 64; pub const SYS_readv: ::c_long = 65; @@ -348,6 +349,7 @@ pub const SYS_request_key: ::c_long = 218; pub const SYS_keyctl: ::c_long = 219; pub const SYS_clone: ::c_long = 220; pub const SYS_execve: ::c_long = 221; +pub const SYS_mmap: ::c_long = 222; pub const SYS_swapon: ::c_long = 224; pub const SYS_swapoff: ::c_long = 225; pub const SYS_mprotect: ::c_long = 226; From bf864e34322923980efad24b9b5b0d94a787a7b4 Mon Sep 17 00:00:00 2001 From: Ryan Zoeller Date: Wed, 27 Mar 2024 19:17:41 -0500 Subject: [PATCH 3/3] android: add FUTEX_LOCK_PI2 (apply to `main`) (cherry picked from commit fceb18ee4154d55063d1bfaaeef5c0fa3ed4b83b) --- libc-test/semver/android.txt | 1 + src/unix/linux_like/android/mod.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index c46c11d75cd9f..34455e48205b6 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -653,6 +653,7 @@ FUTEX_CMP_REQUEUE FUTEX_CMP_REQUEUE_PI FUTEX_FD FUTEX_LOCK_PI +FUTEX_LOCK_PI2 FUTEX_PRIVATE_FLAG FUTEX_REQUEUE FUTEX_TRYLOCK_PI diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index fa291a3694adb..234d8540de786 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -3017,6 +3017,7 @@ pub const FUTEX_WAIT_BITSET: ::c_int = 9; pub const FUTEX_WAKE_BITSET: ::c_int = 10; pub const FUTEX_WAIT_REQUEUE_PI: ::c_int = 11; pub const FUTEX_CMP_REQUEUE_PI: ::c_int = 12; +pub const FUTEX_LOCK_PI2: ::c_int = 13; pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; pub const FUTEX_CLOCK_REALTIME: ::c_int = 256;