Skip to content
Snippets Groups Projects
Commit ccb29cfa authored by Paul Sajna's avatar Paul Sajna
Browse files

wait and waitpid

parent 1b1ff5c7
No related branches found
No related tags found
1 merge request!74wait and waitpid
......@@ -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
}
......@@ -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
}
......@@ -11,7 +11,7 @@ use resource::rusage;
#[no_mangle]
pub unsafe extern "C" fn wait(stat_loc: *mut c_int) -> pid_t {
unimplemented!();
waitpid(-1, stat_loc, 0)
}
#[no_mangle]
......@@ -39,5 +39,5 @@ pub unsafe extern "C" fn wait3(
#[no_mangle]
pub unsafe extern "C" fn waitpid(pid: pid_t, stat_loc: *mut c_int, options: c_int) -> pid_t {
unimplemented!();
platform::waitpid(pid, stat_loc, options)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment