Merge branch 'fix-time-test' into 'master'

mark timespec_get and timespec_getres as unsafe and annotate no mangle

See merge request redox-os/relibc!784
This commit is contained in:
Jeremy Soller
2025-12-07 15:49:07 -07:00
+3 -2
View File
@@ -607,7 +607,7 @@ pub unsafe extern "C" fn timer_settime(
///
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/timespec_get.html>.
#[unsafe(no_mangle)]
pub extern "C" fn timespec_get(tp: *mut timespec, base: c_int) -> c_int {
pub unsafe extern "C" fn timespec_get(tp: *mut timespec, base: c_int) -> c_int {
let tp = unsafe { Out::nonnull(tp) };
Sys::clock_gettime(base - 1, tp).map(|()| base).unwrap_or(0)
}
@@ -617,7 +617,8 @@ pub extern "C" fn timespec_get(tp: *mut timespec, base: c_int) -> c_int {
/// The main differences are that this function:
/// * returns `0` on error and `base` on success
/// * only mandates TIME_UTC as a base
pub extern "C" fn timespec_getres(res: *mut timespec, base: c_int) -> c_int {
#[unsafe(no_mangle)]
pub unsafe extern "C" fn timespec_getres(res: *mut timespec, base: c_int) -> c_int {
let res = unsafe { Out::nullable(res) };
Sys::clock_getres(base - 1, res).map(|()| base).unwrap_or(0)
}