wait and waitpid

This commit is contained in:
Paul Sajna
2018-03-11 16:50:46 -07:00
parent 1b1ff5c750
commit ccb29cfa2c
3 changed files with 10 additions and 2 deletions
+4
View File
@@ -159,6 +159,10 @@ pub fn unlink(path: *const c_char) -> c_int {
e(unsafe { syscall!(UNLINKAT, AT_FDCWD, path, 0) }) as c_int
}
pub fn waitpid(pid: pid_t, stat_loc: *mut c_int, options: c_int) -> pid_t {
e(unsafe { syscall!(WAIT4, pid, stat_loc, options) }) as pid_t
}
pub fn write(fildes: c_int, buf: &[u8]) -> ssize_t {
e(unsafe { syscall!(WRITE, fildes, buf.as_ptr(), buf.len()) }) as ssize_t
}
+4
View File
@@ -202,6 +202,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 {
e(syscall::waitpid(pid as usize, stat_loc as &mut usize, options as usize))
}
pub fn write(fd: c_int, buf: &[u8]) -> ssize_t {
e(syscall::write(fd as usize, buf)) as ssize_t
}