Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Haiku support #1807

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ jobs:
- x86_64-pc-windows-msvc
- x86_64-unknown-dragonfly
- x86_64-unknown-freebsd
- x86_64-unknown-haiku
- x86_64-unknown-hermit
- x86_64-unknown-illumos
- x86_64-unknown-linux-gnu
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,9 @@ This uses the Windows AFD system to access socket readiness events.

### Unsupported

* Haiku, see [issue #1472]
* Solaris, see [issue #1152]
* Wine, see [issue #1444]

[issue #1472]: https://github.com/tokio-rs/mio/issues/1472
[issue #1152]: https://github.com/tokio-rs/mio/issues/1152
[issue #1444]: https://github.com/tokio-rs/mio/issues/1444

Expand Down
3 changes: 3 additions & 0 deletions src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
not(mio_unsupported_force_poll_poll),
not(any(
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand Down Expand Up @@ -438,6 +439,7 @@ impl Poll {
not(mio_unsupported_force_poll_poll),
not(any(
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand Down Expand Up @@ -735,6 +737,7 @@ impl fmt::Debug for Registry {
not(mio_unsupported_force_poll_poll),
not(any(
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand Down
7 changes: 4 additions & 3 deletions src/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cfg_os_poll! {

cfg_io_source! {
// Both `kqueue` and `epoll` don't need to hold any user space state.
#[cfg(not(any(mio_unsupported_force_poll_poll, target_os = "espidf", target_os = "hermit", target_os = "nto", target_os = "solaris", target_os = "vita")))]
#[cfg(not(any(mio_unsupported_force_poll_poll, target_os = "espidf", target_os = "haiku", target_os = "hermit", target_os = "nto", target_os = "solaris", target_os = "vita")))]
mod stateless_io_source {
use std::io;
use std::os::fd::RawFd;
Expand Down Expand Up @@ -88,10 +88,10 @@ cfg_os_poll! {
}
}

#[cfg(not(any(mio_unsupported_force_poll_poll, target_os = "espidf", target_os = "hermit", target_os = "nto", target_os = "solaris", target_os = "vita")))]
#[cfg(not(any(mio_unsupported_force_poll_poll, target_os = "espidf", target_os = "haiku", target_os = "hermit", target_os = "nto", target_os = "solaris", target_os = "vita")))]
pub(crate) use self::stateless_io_source::IoSourceState;

#[cfg(any(mio_unsupported_force_poll_poll, target_os = "espidf", target_os = "hermit", target_os = "nto", target_os = "solaris", target_os = "vita"))]
#[cfg(any(mio_unsupported_force_poll_poll, target_os = "espidf", target_os = "haiku", target_os = "hermit", target_os = "nto", target_os = "solaris", target_os = "vita"))]
pub(crate) use self::selector::IoSourceState;
}

Expand All @@ -102,6 +102,7 @@ cfg_os_poll! {
mio_unsupported_force_waker_pipe,
target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "nto",
Expand Down
6 changes: 5 additions & 1 deletion src/sys/unix/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,17 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_
sin_family: libc::AF_INET as libc::sa_family_t,
sin_port: addr.port().to_be(),
sin_addr,
#[cfg(not(target_os = "vita"))]
#[cfg(not(any(target_os = "haiku", target_os = "vita")))]
sin_zero: [0; 8],
#[cfg(target_os = "haiku")]
sin_zero: [0; 24],
#[cfg(target_os = "vita")]
sin_zero: [0; 6],
#[cfg(any(
target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand Down Expand Up @@ -147,6 +150,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, libc::socklen_
target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand Down
2 changes: 2 additions & 0 deletions src/sys/unix/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub(crate) fn new_raw() -> io::Result<[RawFd; 2]> {

#[cfg(any(
target_os = "aix",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "tvos",
Expand Down Expand Up @@ -61,6 +62,7 @@ pub(crate) fn new_raw() -> io::Result<[RawFd; 2]> {
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "linux",
Expand Down
3 changes: 3 additions & 0 deletions src/sys/unix/selector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub(crate) use self::epoll::{event, Event, Events, Selector};
#[cfg(any(
mio_unsupported_force_poll_poll,
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand All @@ -33,6 +34,7 @@ mod poll;
#[cfg(any(
mio_unsupported_force_poll_poll,
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand All @@ -44,6 +46,7 @@ cfg_io_source! {
#[cfg(any(
mio_unsupported_force_poll_poll,
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand Down
1 change: 1 addition & 0 deletions src/sys/unix/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream,
// set `CLOEXEC`.
#[cfg(any(
target_os = "aix",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "redox",
Expand Down
2 changes: 2 additions & 0 deletions src/sys/unix/uds/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So

#[cfg(not(any(
target_os = "aix",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand Down Expand Up @@ -62,6 +63,7 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So

#[cfg(any(
target_os = "aix",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand Down
2 changes: 2 additions & 0 deletions src/sys/unix/uds/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ where
{
#[cfg(not(any(
target_os = "aix",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "nto",
Expand All @@ -110,6 +111,7 @@ where
// there is an error, the file descriptors are closed.
#[cfg(any(
target_os = "aix",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "nto",
Expand Down
7 changes: 7 additions & 0 deletions src/sys/unix/waker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
)),
not(any(
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand Down Expand Up @@ -74,6 +75,7 @@ mod fdbased {
)),
not(any(
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand Down Expand Up @@ -239,6 +241,7 @@ pub use self::kqueue::Waker;
mio_unsupported_force_waker_pipe,
target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "nto",
Expand Down Expand Up @@ -294,6 +297,7 @@ mod pipe {
#[cfg(any(
mio_unsupported_force_poll_poll,
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
target_os = "solaris",
target_os = "vita",
Expand Down Expand Up @@ -335,6 +339,7 @@ mod pipe {
target_os = "redox",
)
),
target_os = "haiku",
target_os = "nto",
target_os = "solaris",
target_os = "vita",
Expand All @@ -344,6 +349,7 @@ pub(crate) use self::pipe::WakerInternal;
#[cfg(any(
mio_unsupported_force_poll_poll,
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand Down Expand Up @@ -377,6 +383,7 @@ mod poll {
#[cfg(any(
mio_unsupported_force_poll_poll,
target_os = "espidf",
target_os = "haiku",
target_os = "hermit",
target_os = "nto",
target_os = "solaris",
Expand Down