Merge branch 'master' into master

This commit is contained in:
Tom Almeida
2018-03-16 23:26:11 +08:00
committed by GitHub
8 changed files with 39 additions and 4 deletions
+4
View File
@@ -163,6 +163,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, 0) }) 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
}
+11
View File
@@ -206,6 +206,17 @@ 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 {
unsafe {
let mut temp: usize = 0;
let res = e(syscall::waitpid(pid as usize, &mut temp, options as usize));
if !stat_loc.is_null() {
*stat_loc = temp as c_int;
}
res
}
}
pub fn write(fd: c_int, buf: &[u8]) -> ssize_t {
e(syscall::write(fd as usize, buf)) as ssize_t
}