From 27bd869119ba8b42a397dedcb640f7b835be525b Mon Sep 17 00:00:00 2001 From: auronandace Date: Sun, 7 Dec 2025 21:07:49 +0000 Subject: [PATCH] mark timespec_get and timespec_getres as unsafe and annotate no mangle --- src/header/time/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/header/time/mod.rs b/src/header/time/mod.rs index 51d56b66ed..2d183ba78d 100644 --- a/src/header/time/mod.rs +++ b/src/header/time/mod.rs @@ -607,7 +607,7 @@ pub unsafe extern "C" fn timer_settime( /// /// See . #[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) }