Skip to content

Commit 0f0257b

Browse files
committed
Take some of sys/vxworks/process/* from sys/unix instead.
1 parent 408db0d commit 0f0257b

File tree

6 files changed

+77
-407
lines changed

6 files changed

+77
-407
lines changed

library/std/src/sys/unix/ext/process.rs

+20-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,20 @@ pub trait CommandExt {
1616
/// `setuid` call in the child process. Failure in the `setuid`
1717
/// call will cause the spawn to fail.
1818
#[stable(feature = "rust1", since = "1.0.0")]
19-
fn uid(&mut self, id: u32) -> &mut process::Command;
19+
fn uid(
20+
&mut self,
21+
#[cfg(not(target_os = "vxworks"))] id: u32,
22+
#[cfg(target_os = "vxworks")] id: u16,
23+
) -> &mut process::Command;
2024

2125
/// Similar to `uid`, but sets the group ID of the child process. This has
2226
/// the same semantics as the `uid` field.
2327
#[stable(feature = "rust1", since = "1.0.0")]
24-
fn gid(&mut self, id: u32) -> &mut process::Command;
28+
fn gid(
29+
&mut self,
30+
#[cfg(not(target_os = "vxworks"))] id: u32,
31+
#[cfg(target_os = "vxworks")] id: u16,
32+
) -> &mut process::Command;
2533

2634
/// Schedules a closure to be run just before the `exec` function is
2735
/// invoked.
@@ -115,12 +123,20 @@ pub trait CommandExt {
115123

116124
#[stable(feature = "rust1", since = "1.0.0")]
117125
impl CommandExt for process::Command {
118-
fn uid(&mut self, id: u32) -> &mut process::Command {
126+
fn uid(
127+
&mut self,
128+
#[cfg(not(target_os = "vxworks"))] id: u32,
129+
#[cfg(target_os = "vxworks")] id: u16,
130+
) -> &mut process::Command {
119131
self.as_inner_mut().uid(id);
120132
self
121133
}
122134

123-
fn gid(&mut self, id: u32) -> &mut process::Command {
135+
fn gid(
136+
&mut self,
137+
#[cfg(not(target_os = "vxworks"))] id: u32,
138+
#[cfg(target_os = "vxworks")] id: u16,
139+
) -> &mut process::Command {
124140
self.as_inner_mut().gid(id);
125141
self
126142
}

library/std/src/sys/unix/process/process_common.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ cfg_if::cfg_if! {
2424
// fuchsia doesn't have /dev/null
2525
} else if #[cfg(target_os = "redox")] {
2626
const DEV_NULL: &str = "null:\0";
27+
} else if #[cfg(target_os = "vxworks")] {
28+
const DEV_NULL: &str = "/null\0";
2729
} else {
2830
const DEV_NULL: &str = "/dev/null\0";
2931
}
@@ -48,7 +50,7 @@ cfg_if::cfg_if! {
4850
raw[bit / 8] |= 1 << (bit % 8);
4951
return 0;
5052
}
51-
} else {
53+
} else if #[cfg(not(target_os = "vxworks"))] {
5254
pub use libc::{sigemptyset, sigaddset};
5355
}
5456
}

library/std/src/sys/unix/process/process_unix.rs

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ use crate::sys;
66
use crate::sys::cvt;
77
use crate::sys::process::process_common::*;
88

9+
#[cfg(target_os = "vxworks")]
10+
use libc::RTP_ID as pid_t;
11+
12+
#[cfg(not(target_os = "vxworks"))]
913
use libc::{c_int, gid_t, pid_t, uid_t};
1014

1115
////////////////////////////////////////////////////////////////////////////////
+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
pub use self::process_common::{Command, ExitCode, ExitStatus, Stdio, StdioPipes};
2-
pub use self::process_inner::Process;
1+
pub use self::process_common::{Command, CommandArgs, ExitCode, Stdio, StdioPipes};
2+
pub use self::process_inner::{ExitStatus, Process};
33
pub use crate::ffi::OsString as EnvKey;
4+
pub use crate::sys_common::process::CommandEnvs;
45

6+
#[path = "../../unix/process/process_common.rs"]
57
mod process_common;
68
#[path = "process_vxworks.rs"]
79
mod process_inner;

0 commit comments

Comments
 (0)