Skip to content

Commit

Permalink
Hermit doesn't support pipe(2)
Browse files Browse the repository at this point in the history
Make that clear in the code.
  • Loading branch information
Thomasdezeeuw committed Jun 24, 2024
1 parent 1133ed0 commit 1ce1545
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 35 deletions.
54 changes: 29 additions & 25 deletions src/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,33 +116,37 @@ cfg_os_poll! {
pub(crate) mod uds;
}

#[cfg(any(
// For the public `pipe` module, must match `cfg_os_ext` macro.
all(feature = "os-ext", not(target_os = "hermit")),
// For the `Waker` type based on a pipe.
mio_unsupported_force_waker_pipe,
all(
// `kqueue(2)` based waker doesn't work with `poll(2)`.
mio_unsupported_force_poll_poll,
any(
target_os = "freebsd",
target_os = "ios",
target_os = "macos",
target_os = "tvos",
target_os = "visionos",
target_os = "watchos",
#[cfg(all(
any(
// For the public `pipe` module, must match `cfg_os_ext` macro.
feature = "os-ext",
// For the `Waker` type based on a pipe.
mio_unsupported_force_waker_pipe,
all(
// `kqueue(2)` based waker doesn't work with `poll(2)`.
mio_unsupported_force_poll_poll,
any(
target_os = "freebsd",
target_os = "ios",
target_os = "macos",
target_os = "tvos",
target_os = "visionos",
target_os = "watchos",
),
),
// NOTE: also add to the list list for the `pipe` module below.
target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
target_os = "netbsd",
target_os = "nto",
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
target_os = "vita",
),
// NOTE: also add to the list list for the `pipe` module below.
target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
target_os = "netbsd",
target_os = "nto",
target_os = "openbsd",
target_os = "redox",
target_os = "solaris",
target_os = "vita",
// Hermit doesn't support pipes.
not(target_os = "hermit"),
))]
pub(crate) mod pipe;
}
Expand Down
10 changes: 0 additions & 10 deletions src/sys/unix/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
//! See the [`new`] function for documentation.

use std::io;
#[cfg(not(target_os = "hermit"))]
use std::os::fd::RawFd;
// TODO: once <https://github.com/rust-lang/rust/issues/126198> is fixed this
// can use `std::os::fd` and be merged with the above.
#[cfg(target_os = "hermit")]
use std::os::hermit::io::RawFd;

pub(crate) fn new_raw() -> io::Result<[RawFd; 2]> {
let mut fds: [RawFd; 2] = [-1, -1];
Expand Down Expand Up @@ -69,12 +64,7 @@ pub(crate) fn new_raw() -> io::Result<[RawFd; 2]> {
cfg_os_ext! {
use std::fs::File;
use std::io::{IoSlice, IoSliceMut, Read, Write};
#[cfg(not(target_os = "hermit"))]
use std::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd};
// TODO: once <https://github.com/rust-lang/rust/issues/126198> is fixed this
// can use `std::os::fd` and be merged with the above.
#[cfg(target_os = "hermit")]
use std::os::hermit::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd};
use std::process::{ChildStderr, ChildStdin, ChildStdout};

use crate::io_source::IoSource;
Expand Down

0 comments on commit 1ce1545

Please sign in to comment.