Skip to content

Commit

Permalink
net: add support for Redox OS (#5790)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdavidmackenzie committed Jun 13, 2023
1 parent b729091 commit 00af6ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tokio/Cargo.toml
Expand Up @@ -121,11 +121,11 @@ tracing = { version = "0.1.25", default-features = false, features = ["std"], op
backtrace = { version = "0.3.58" }

[target.'cfg(unix)'.dependencies]
libc = { version = "0.2.42", optional = true }
libc = { version = "0.2.145", optional = true }
signal-hook-registry = { version = "1.1.1", optional = true }

[target.'cfg(unix)'.dev-dependencies]
libc = { version = "0.2.42" }
libc = { version = "0.2.145" }
nix = { version = "0.26", default-features = false, features = ["fs", "socket"] }

[target.'cfg(windows)'.dependencies.windows-sys]
Expand Down
16 changes: 13 additions & 3 deletions tokio/src/net/unix/ucred.rs
Expand Up @@ -31,7 +31,12 @@ impl UCred {
}
}

#[cfg(any(target_os = "linux", target_os = "android", target_os = "openbsd"))]
#[cfg(any(
target_os = "linux",
target_os = "redox",
target_os = "android",
target_os = "openbsd"
))]
pub(crate) use self::impl_linux::get_peer_cred;

#[cfg(any(target_os = "netbsd"))]
Expand All @@ -49,7 +54,12 @@ pub(crate) use self::impl_solaris::get_peer_cred;
#[cfg(target_os = "aix")]
pub(crate) use self::impl_aix::get_peer_cred;

#[cfg(any(target_os = "linux", target_os = "android", target_os = "openbsd"))]
#[cfg(any(
target_os = "linux",
target_os = "redox",
target_os = "android",
target_os = "openbsd"
))]
pub(crate) mod impl_linux {
use crate::net::unix::{self, UnixStream};

Expand All @@ -58,7 +68,7 @@ pub(crate) mod impl_linux {

#[cfg(target_os = "openbsd")]
use libc::sockpeercred as ucred;
#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg(any(target_os = "linux", target_os = "redox", target_os = "android"))]
use libc::ucred;

pub(crate) fn get_peer_cred(sock: &UnixStream) -> io::Result<super::UCred> {
Expand Down

0 comments on commit 00af6ef

Please sign in to comment.