Skip to content

Commit 27e9f74

Browse files
committed
Fix watchOS and visionOS for pread64 and pwrite64 calls
1 parent 38104f3 commit 27e9f74

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

library/std/src/sys/pal/unix/fd.rs

+4
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ impl FileDesc {
208208
target_os = "netbsd",
209209
target_os = "openbsd",
210210
target_os = "watchos",
211+
target_os = "visionos",
211212
)))]
212213
pub fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
213214
io::default_read_vectored(|b| self.read_at(b, offset), bufs)
@@ -249,6 +250,7 @@ impl FileDesc {
249250
target_os = "tvos", // tvos 14.0
250251
target_os = "macos", // macos 11.0
251252
target_os = "watchos", // watchos 7.0
253+
target_os = "visionos", // visionos 1.0
252254
))]
253255
pub fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
254256
super::weak::weak!(fn preadv64(libc::c_int, *const libc::iovec, libc::c_int, off64_t) -> isize);
@@ -367,6 +369,7 @@ impl FileDesc {
367369
target_os = "netbsd",
368370
target_os = "openbsd",
369371
target_os = "watchos",
372+
target_os = "visionos",
370373
)))]
371374
pub fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> {
372375
io::default_write_vectored(|b| self.write_at(b, offset), bufs)
@@ -408,6 +411,7 @@ impl FileDesc {
408411
target_os = "tvos", // tvos 14.0
409412
target_os = "macos", // macos 11.0
410413
target_os = "watchos", // watchos 7.0
414+
target_os = "visionos", // visionos 1.0
411415
))]
412416
pub fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> {
413417
super::weak::weak!(fn pwritev64(libc::c_int, *const libc::iovec, libc::c_int, off64_t) -> isize);

library/std/src/sys/pal/unix/weak.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ use crate::ptr;
2828
use crate::sync::atomic::{self, AtomicPtr, Ordering};
2929

3030
// We can use true weak linkage on ELF targets.
31-
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "tvos")))]
31+
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos",
32+
target_os = "visionos")))]
3233
pub(crate) macro weak {
3334
(fn $name:ident($($t:ty),*) -> $ret:ty) => (
3435
let ref $name: ExternWeak<unsafe extern "C" fn($($t),*) -> $ret> = {
@@ -43,7 +44,8 @@ pub(crate) macro weak {
4344
}
4445

4546
// On non-ELF targets, use the dlsym approximation of weak linkage.
46-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
47+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos",
48+
target_os = "visionos"))]
4749
pub(crate) use self::dlsym as weak;
4850

4951
pub(crate) struct ExternWeak<F: Copy> {

0 commit comments

Comments
 (0)