Merge branch 'cleanup-sys-wait' into 'master'
Cleanup sys wait See merge request redox-os/relibc!771
This commit is contained in:
+13
-14
@@ -1,9 +1,15 @@
|
||||
//! sys/wait.h implementation for Redox, following
|
||||
//! http://pubs.opengroup.org/onlinepubs/7908799/xsh/syswait.h.html
|
||||
//! `sys/wait.h` implementation.
|
||||
//!
|
||||
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_wait.h.html>.
|
||||
|
||||
use crate::{error::ResultExt, out::Out};
|
||||
//use header::sys_resource::rusage;
|
||||
use crate::platform::{Pal, Sys, types::*};
|
||||
use crate::{
|
||||
error::ResultExt,
|
||||
out::Out,
|
||||
platform::{
|
||||
Pal, Sys,
|
||||
types::{c_int, pid_t},
|
||||
},
|
||||
};
|
||||
|
||||
pub const WNOHANG: c_int = 1;
|
||||
pub const WUNTRACED: c_int = 2;
|
||||
@@ -18,20 +24,12 @@ pub const __WALL: c_int = 0x4000_0000;
|
||||
#[allow(overflowing_literals)]
|
||||
pub const __WCLONE: c_int = 0x8000_0000;
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/wait.html>.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn wait(stat_loc: *mut c_int) -> pid_t {
|
||||
waitpid(!0, stat_loc, 0)
|
||||
}
|
||||
|
||||
// #[unsafe(no_mangle)]
|
||||
// pub unsafe extern "C" fn wait3(
|
||||
// stat_loc: *mut c_int,
|
||||
// options: c_int,
|
||||
// resource_usage: *mut rusage,
|
||||
// ) -> pid_t {
|
||||
// unimplemented!();
|
||||
// }
|
||||
|
||||
/*
|
||||
* TODO: implement idtype_t, id_t, and siginfo_t
|
||||
*
|
||||
@@ -46,6 +44,7 @@ pub unsafe extern "C" fn wait(stat_loc: *mut c_int) -> pid_t {
|
||||
* }
|
||||
*/
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/waitpid.html>.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn waitpid(pid: pid_t, stat_loc: *mut c_int, options: c_int) -> pid_t {
|
||||
Sys::waitpid(pid, Out::nullable(stat_loc), options).or_minus_one_errno()
|
||||
|
||||
Reference in New Issue
Block a user