diff --git a/src/platform/src/linux/mod.rs b/src/platform/src/linux/mod.rs index 99b2d6e08de653a35ef0476357e017a3b9b8d454..be108e8d62133595fbc52f022256d9820674fbdc 100644 --- a/src/platform/src/linux/mod.rs +++ b/src/platform/src/linux/mod.rs @@ -5,6 +5,8 @@ use types::*; const EINVAL: c_int = 22; +const SIGCHLD: usize = 17; + const TCGETS: c_ulong = 0x5401; const TCSETS: c_ulong = 0x5402; const TIOCGWINSZ: c_ulong = 0x5413; @@ -106,7 +108,7 @@ pub fn fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int { } pub fn fork() -> pid_t { - e(unsafe { syscall!(CLONE, 17, 0) }) as pid_t + e(unsafe { syscall!(CLONE, SIGCHLD, 0) }) as pid_t } pub fn fsync(fildes: c_int) -> c_int { diff --git a/src/platform/src/redox/mod.rs b/src/platform/src/redox/mod.rs index 14edf6ae3f8f57eab49e6f84aa14339ed72a02c7..c9f815b91a276b3df85ff94a4edc41b65e963eb4 100644 --- a/src/platform/src/redox/mod.rs +++ b/src/platform/src/redox/mod.rs @@ -1045,7 +1045,10 @@ pub fn unlink(path: *const c_char) -> c_int { e(syscall::unlink(path)) as c_int } -pub fn waitpid(pid: pid_t, stat_loc: *mut c_int, options: c_int) -> pid_t { +pub fn waitpid(mut pid: pid_t, stat_loc: *mut c_int, options: c_int) -> pid_t { + if pid == !0 { + pid = 0; + } unsafe { let mut temp: usize = 0; let res = e(syscall::waitpid(pid as usize, &mut temp, options as usize));