Fix vxworks
compilation errors
This commit is contained in:
parent
12120409d5
commit
9bd9cbb28e
3 changed files with 23 additions and 10 deletions
|
@ -85,11 +85,6 @@ pub fn errno() -> i32 {
|
||||||
unsafe { libc::errnoGet() }
|
unsafe { libc::errnoGet() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "vxworks")]
|
|
||||||
pub fn set_errno(e: i32) {
|
|
||||||
unsafe { libc::errnoSet(e as c_int) };
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "dragonfly")]
|
#[cfg(target_os = "dragonfly")]
|
||||||
pub fn errno() -> i32 {
|
pub fn errno() -> i32 {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -642,7 +637,7 @@ pub fn getppid() -> u32 {
|
||||||
unsafe { libc::getppid() as 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)> {
|
pub fn glibc_version() -> Option<(usize, usize)> {
|
||||||
if let Some(Ok(version_str)) = glibc_version_cstr().map(CStr::to_str) {
|
if let Some(Ok(version_str)) = glibc_version_cstr().map(CStr::to_str) {
|
||||||
parse_glibc_version(version_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> {
|
fn glibc_version_cstr() -> Option<&'static CStr> {
|
||||||
weak! {
|
weak! {
|
||||||
fn gnu_get_libc_version() -> *const libc::c_char
|
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,
|
// Returns Some((major, minor)) if the string is a valid "x.y" version,
|
||||||
// ignoring any extra dot-separated parts. Otherwise return None.
|
// 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)> {
|
fn parse_glibc_version(version: &str) -> Option<(usize, usize)> {
|
||||||
let mut parsed_ints = version.split('.').map(str::parse::<usize>).fuse();
|
let mut parsed_ints = version.split('.').map(str::parse::<usize>).fuse();
|
||||||
match (parsed_ints.next(), parsed_ints.next()) {
|
match (parsed_ints.next(), parsed_ints.next()) {
|
||||||
|
|
|
@ -223,7 +223,7 @@ impl Command {
|
||||||
pub fn get_groups(&self) -> Option<&[gid_t]> {
|
pub fn get_groups(&self) -> Option<&[gid_t]> {
|
||||||
self.groups.as_deref()
|
self.groups.as_deref()
|
||||||
}
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn get_closures(&mut self) -> &mut Vec<Box<dyn FnMut() -> io::Result<()> + Send + Sync>> {
|
pub fn get_closures(&mut self) -> &mut Vec<Box<dyn FnMut() -> io::Result<()> + Send + Sync>> {
|
||||||
&mut self.closures
|
&mut self.closures
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ impl Command {
|
||||||
needs_stdin: bool,
|
needs_stdin: bool,
|
||||||
) -> io::Result<(Process, StdioPipes)> {
|
) -> io::Result<(Process, StdioPipes)> {
|
||||||
use crate::sys::cvt_r;
|
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();
|
let envp = self.capture_env();
|
||||||
|
|
||||||
if self.saw_nul() {
|
if self.saw_nul() {
|
||||||
|
@ -196,6 +196,24 @@ impl ExitStatus {
|
||||||
pub fn signal(&self) -> Option<i32> {
|
pub fn signal(&self) -> Option<i32> {
|
||||||
if !self.exited() { Some(libc::WTERMSIG(self.0)) } else { None }
|
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.
|
/// Converts a raw `c_int` to a type-safe `ExitStatus` by wrapping it without copying.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue