do not derive Copy for timespec

This commit is contained in:
auronandace
2026-03-11 14:37:16 +00:00
parent 06f94de968
commit 293a2e991d
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ use crate::{
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/time.h.html>.
#[repr(C)]
#[derive(Clone, Copy, Default, Debug)]
#[derive(Clone, Default, Debug)]
pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_long,
+1 -1
View File
@@ -76,7 +76,7 @@ pub unsafe extern "C" fn pthread_mutex_timedlock(
mutex: *mut pthread_mutex_t,
abstime: &timespec,
) -> c_int {
let relative = match timespec_realtime_to_monotonic(*abstime) {
let relative = match timespec_realtime_to_monotonic(abstime.clone()) {
Ok(relative) => relative,
Err(err) => return e(Err(err)),
};
+3 -2
View File
@@ -96,7 +96,7 @@ pub unsafe extern "C" fn sem_clockwait(
clock_id: clockid_t,
abstime: *const timespec,
) -> c_int {
if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { *abstime }), clock_id) {}; // TODO handle error
if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { (*abstime).clone() }), clock_id) {}; // TODO handle error
0
}
@@ -104,7 +104,8 @@ pub unsafe extern "C" fn sem_clockwait(
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_timedwait.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn sem_timedwait(sem: *mut sem_t, abstime: *const timespec) -> c_int {
if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { *abstime }), CLOCK_REALTIME) {}; // TODO handle error
if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { (*abstime).clone() }), CLOCK_REALTIME) {
}; // TODO handle error
0
}