From c388162d4baf42689250cbe85b24b82868baa81d Mon Sep 17 00:00:00 2001 From: Akhil Thankachan Thomas Date: Tue, 28 Nov 2023 10:16:55 +0530 Subject: [PATCH 1/4] set uid and gid as i32 for qnx process --- tokio/src/process/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 0fad67cd01a..903be7dc798 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -672,6 +672,9 @@ impl Command { #[cfg(unix)] #[cfg_attr(docsrs, doc(cfg(unix)))] pub fn uid(&mut self, id: u32) -> &mut Command { + #[cfg(target_os = "nto")] + self.std.uid(id as i32); + #[cfg(not(target_os = "nto"))] self.std.uid(id); self } @@ -681,6 +684,9 @@ impl Command { #[cfg(unix)] #[cfg_attr(docsrs, doc(cfg(unix)))] pub fn gid(&mut self, id: u32) -> &mut Command { + #[cfg(target_os = "nto")] + self.std.gid(id as i32); + #[cfg(not(target_os = "nto"))] self.std.gid(id); self } From dbd07612d26c2522ff0436a357af9e2be652b2a5 Mon Sep 17 00:00:00 2001 From: Akhil Thankachan Thomas Date: Tue, 28 Nov 2023 10:18:20 +0530 Subject: [PATCH 2/4] add qnx target support for impl_bsd module --- tokio/src/net/unix/ucred.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/net/unix/ucred.rs b/tokio/src/net/unix/ucred.rs index 3390819160a..f6e889f6c79 100644 --- a/tokio/src/net/unix/ucred.rs +++ b/tokio/src/net/unix/ucred.rs @@ -42,7 +42,7 @@ pub(crate) use self::impl_linux::get_peer_cred; #[cfg(target_os = "netbsd")] pub(crate) use self::impl_netbsd::get_peer_cred; -#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] +#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "nto"))] pub(crate) use self::impl_bsd::get_peer_cred; #[cfg(any( @@ -162,7 +162,7 @@ pub(crate) mod impl_netbsd { } } -#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] +#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "nto"))] pub(crate) mod impl_bsd { use crate::net::unix::{self, UnixStream}; From 95d261588bd58af772e7b5c8e6c8172c8e902e46 Mon Sep 17 00:00:00 2001 From: Akhil T Thomas Date: Tue, 7 May 2024 23:53:18 +0200 Subject: [PATCH 3/4] use netbsd for ucred on qnx --- tokio/src/net/unix/ucred.rs | 8 ++++---- tokio/src/process/mod.rs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tokio/src/net/unix/ucred.rs b/tokio/src/net/unix/ucred.rs index f6e889f6c79..bcd1c755f6a 100644 --- a/tokio/src/net/unix/ucred.rs +++ b/tokio/src/net/unix/ucred.rs @@ -39,10 +39,10 @@ impl UCred { ))] pub(crate) use self::impl_linux::get_peer_cred; -#[cfg(target_os = "netbsd")] +#[cfg(any(target_os = "netbsd", target_os = "nto"))] pub(crate) use self::impl_netbsd::get_peer_cred; -#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "nto"))] +#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] pub(crate) use self::impl_bsd::get_peer_cred; #[cfg(any( @@ -120,7 +120,7 @@ pub(crate) mod impl_linux { } } -#[cfg(target_os = "netbsd")] +#[cfg(any(target_os = "netbsd", target_os = "nto"))] pub(crate) mod impl_netbsd { use crate::net::unix::{self, UnixStream}; @@ -162,7 +162,7 @@ pub(crate) mod impl_netbsd { } } -#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "nto"))] +#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] pub(crate) mod impl_bsd { use crate::net::unix::{self, UnixStream}; diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 903be7dc798..093e870dd9e 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -673,8 +673,7 @@ impl Command { #[cfg_attr(docsrs, doc(cfg(unix)))] pub fn uid(&mut self, id: u32) -> &mut Command { #[cfg(target_os = "nto")] - self.std.uid(id as i32); - #[cfg(not(target_os = "nto"))] + let id = id as i32; self.std.uid(id); self } From f4adc34215c7fc625c1c54004b78e450829d69c0 Mon Sep 17 00:00:00 2001 From: AkhilTThomas <44939988+AkhilTThomas@users.noreply.github.com> Date: Mon, 13 May 2024 23:17:04 +0200 Subject: [PATCH 4/4] Update tokio/src/process/mod.rs Co-authored-by: Alice Ryhl --- tokio/src/process/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 093e870dd9e..fc661d89c1f 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -684,8 +684,7 @@ impl Command { #[cfg_attr(docsrs, doc(cfg(unix)))] pub fn gid(&mut self, id: u32) -> &mut Command { #[cfg(target_os = "nto")] - self.std.gid(id as i32); - #[cfg(not(target_os = "nto"))] + let id = id as i32; self.std.gid(id); self }