summaryrefslogtreecommitdiffstats
path: root/library/std/src/os/unix/process.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/os/unix/process.rs')
-rw-r--r--library/std/src/os/unix/process.rs26
1 files changed, 17 insertions, 9 deletions
diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs
index 09b2bfe39..729c63d18 100644
--- a/library/std/src/os/unix/process.rs
+++ b/library/std/src/os/unix/process.rs
@@ -12,15 +12,23 @@ use crate::sealed::Sealed;
use crate::sys;
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
-#[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))]
-type UserId = u32;
-#[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))]
-type GroupId = u32;
-
-#[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon"))]
-type UserId = u16;
-#[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon"))]
-type GroupId = u16;
+use cfg_if::cfg_if;
+
+cfg_if! {
+ if #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon"))] {
+ type UserId = u16;
+ type GroupId = u16;
+ } else if #[cfg(target_os = "nto")] {
+ // Both IDs are signed, see `sys/target_nto.h` of the QNX Neutrino SDP.
+ // Only positive values should be used, see e.g.
+ // https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/s/setuid.html
+ type UserId = i32;
+ type GroupId = i32;
+ } else {
+ type UserId = u32;
+ type GroupId = u32;
+ }
+}
/// Unix-specific extensions to the [`process::Command`] builder.
///