Implement sys/times.h on linux

This commit is contained in:
jD91mZM2
2018-07-29 09:23:56 +02:00
parent e7e9d57db5
commit f82b48b839
13 changed files with 94 additions and 0 deletions
+4
View File
@@ -392,6 +392,10 @@ pub fn socketpair(domain: c_int, kind: c_int, protocol: c_int, socket_vector: *m
e(unsafe { syscall!(SOCKETPAIR, domain, kind, protocol, socket_vector) }) as c_int
}
pub fn times(out: *mut tms) -> clock_t {
unsafe { syscall!(TIMES, out) as clock_t }
}
pub fn uname(utsname: *mut utsname) -> c_int {
e(unsafe { syscall!(UNAME, utsname, 0) }) as c_int
}
+9
View File
@@ -821,6 +821,15 @@ pub fn socketpair(domain: c_int, kind: c_int, protocol: c_int, socket_vector: *m
-1
}
pub fn times(out: *mut tms) -> clock_t {
let _ = write!(
::FileWriter(2),
"unimplemented: times({:p})",
out
);
!0
}
pub fn unlink(path: *const c_char) -> c_int {
let path = unsafe { c_str(path) };
e(syscall::unlink(path)) as c_int
+8
View File
@@ -223,3 +223,11 @@ pub struct rusage {
pub ru_nvcsw: c_long,
pub ru_nivcsw: c_long
}
#[repr(C)]
pub struct tms {
tms_utime: clock_t,
tms_stime: clock_t,
tms_cutime: clock_t,
tms_cstime: clock_t
}