Fix compilation on 32-bit systems
This commit is contained in:
+5
-5
@@ -14,7 +14,7 @@ use crate::{
|
||||
tcb::{Master, Tcb},
|
||||
},
|
||||
platform::{
|
||||
types::{c_int, c_uint, c_long, c_void, pid_t, size_t},
|
||||
types::{c_int, c_uint, c_long, c_void, pid_t, size_t, time_t},
|
||||
Pal, Sys,
|
||||
},
|
||||
sync::{Mutex, Semaphore},
|
||||
@@ -253,8 +253,8 @@ pub unsafe extern "C" fn pte_osThreadSleep(msecs: c_uint) {
|
||||
Sys::sched_yield();
|
||||
} else {
|
||||
let tm = timespec {
|
||||
tv_sec: msecs as c_long / 1000,
|
||||
tv_nsec: (msecs % 1000) as c_long * 1000000,
|
||||
tv_sec: msecs as time_t / 1000,
|
||||
tv_nsec: ((msecs as c_long) % 1000) * 1000000,
|
||||
};
|
||||
Sys::nanosleep(&tm, ptr::null_mut());
|
||||
}
|
||||
@@ -353,9 +353,9 @@ pub unsafe extern "C" fn pte_osSemaphorePend(
|
||||
clock_gettime(CLOCK_MONOTONIC, &mut time);
|
||||
|
||||
// Add timeout to time
|
||||
let timeout = *pTimeout as c_long;
|
||||
let timeout = *pTimeout as time_t;
|
||||
time.tv_sec += timeout / 1000;
|
||||
time.tv_nsec += (timeout % 1000) * 1_000_000;
|
||||
time.tv_nsec += ((timeout % 1000) * 1_000_000) as c_long;
|
||||
while time.tv_nsec >= 1_000_000_000 {
|
||||
time.tv_sec += 1;
|
||||
time.tv_nsec -= 1_000_000_000;
|
||||
|
||||
@@ -190,7 +190,7 @@ impl Pal for Sys {
|
||||
-1 => -1,
|
||||
_ => {
|
||||
unsafe {
|
||||
(*tp).tv_sec = redox_tp.tv_sec as c_long;
|
||||
(*tp).tv_sec = redox_tp.tv_sec as time_t;
|
||||
(*tp).tv_nsec = redox_tp.tv_nsec as c_long;
|
||||
};
|
||||
0
|
||||
@@ -702,7 +702,7 @@ impl Pal for Sys {
|
||||
_ => {
|
||||
unsafe {
|
||||
if !rmtp.is_null() {
|
||||
(*rmtp).tv_sec = redox_rmtp.tv_sec as c_long;
|
||||
(*rmtp).tv_sec = redox_rmtp.tv_sec as time_t;
|
||||
(*rmtp).tv_nsec = redox_rmtp.tv_nsec as c_long;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ impl PalSignal for Sys {
|
||||
}
|
||||
|
||||
unsafe {
|
||||
(*out).it_interval.tv_sec = spec.it_interval.tv_sec as c_long;
|
||||
(*out).it_interval.tv_sec = spec.it_interval.tv_sec as time_t;
|
||||
(*out).it_interval.tv_usec = spec.it_interval.tv_nsec / 1000;
|
||||
(*out).it_value.tv_sec = spec.it_value.tv_sec as c_long;
|
||||
(*out).it_value.tv_sec = spec.it_value.tv_sec as time_t;
|
||||
(*out).it_value.tv_usec = spec.it_value.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ impl PalSignal for Sys {
|
||||
if count != !0 {
|
||||
unsafe {
|
||||
if !old.is_null() {
|
||||
(*old).it_interval.tv_sec = spec.it_interval.tv_sec as c_long;
|
||||
(*old).it_interval.tv_sec = spec.it_interval.tv_sec as time_t;
|
||||
(*old).it_interval.tv_usec = spec.it_interval.tv_nsec / 1000;
|
||||
(*old).it_value.tv_sec = spec.it_value.tv_sec as c_long;
|
||||
(*old).it_value.tv_sec = spec.it_value.tv_sec as time_t;
|
||||
(*old).it_value.tv_usec = spec.it_value.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user