Add Out<T> wrapper
This commit is contained in:
@@ -27,6 +27,7 @@ use crate::{
|
||||
wchar::*,
|
||||
},
|
||||
ld_so,
|
||||
out::Out,
|
||||
platform::{self, types::*, Pal, Sys},
|
||||
sync::Once,
|
||||
};
|
||||
@@ -760,7 +761,7 @@ where
|
||||
fn get_nstime() -> u64 {
|
||||
unsafe {
|
||||
let mut ts = mem::MaybeUninit::uninit();
|
||||
Sys::clock_gettime(CLOCK_MONOTONIC, ts.as_mut_ptr());
|
||||
Sys::clock_gettime(CLOCK_MONOTONIC, Out::from_uninit_mut(&mut ts));
|
||||
ts.assume_init().tv_nsec as u64
|
||||
}
|
||||
}
|
||||
@@ -1523,6 +1524,7 @@ pub unsafe extern "C" fn strtoull(
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/system.html>.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn system(command: *const c_char) -> c_int {
|
||||
// TODO: rusty error handling?
|
||||
//TODO: share code with popen
|
||||
|
||||
// handle shell detection on command == NULL
|
||||
@@ -1555,7 +1557,8 @@ pub unsafe extern "C" fn system(command: *const c_char) -> c_int {
|
||||
unreachable!();
|
||||
} else if child_pid > 0 {
|
||||
let mut wstatus = 0;
|
||||
if Sys::waitpid(child_pid, &mut wstatus, 0).or_minus_one_errno() == -1 {
|
||||
if Sys::waitpid(child_pid, Some(Out::from_mut(&mut wstatus)), 0).or_minus_one_errno() == -1
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user