summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/io/pipe.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/io/pipe.rs')
-rw-r--r--vendor/rustix/src/io/pipe.rs30
1 files changed, 16 insertions, 14 deletions
diff --git a/vendor/rustix/src/io/pipe.rs b/vendor/rustix/src/io/pipe.rs
index 2b8af6a84..9d4b081c5 100644
--- a/vendor/rustix/src/io/pipe.rs
+++ b/vendor/rustix/src/io/pipe.rs
@@ -1,3 +1,9 @@
+//! `pipe` and related APIs.
+//!
+//! # Safety
+//!
+//! `vmsplice` is an unsafe function.
+
#![allow(unsafe_code)]
use crate::fd::OwnedFd;
@@ -5,7 +11,7 @@ use crate::{backend, io};
#[cfg(any(target_os = "android", target_os = "linux"))]
use backend::fd::AsFd;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub use backend::io::types::PipeFlags;
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -20,11 +26,10 @@ pub use backend::io::types::{IoSliceRaw, SpliceFlags};
/// [Linux]: https://man7.org/linux/man-pages/man7/pipe.7.html
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html
#[cfg(not(any(
+ solarish,
windows,
target_os = "haiku",
- target_os = "illumos",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const PIPE_BUF: usize = backend::io::types::PIPE_BUF;
@@ -54,22 +59,18 @@ pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/pipe2.2.html
-#[cfg(not(any(
- target_os = "aix",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos"
-)))]
+#[cfg(not(any(apple, target_os = "aix", target_os = "haiku")))]
#[inline]
#[doc(alias = "pipe2")]
pub fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
backend::io::syscalls::pipe_with(flags)
}
-/// `splice(fd_in, off_in, fd_out, off_out, len, flags)`—Transfer data between a file and a pipe.
+/// `splice(fd_in, off_in, fd_out, off_out, len, flags)`—Transfer data between
+/// a file and a pipe.
///
-/// This function transfers up to `len` bytes of data from the file descriptor `fd_in`
-/// to the file descriptor `fd_out`, where one of the file descriptors
+/// This function transfers up to `len` bytes of data from the file descriptor
+/// `fd_in` to the file descriptor `fd_out`, where one of the file descriptors
/// must refer to a pipe.
///
/// `off_*` must be `None` if the corresponding fd refers to a pipe.
@@ -107,8 +108,9 @@ pub fn splice<FdIn: AsFd, FdOut: AsFd>(
///
/// # Safety
///
-/// If the memory must not be mutated (such as when `bufs` were originally immutable slices),
-/// it is up to the caller to ensure that the write end of the pipe is placed in `fd`.
+/// If the memory must not be mutated (such as when `bufs` were originally
+/// immutable slices), it is up to the caller to ensure that the write end of
+/// the pipe is placed in `fd`.
///
/// Additionally if `SpliceFlags::GIFT` is set, the caller must also ensure
/// that the contents of `bufs` in never modified following the call,