Skip to content

Commit c1c20f6

Browse files
committed
Unix: Support more platforms with preadv and pwritev
1 parent eff958c commit c1c20f6

File tree

1 file changed

+16
-0
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+16
-0
lines changed

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

+16
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,16 @@ impl FileDesc {
167167
}
168168

169169
#[cfg(any(
170+
target_os = "aix",
171+
target_os = "dragonfly",
170172
target_os = "emscripten",
171173
target_os = "freebsd",
172174
target_os = "fuchsia",
173175
target_os = "hurd",
174176
target_os = "illumos",
175177
target_os = "linux",
176178
target_os = "netbsd",
179+
target_os = "openbsd",
177180
))]
178181
pub fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
179182
let ret = cvt(unsafe {
@@ -188,7 +191,9 @@ impl FileDesc {
188191
}
189192

190193
#[cfg(not(any(
194+
target_os = "aix",
191195
target_os = "android",
196+
target_os = "dragonfly",
192197
target_os = "emscripten",
193198
target_os = "freebsd",
194199
target_os = "fuchsia",
@@ -199,6 +204,8 @@ impl FileDesc {
199204
target_os = "linux",
200205
target_os = "macos",
201206
target_os = "netbsd",
207+
target_os = "openbsd",
208+
target_os = "watchos",
202209
)))]
203210
pub fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
204211
io::default_read_vectored(|b| self.read_at(b, offset), bufs)
@@ -239,6 +246,7 @@ impl FileDesc {
239246
target_os = "ios",
240247
target_os = "tvos",
241248
target_os = "macos",
249+
target_os = "watchos",
242250
))]
243251
pub fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
244252
super::weak::weak!(fn preadv64(libc::c_int, *const libc::iovec, libc::c_int, off64_t) -> isize);
@@ -318,13 +326,16 @@ impl FileDesc {
318326
}
319327

320328
#[cfg(any(
329+
target_os = "aix",
330+
target_os = "dragonfly",
321331
target_os = "emscripten",
322332
target_os = "freebsd",
323333
target_os = "fuchsia",
324334
target_os = "hurd",
325335
target_os = "illumos",
326336
target_os = "linux",
327337
target_os = "netbsd",
338+
target_os = "openbsd",
328339
))]
329340
pub fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> {
330341
let ret = cvt(unsafe {
@@ -339,7 +350,9 @@ impl FileDesc {
339350
}
340351

341352
#[cfg(not(any(
353+
target_os = "aix",
342354
target_os = "android",
355+
target_os = "dragonfly",
343356
target_os = "emscripten",
344357
target_os = "freebsd",
345358
target_os = "fuchsia",
@@ -350,6 +363,8 @@ impl FileDesc {
350363
target_os = "linux",
351364
target_os = "macos",
352365
target_os = "netbsd",
366+
target_os = "openbsd",
367+
target_os = "watchos",
353368
)))]
354369
pub fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> {
355370
io::default_write_vectored(|b| self.write_at(b, offset), bufs)
@@ -390,6 +405,7 @@ impl FileDesc {
390405
target_os = "ios",
391406
target_os = "tvos",
392407
target_os = "macos",
408+
target_os = "watchos",
393409
))]
394410
pub fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> {
395411
super::weak::weak!(fn pwritev64(libc::c_int, *const libc::iovec, libc::c_int, off64_t) -> isize);

0 commit comments

Comments
 (0)