Skip to content

Commit 9bd9cbb

Browse files
committed
Fix vxworks compilation errors
1 parent 1212040 commit 9bd9cbb

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

library/std/src/sys/unix/os.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ pub fn errno() -> i32 {
8585
unsafe { libc::errnoGet() }
8686
}
8787

88-
#[cfg(target_os = "vxworks")]
89-
pub fn set_errno(e: i32) {
90-
unsafe { libc::errnoSet(e as c_int) };
91-
}
92-
9388
#[cfg(target_os = "dragonfly")]
9489
pub fn errno() -> i32 {
9590
extern "C" {
@@ -642,7 +637,7 @@ pub fn getppid() -> u32 {
642637
unsafe { libc::getppid() as u32 }
643638
}
644639

645-
#[cfg(target_env = "gnu")]
640+
#[cfg(all(target_env = "gnu", not(target_os = "vxworks")))]
646641
pub fn glibc_version() -> Option<(usize, usize)> {
647642
if let Some(Ok(version_str)) = glibc_version_cstr().map(CStr::to_str) {
648643
parse_glibc_version(version_str)
@@ -651,7 +646,7 @@ pub fn glibc_version() -> Option<(usize, usize)> {
651646
}
652647
}
653648

654-
#[cfg(target_env = "gnu")]
649+
#[cfg(all(target_env = "gnu", not(target_os = "vxworks")))]
655650
fn glibc_version_cstr() -> Option<&'static CStr> {
656651
weak! {
657652
fn gnu_get_libc_version() -> *const libc::c_char
@@ -665,7 +660,7 @@ fn glibc_version_cstr() -> Option<&'static CStr> {
665660

666661
// Returns Some((major, minor)) if the string is a valid "x.y" version,
667662
// ignoring any extra dot-separated parts. Otherwise return None.
668-
#[cfg(target_env = "gnu")]
663+
#[cfg(all(target_env = "gnu", not(target_os = "vxworks")))]
669664
fn parse_glibc_version(version: &str) -> Option<(usize, usize)> {
670665
let mut parsed_ints = version.split('.').map(str::parse::<usize>).fuse();
671666
match (parsed_ints.next(), parsed_ints.next()) {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl Command {
223223
pub fn get_groups(&self) -> Option<&[gid_t]> {
224224
self.groups.as_deref()
225225
}
226-
226+
#[allow(dead_code)]
227227
pub fn get_closures(&mut self) -> &mut Vec<Box<dyn FnMut() -> io::Result<()> + Send + Sync>> {
228228
&mut self.closures
229229
}

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

+19-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl Command {
1818
needs_stdin: bool,
1919
) -> io::Result<(Process, StdioPipes)> {
2020
use crate::sys::cvt_r;
21-
const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
21+
// const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
2222
let envp = self.capture_env();
2323

2424
if self.saw_nul() {
@@ -196,6 +196,24 @@ impl ExitStatus {
196196
pub fn signal(&self) -> Option<i32> {
197197
if !self.exited() { Some(libc::WTERMSIG(self.0)) } else { None }
198198
}
199+
200+
pub fn core_dumped(&self) -> bool {
201+
// This method is not yet properly implemented on VxWorks
202+
false
203+
}
204+
205+
pub fn stopped_signal(&self) -> Option<i32> {
206+
if libc::WIFSTOPPED(self.0) { Some(libc::WSTOPSIG(self.0)) } else { None }
207+
}
208+
209+
pub fn continued(&self) -> bool {
210+
// This method is not yet properly implemented on VxWorks
211+
false
212+
}
213+
214+
pub fn into_raw(&self) -> c_int {
215+
self.0
216+
}
199217
}
200218

201219
/// Converts a raw `c_int` to a type-safe `ExitStatus` by wrapping it without copying.

0 commit comments

Comments
 (0)