From 18018822d3957efebfb992bac5ba9a1c79a8b9de Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:52:18 +0000 Subject: [PATCH 01/11] Fix Haiku --- tokio/src/net/tcp/socket.rs | 10 ++++++++-- tokio/src/net/udp.rs | 4 ++++ tokio/src/net/unix/ucred.rs | 5 +++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tokio/src/net/tcp/socket.rs b/tokio/src/net/tcp/socket.rs index 33b71485473..19eb6714992 100644 --- a/tokio/src/net/tcp/socket.rs +++ b/tokio/src/net/tcp/socket.rs @@ -167,7 +167,8 @@ impl TcpSocket { target_os = "illumos", target_os = "linux", target_os = "netbsd", - target_os = "openbsd" + target_os = "openbsd", + target_os = "haiku" ))] let ty = ty.nonblocking(); let inner = socket2::Socket::new(domain, ty, Some(socket2::Protocol::TCP))?; @@ -179,7 +180,8 @@ impl TcpSocket { target_os = "illumos", target_os = "linux", target_os = "netbsd", - target_os = "openbsd" + target_os = "openbsd", + target_os = "haiku" )))] inner.set_nonblocking(true)?; Ok(TcpSocket { inner }) @@ -469,6 +471,7 @@ impl TcpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", + target_os = "haiku", )))] #[cfg_attr( docsrs, @@ -477,6 +480,7 @@ impl TcpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", + target_os = "haiku", )))) )] pub fn tos(&self) -> io::Result { @@ -496,6 +500,7 @@ impl TcpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", + target_os = "haiku", )))] #[cfg_attr( docsrs, @@ -504,6 +509,7 @@ impl TcpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", + target_os = "haiku", )))) )] pub fn set_tos(&self, tos: u32) -> io::Result<()> { diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index a34f7b9225b..2c1911e2765 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -1864,6 +1864,7 @@ impl UdpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", + target_os = "haiku", )))] #[cfg_attr( docsrs, @@ -1872,6 +1873,7 @@ impl UdpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", + target_os = "haiku", )))) )] pub fn tos(&self) -> io::Result { @@ -1891,6 +1893,7 @@ impl UdpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", + target_os = "haiku", )))] #[cfg_attr( docsrs, @@ -1899,6 +1902,7 @@ impl UdpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", + target_os = "haiku", )))) )] pub fn set_tos(&self, tos: u32) -> io::Result<()> { diff --git a/tokio/src/net/unix/ucred.rs b/tokio/src/net/unix/ucred.rs index bcd1c755f6a..e79ca3521d6 100644 --- a/tokio/src/net/unix/ucred.rs +++ b/tokio/src/net/unix/ucred.rs @@ -35,7 +35,8 @@ impl UCred { target_os = "linux", target_os = "redox", target_os = "android", - target_os = "openbsd" + target_os = "openbsd", + target_os = "haiku" ))] pub(crate) use self::impl_linux::get_peer_cred; @@ -307,7 +308,7 @@ pub(crate) mod impl_aix { } } -#[cfg(any(target_os = "espidf", target_os = "vita"))] +#[cfg(any(target_os = "espidf", target_os = "vita", target_os = "haiku"))] pub(crate) mod impl_noproc { use crate::net::unix::UnixStream; use std::io; From bcb3e587e1292cd8f04ffaed1a7eefbf4cbab5be Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:56:34 +0000 Subject: [PATCH 02/11] Fix accidental change --- tokio/src/net/unix/ucred.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/net/unix/ucred.rs b/tokio/src/net/unix/ucred.rs index e79ca3521d6..85ac83ed19b 100644 --- a/tokio/src/net/unix/ucred.rs +++ b/tokio/src/net/unix/ucred.rs @@ -308,7 +308,7 @@ pub(crate) mod impl_aix { } } -#[cfg(any(target_os = "espidf", target_os = "vita", target_os = "haiku"))] +#[cfg(any(target_os = "espidf", target_os = "vita"))] pub(crate) mod impl_noproc { use crate::net::unix::UnixStream; use std::io; From e8c825c3be804f08e25ceb998da522b05000c613 Mon Sep 17 00:00:00 2001 From: Paulo Medeiros Date: Tue, 17 Dec 2024 16:06:01 -0100 Subject: [PATCH 03/11] Add missing os check --- tokio/src/net/unix/ucred.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokio/src/net/unix/ucred.rs b/tokio/src/net/unix/ucred.rs index 85ac83ed19b..fe5c0cd73fb 100644 --- a/tokio/src/net/unix/ucred.rs +++ b/tokio/src/net/unix/ucred.rs @@ -68,7 +68,8 @@ pub(crate) use self::impl_noproc::get_peer_cred; target_os = "linux", target_os = "redox", target_os = "android", - target_os = "openbsd" + target_os = "openbsd", + target_os = "haiku" ))] pub(crate) mod impl_linux { use crate::net::unix::{self, UnixStream}; From 819795e68586136d4444f0125f9c0fca512f3691 Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:31:54 -0100 Subject: [PATCH 04/11] Update ucred.rs --- tokio/src/net/unix/ucred.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/net/unix/ucred.rs b/tokio/src/net/unix/ucred.rs index fe5c0cd73fb..e630afe0011 100644 --- a/tokio/src/net/unix/ucred.rs +++ b/tokio/src/net/unix/ucred.rs @@ -79,7 +79,7 @@ pub(crate) mod impl_linux { #[cfg(target_os = "openbsd")] use libc::sockpeercred as ucred; - #[cfg(any(target_os = "linux", target_os = "redox", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "redox", target_os = "android", target_os = "haiku"))] use libc::ucred; pub(crate) fn get_peer_cred(sock: &UnixStream) -> io::Result { From c44120658e0dbd3cf897b2dc944a38fa2476e108 Mon Sep 17 00:00:00 2001 From: Paulo Medeiros Date: Tue, 17 Dec 2024 18:09:10 -0100 Subject: [PATCH 05/11] Use SIGPOLL instead of SIGIO on Haiku --- tokio/src/signal/unix.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tokio/src/signal/unix.rs b/tokio/src/signal/unix.rs index 31e2905c02d..a0b69fb2d21 100644 --- a/tokio/src/signal/unix.rs +++ b/tokio/src/signal/unix.rs @@ -152,7 +152,10 @@ impl SignalKind { /// On Unix systems this signal is sent when I/O operations are possible /// on some file descriptor. By default, this signal is ignored. pub const fn io() -> Self { + #[cfg(not(target_os = "haiku"))] Self(libc::SIGIO) + #[cfg(target_os = "haiku")] + Self(libc::SIGPOLL) } /// Represents the `SIGPIPE` signal. From 94309cd1a1fdc737a53d889278e0d8f9fb9b3491 Mon Sep 17 00:00:00 2001 From: Paulo Medeiros Date: Tue, 17 Dec 2024 18:11:13 -0100 Subject: [PATCH 06/11] Add missing semicolon --- tokio/src/signal/unix.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/signal/unix.rs b/tokio/src/signal/unix.rs index a0b69fb2d21..b807930f5b8 100644 --- a/tokio/src/signal/unix.rs +++ b/tokio/src/signal/unix.rs @@ -153,9 +153,9 @@ impl SignalKind { /// on some file descriptor. By default, this signal is ignored. pub const fn io() -> Self { #[cfg(not(target_os = "haiku"))] - Self(libc::SIGIO) + Self(libc::SIGIO); #[cfg(target_os = "haiku")] - Self(libc::SIGPOLL) + Self(libc::SIGPOLL); } /// Represents the `SIGPIPE` signal. From 99208399cdefd4b4bb882b79c2befa5ddc193264 Mon Sep 17 00:00:00 2001 From: Paulo Medeiros Date: Tue, 17 Dec 2024 18:15:37 -0100 Subject: [PATCH 07/11] Fix Sigpoll --- tokio/src/signal/unix.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tokio/src/signal/unix.rs b/tokio/src/signal/unix.rs index b807930f5b8..1b5c0ca1043 100644 --- a/tokio/src/signal/unix.rs +++ b/tokio/src/signal/unix.rs @@ -151,11 +151,13 @@ impl SignalKind { /// /// On Unix systems this signal is sent when I/O operations are possible /// on some file descriptor. By default, this signal is ignored. + #[cfg(target_os = "haiku")] pub const fn io() -> Self { - #[cfg(not(target_os = "haiku"))] - Self(libc::SIGIO); - #[cfg(target_os = "haiku")] - Self(libc::SIGPOLL); + Self(libc::SIGPOLL) + } + #[cfg(not(target_os = "haiku"))] + pub const fn io() -> Self { + Self(libc::SIGIO) } /// Represents the `SIGPIPE` signal. From b1055090195e9c4fa8ca7e4f93f4efe52f6cfadb Mon Sep 17 00:00:00 2001 From: Paulo Medeiros Date: Tue, 17 Dec 2024 18:35:49 -0100 Subject: [PATCH 08/11] Fix --- tokio/src/net/tcp/socket.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tokio/src/net/tcp/socket.rs b/tokio/src/net/tcp/socket.rs index 19eb6714992..1d2be78faf3 100644 --- a/tokio/src/net/tcp/socket.rs +++ b/tokio/src/net/tcp/socket.rs @@ -168,7 +168,6 @@ impl TcpSocket { target_os = "linux", target_os = "netbsd", target_os = "openbsd", - target_os = "haiku" ))] let ty = ty.nonblocking(); let inner = socket2::Socket::new(domain, ty, Some(socket2::Protocol::TCP))?; @@ -181,7 +180,6 @@ impl TcpSocket { target_os = "linux", target_os = "netbsd", target_os = "openbsd", - target_os = "haiku" )))] inner.set_nonblocking(true)?; Ok(TcpSocket { inner }) From 18831233046869164eeb0d3b7ac48690952ab7a7 Mon Sep 17 00:00:00 2001 From: Paulo Medeiros Date: Tue, 17 Dec 2024 19:21:36 -0100 Subject: [PATCH 09/11] Fix FMT and Lints --- tokio/src/net/unix/ucred.rs | 9 +++++++-- tokio/src/signal/unix.rs | 10 +++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tokio/src/net/unix/ucred.rs b/tokio/src/net/unix/ucred.rs index e630afe0011..74e596bc9b6 100644 --- a/tokio/src/net/unix/ucred.rs +++ b/tokio/src/net/unix/ucred.rs @@ -35,7 +35,7 @@ impl UCred { target_os = "linux", target_os = "redox", target_os = "android", - target_os = "openbsd", + target_os = "openbsd", target_os = "haiku" ))] pub(crate) use self::impl_linux::get_peer_cred; @@ -79,7 +79,12 @@ pub(crate) mod impl_linux { #[cfg(target_os = "openbsd")] use libc::sockpeercred as ucred; - #[cfg(any(target_os = "linux", target_os = "redox", target_os = "android", target_os = "haiku"))] + #[cfg(any( + target_os = "linux", + target_os = "redox", + target_os = "android", + target_os = "haiku" + ))] use libc::ucred; pub(crate) fn get_peer_cred(sock: &UnixStream) -> io::Result { diff --git a/tokio/src/signal/unix.rs b/tokio/src/signal/unix.rs index 1b5c0ca1043..e70863b54b7 100644 --- a/tokio/src/signal/unix.rs +++ b/tokio/src/signal/unix.rs @@ -147,15 +147,19 @@ impl SignalKind { Self(libc::SIGINT) } - /// Represents the `SIGIO` signal. + #[cfg(target_os = "haiku")] + /// Represents the `SIGPOLL` signal. /// - /// On Unix systems this signal is sent when I/O operations are possible + /// On POSIX systems this signal is sent when I/O operations are possible /// on some file descriptor. By default, this signal is ignored. - #[cfg(target_os = "haiku")] pub const fn io() -> Self { Self(libc::SIGPOLL) } #[cfg(not(target_os = "haiku"))] + /// Represents the `SIGIO` signal. + /// + /// On Unix systems this signal is sent when I/O operations are possible + /// on some file descriptor. By default, this signal is ignored. pub const fn io() -> Self { Self(libc::SIGIO) } From eef14eb5f46f785d64b0b15683b75a8769d6fd6c Mon Sep 17 00:00:00 2001 From: Paulo Medeiros Date: Tue, 17 Dec 2024 19:38:31 -0100 Subject: [PATCH 10/11] Add x86_64-unknown-haiku to cross-check-tier3 Ci --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3718cfa1c55..407df8a4a54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -467,6 +467,7 @@ jobs: strategy: matrix: target: + - name: x86_64-unknown-haiku - name: armv7-sony-vita-newlibeabihf exclude_features: "process,signal,rt-process-signal,full" steps: From ba1b193684ef191673f4de7b5c4e1bc9781890fe Mon Sep 17 00:00:00 2001 From: Fancy2209 <64917206+Fancy2209@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:43:13 -0100 Subject: [PATCH 11/11] Fix uneeded commas --- tokio/src/net/tcp/socket.rs | 12 ++++++------ tokio/src/net/udp.rs | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tokio/src/net/tcp/socket.rs b/tokio/src/net/tcp/socket.rs index 1d2be78faf3..762546ee309 100644 --- a/tokio/src/net/tcp/socket.rs +++ b/tokio/src/net/tcp/socket.rs @@ -167,7 +167,7 @@ impl TcpSocket { target_os = "illumos", target_os = "linux", target_os = "netbsd", - target_os = "openbsd", + target_os = "openbsd" ))] let ty = ty.nonblocking(); let inner = socket2::Socket::new(domain, ty, Some(socket2::Protocol::TCP))?; @@ -179,7 +179,7 @@ impl TcpSocket { target_os = "illumos", target_os = "linux", target_os = "netbsd", - target_os = "openbsd", + target_os = "openbsd" )))] inner.set_nonblocking(true)?; Ok(TcpSocket { inner }) @@ -469,7 +469,7 @@ impl TcpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", - target_os = "haiku", + target_os = "haiku" )))] #[cfg_attr( docsrs, @@ -478,7 +478,7 @@ impl TcpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", - target_os = "haiku", + target_os = "haiku" )))) )] pub fn tos(&self) -> io::Result { @@ -498,7 +498,7 @@ impl TcpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", - target_os = "haiku", + target_os = "haiku" )))] #[cfg_attr( docsrs, @@ -507,7 +507,7 @@ impl TcpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", - target_os = "haiku", + target_os = "haiku" )))) )] pub fn set_tos(&self, tos: u32) -> io::Result<()> { diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index 2c1911e2765..58bf566a728 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -1864,7 +1864,7 @@ impl UdpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", - target_os = "haiku", + target_os = "haiku" )))] #[cfg_attr( docsrs, @@ -1873,7 +1873,7 @@ impl UdpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", - target_os = "haiku", + target_os = "haiku" )))) )] pub fn tos(&self) -> io::Result { @@ -1893,7 +1893,7 @@ impl UdpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", - target_os = "haiku", + target_os = "haiku" )))] #[cfg_attr( docsrs, @@ -1902,7 +1902,7 @@ impl UdpSocket { target_os = "redox", target_os = "solaris", target_os = "illumos", - target_os = "haiku", + target_os = "haiku" )))) )] pub fn set_tos(&self, tos: u32) -> io::Result<()> {