mark timespec_get and timespec_getres as unsafe and annotate no mangle

This commit is contained in:
auronandace
2025-12-07 21:07:49 +00:00
parent fe5273890a
commit 27bd869119
+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)
}