mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 02:54:00 +00:00
Fix vxworks
compilation errors
This commit is contained in:
parent
12120409d5
commit
9bd9cbb28e
@ -85,11 +85,6 @@ pub fn errno() -> i32 {
|
||||
unsafe { libc::errnoGet() }
|
||||
}
|
||||
|
||||
#[cfg(target_os = "vxworks")]
|
||||
pub fn set_errno(e: i32) {
|
||||
unsafe { libc::errnoSet(e as c_int) };
|
||||
}
|
||||
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
pub fn errno() -> i32 {
|
||||
extern "C" {
|
||||
@ -642,7 +637,7 @@ pub fn getppid() -> u32 {
|
||||
unsafe { libc::getppid() as u32 }
|
||||
}
|
||||
|
||||
#[cfg(target_env = "gnu")]
|
||||
#[cfg(all(target_env = "gnu", not(target_os = "vxworks")))]
|
||||
pub fn glibc_version() -> Option<(usize, usize)> {
|
||||
if let Some(Ok(version_str)) = glibc_version_cstr().map(CStr::to_str) {
|
||||
parse_glibc_version(version_str)
|
||||
@ -651,7 +646,7 @@ pub fn glibc_version() -> Option<(usize, usize)> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_env = "gnu")]
|
||||
#[cfg(all(target_env = "gnu", not(target_os = "vxworks")))]
|
||||
fn glibc_version_cstr() -> Option<&'static CStr> {
|
||||
weak! {
|
||||
fn gnu_get_libc_version() -> *const libc::c_char
|
||||
@ -665,7 +660,7 @@ fn glibc_version_cstr() -> Option<&'static CStr> {
|
||||
|
||||
// Returns Some((major, minor)) if the string is a valid "x.y" version,
|
||||
// ignoring any extra dot-separated parts. Otherwise return None.
|
||||
#[cfg(target_env = "gnu")]
|
||||
#[cfg(all(target_env = "gnu", not(target_os = "vxworks")))]
|
||||
fn parse_glibc_version(version: &str) -> Option<(usize, usize)> {
|
||||
let mut parsed_ints = version.split('.').map(str::parse::<usize>).fuse();
|
||||
match (parsed_ints.next(), parsed_ints.next()) {
|
||||
|
@ -223,7 +223,7 @@ impl Command {
|
||||
pub fn get_groups(&self) -> Option<&[gid_t]> {
|
||||
self.groups.as_deref()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_closures(&mut self) -> &mut Vec<Box<dyn FnMut() -> io::Result<()> + Send + Sync>> {
|
||||
&mut self.closures
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ impl Command {
|
||||
needs_stdin: bool,
|
||||
) -> io::Result<(Process, StdioPipes)> {
|
||||
use crate::sys::cvt_r;
|
||||
const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
|
||||
// const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
|
||||
let envp = self.capture_env();
|
||||
|
||||
if self.saw_nul() {
|
||||
@ -196,6 +196,24 @@ impl ExitStatus {
|
||||
pub fn signal(&self) -> Option<i32> {
|
||||
if !self.exited() { Some(libc::WTERMSIG(self.0)) } else { None }
|
||||
}
|
||||
|
||||
pub fn core_dumped(&self) -> bool {
|
||||
// This method is not yet properly implemented on VxWorks
|
||||
false
|
||||
}
|
||||
|
||||
pub fn stopped_signal(&self) -> Option<i32> {
|
||||
if libc::WIFSTOPPED(self.0) { Some(libc::WSTOPSIG(self.0)) } else { None }
|
||||
}
|
||||
|
||||
pub fn continued(&self) -> bool {
|
||||
// This method is not yet properly implemented on VxWorks
|
||||
false
|
||||
}
|
||||
|
||||
pub fn into_raw(&self) -> c_int {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts a raw `c_int` to a type-safe `ExitStatus` by wrapping it without copying.
|
||||
|
Loading…
Reference in New Issue
Block a user