Fix compilation on 32-bit systems
This commit is contained in:
@@ -616,7 +616,7 @@ pub unsafe fn fseek_locked(stream: &mut FILE, mut off: off_t, whence: c_int) ->
|
||||
/// Seek to a position `pos` in the file from the beginning of the file
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn fsetpos(stream: *mut FILE, pos: *const fpos_t) -> c_int {
|
||||
fseek(stream, *pos, SEEK_SET)
|
||||
fseeko(stream, *pos, SEEK_SET)
|
||||
}
|
||||
|
||||
/// Get the current position of the cursor in the file
|
||||
|
||||
@@ -163,14 +163,12 @@ pub extern "C" fn clock() -> clock_t {
|
||||
}
|
||||
let ts = unsafe { ts.assume_init() };
|
||||
|
||||
if ts.tv_sec > time_t::max_value() / CLOCKS_PER_SEC
|
||||
|| ts.tv_nsec / (1_000_000_000 / CLOCKS_PER_SEC)
|
||||
> time_t::max_value() - CLOCKS_PER_SEC * ts.tv_sec
|
||||
{
|
||||
return -1;
|
||||
let clocks = ts.tv_sec * CLOCKS_PER_SEC as i64
|
||||
+ (ts.tv_nsec / (1_000_000_000 / CLOCKS_PER_SEC)) as i64;
|
||||
match clock_t::try_from(clocks) {
|
||||
Ok(ok) => ok,
|
||||
Err(_err) => -1,
|
||||
}
|
||||
|
||||
ts.tv_sec * CLOCKS_PER_SEC + ts.tv_nsec / (1_000_000_000 / CLOCKS_PER_SEC)
|
||||
}
|
||||
|
||||
// #[no_mangle]
|
||||
|
||||
@@ -603,7 +603,7 @@ pub extern "C" fn setuid(uid: uid_t) -> c_int {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sleep(seconds: c_uint) -> c_uint {
|
||||
let rqtp = timespec {
|
||||
tv_sec: seconds as c_long,
|
||||
tv_sec: seconds as time_t,
|
||||
tv_nsec: 0,
|
||||
};
|
||||
let rmtp = ptr::null_mut();
|
||||
@@ -731,7 +731,7 @@ pub unsafe extern "C" fn unlink(path: *const c_char) -> c_int {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn usleep(useconds: useconds_t) -> c_int {
|
||||
let rqtp = timespec {
|
||||
tv_sec: (useconds / 1_000_000) as c_long,
|
||||
tv_sec: (useconds / 1_000_000) as time_t,
|
||||
tv_nsec: ((useconds % 1_000_000) * 1000) as c_long,
|
||||
};
|
||||
let rmtp = ptr::null_mut();
|
||||
|
||||
Reference in New Issue
Block a user