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 redox-os to conditional compilation #[cfg] for ucred usage alongside other linux-like OS #5790

Merged
merged 3 commits into from Jun 13, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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