Skip to content

Commit

Permalink
misc: get haiku working
Browse files Browse the repository at this point in the history
  • Loading branch information
Fancy2209 authored Dec 30, 2024
1 parent 970d880 commit 9d42b97
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions tokio/src/net/tcp/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ impl TcpSocket {
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku"
)))]
#[cfg_attr(
docsrs,
Expand All @@ -477,6 +478,7 @@ impl TcpSocket {
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku"
))))
)]
pub fn tos(&self) -> io::Result<u32> {
Expand All @@ -496,6 +498,7 @@ impl TcpSocket {
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku"
)))]
#[cfg_attr(
docsrs,
Expand All @@ -504,6 +507,7 @@ impl TcpSocket {
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku"
))))
)]
pub fn set_tos(&self, tos: u32) -> io::Result<()> {
Expand Down
4 changes: 4 additions & 0 deletions tokio/src/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,7 @@ impl UdpSocket {
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku"
)))]
#[cfg_attr(
docsrs,
Expand All @@ -1872,6 +1873,7 @@ impl UdpSocket {
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku"
))))
)]
pub fn tos(&self) -> io::Result<u32> {
Expand All @@ -1891,6 +1893,7 @@ impl UdpSocket {
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
target_os = "haiku"
)))]
#[cfg_attr(
docsrs,
Expand All @@ -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<()> {
Expand Down
13 changes: 10 additions & 3 deletions tokio/src/net/unix/ucred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -67,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};
Expand All @@ -77,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"))]
#[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<super::UCred> {
Expand Down
9 changes: 9 additions & 0 deletions tokio/src/signal/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ impl SignalKind {
Self(libc::SIGINT)
}

#[cfg(target_os = "haiku")]
/// Represents the `SIGPOLL` signal.
///
/// On POSIX 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::SIGPOLL)
}
#[cfg(not(target_os = "haiku"))]
/// Represents the `SIGIO` signal.
///
/// On Unix systems this signal is sent when I/O operations are possible
Expand Down

0 comments on commit 9d42b97

Please sign in to comment.