Skip to content

Commit 28ba3a7

Browse files
committed
native: Remove timerfd implementation on linux
Rust advertises itself as being compatible with linux 2.6.18, but the timerfd set of syscalls weren't added until linux 2.6.25. There is no real need for a specialized timer implementation beyond being a "little more accurate", but the select() implementation will suffice for now. If it is later deemed that an accurate timerfd implementation is needed, it can be added then through some method which will allow the standard distribution to continue to be compatible with 2.6.18 Closes #13447
1 parent ab0d847 commit 28ba3a7

File tree

3 files changed

+6
-333
lines changed

3 files changed

+6
-333
lines changed

src/libnative/io/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,8 @@ pub mod file;
5555
#[cfg(target_os = "macos")]
5656
#[cfg(target_os = "freebsd")]
5757
#[cfg(target_os = "android")]
58-
#[path = "timer_other.rs"]
59-
pub mod timer;
60-
6158
#[cfg(target_os = "linux")]
62-
#[path = "timer_timerfd.rs"]
59+
#[path = "timer_unix.rs"]
6360
pub mod timer;
6461

6562
#[cfg(target_os = "win32")]

src/libnative/io/timer_timerfd.rs

-327
This file was deleted.

src/libnative/io/timer_other.rs renamed to src/libnative/io/timer_unix.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -312,17 +312,20 @@ mod imp {
312312

313313
#[cfg(target_os = "android")]
314314
#[cfg(target_os = "freebsd")]
315+
#[cfg(target_os = "linux")]
315316
mod imp {
316317
use libc;
318+
use std::uint;
317319

318320
pub static FD_SETSIZE: uint = 1024;
319321

320322
pub struct fd_set {
321-
fds_bits: [u64, ..(FD_SETSIZE / 64)]
323+
fds_bits: [uint, ..(FD_SETSIZE / uint::BITS)]
322324
}
323325

324326
pub fn fd_set(set: &mut fd_set, fd: i32) {
325-
set.fds_bits[(fd / 64) as uint] |= (1 << (fd % 64)) as u64;
327+
let fd = fd as uint;
328+
set.fds_bits[fd / uint::BITS] |= 1 << (fd % uint::BITS);
326329
}
327330

328331
extern {

0 commit comments

Comments
 (0)