diff --git a/src/header/sys_time/mod.rs b/src/header/sys_time/mod.rs index af5e895d03..31ae5bb0b2 100644 --- a/src/header/sys_time/mod.rs +++ b/src/header/sys_time/mod.rs @@ -1,4 +1,6 @@ -//! sys/time implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/systime.h.html +//! `sys/time.h` implementation. +//! +//! See . use crate::{ c_str::CStr, @@ -8,16 +10,41 @@ use crate::{ }; use core::ptr::null; +/// See . +/// +/// # Deprecation +/// The `ITIMER_REAL` symbolic constant was marked obsolescent in the Open +/// Group Base Specifications Issue 7, and removed in Issue 8. +#[deprecated] pub const ITIMER_REAL: c_int = 0; + +/// See . +/// +/// # Deprecation +/// The `ITIMER_VIRTUAL` symbolic constant was marked obsolescent in the Open +/// Group Base Specifications Issue 7, and removed in Issue 8. +#[deprecated] pub const ITIMER_VIRTUAL: c_int = 1; + +/// See . +/// +/// # Deprecation +/// The `ITIMER_PROF` symbolic constant was marked obsolescent in the Open +/// Group Base Specifications Issue 7, and removed in Issue 8. +#[deprecated] pub const ITIMER_PROF: c_int = 2; +/// See . +/// +/// TODO: specified for `sys/select.h` in modern POSIX? #[repr(C)] #[derive(Default)] pub struct timeval { pub tv_sec: time_t, pub tv_usec: suseconds_t, } + +/// Non-POSIX, see . #[repr(C)] #[derive(Default)] pub struct timezone { @@ -25,6 +52,12 @@ pub struct timezone { pub tz_dsttime: c_int, } +/// See . +/// +/// # Deprecation +/// The `itimerval` struct was marked obsolescent in the Open Group Base +/// Specifications Issue 7, and removed in Issue 8. +#[deprecated] #[repr(C)] #[derive(Default)] pub struct itimerval { @@ -32,11 +65,20 @@ pub struct itimerval { pub it_value: timeval, } +/// See . +/// +/// TODO: specified for `sys/select.h` in modern POSIX? #[repr(C)] pub struct fd_set { pub fds_bits: [c_long; 16usize], } +/// See . +/// +/// # Deprecation +/// The `getitimer()` function was marked obsolescent in the Open Group Base +/// Specifications Issue 7, and removed in Issue 8. +#[deprecated] #[no_mangle] pub unsafe extern "C" fn getitimer(which: c_int, value: *mut itimerval) -> c_int { Sys::getitimer(which, value) @@ -44,6 +86,12 @@ pub unsafe extern "C" fn getitimer(which: c_int, value: *mut itimerval) -> c_int .or_minus_one_errno() } +/// See . +/// +/// # Deprecation +/// The `setitimer()` function was marked obsolescent in the Open Group Base +/// Specifications Issue 7, and removed in Issue 8. +#[deprecated] #[no_mangle] pub unsafe extern "C" fn setitimer( which: c_int, @@ -55,11 +103,25 @@ pub unsafe extern "C" fn setitimer( .or_minus_one_errno() } +/// See . +/// +/// See also +/// for further details on the `tzp` argument. +/// +/// # Deprecation +/// The `gettimeofday()` function was marked obsolescent in the Open Group Base +/// Specifications Issue 7, and removed in Issue 8. +#[deprecated] #[no_mangle] pub unsafe extern "C" fn gettimeofday(tp: *mut timeval, tzp: *mut timezone) -> c_int { Sys::gettimeofday(tp, tzp).map(|()| 0).or_minus_one_errno() } +/// See . +/// +/// # Deprecation +/// The `utimes()` function was marked legacy in the Open Group Base +/// Specifications Issue 6, and then unmarked in Issue 7. #[no_mangle] pub unsafe extern "C" fn utimes(path: *const c_char, times: *const timeval) -> c_int { let path = CStr::from_ptr(path);