Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4bdf171

Browse files
Rollup merge of rust-lang#122880 - a1phyr:preadv_more_platform, r=workingjubilee
Unix: Support more platforms with `preadv` and `pwritev` - `aix`, `dragonfly` and `openbsd` with direct call - `watchos` with weak linkage cc rust-lang#89517
2 parents a2122dc + ff6d9f7 commit 4bdf171

File tree

1 file changed

+22
-6
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+22
-6
lines changed

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

Lines changed: 22 additions & 6 deletions
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", // DragonFly 1.5
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", // OpenBSD 2.7
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)
@@ -236,9 +243,10 @@ impl FileDesc {
236243
// no `syscall` possible in these platform.
237244
#[cfg(any(
238245
all(target_os = "android", target_pointer_width = "32"),
239-
target_os = "ios",
240-
target_os = "tvos",
241-
target_os = "macos",
246+
target_os = "ios", // ios 14.0
247+
target_os = "tvos", // tvos 14.0
248+
target_os = "macos", // macos 11.0
249+
target_os = "watchos", // watchos 7.0
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", // DragonFly 1.5
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", // OpenBSD 2.7
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)
@@ -387,9 +402,10 @@ impl FileDesc {
387402
// no `syscall` possible in these platform.
388403
#[cfg(any(
389404
all(target_os = "android", target_pointer_width = "32"),
390-
target_os = "ios",
391-
target_os = "tvos",
392-
target_os = "macos",
405+
target_os = "ios", // ios 14.0
406+
target_os = "tvos", // tvos 14.0
407+
target_os = "macos", // macos 11.0
408+
target_os = "watchos", // watchos 7.0
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)

AltStyle によって変換されたページ (->オリジナル) /