Skip to content

Commit

Permalink
native: Remove timerfd implementation on linux
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alexcrichton committed Apr 12, 2014
1 parent ab0d847 commit 28ba3a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 333 deletions.
5 changes: 1 addition & 4 deletions src/libnative/io/mod.rs
Expand Up @@ -55,11 +55,8 @@ pub mod file;
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
#[cfg(target_os = "android")]
#[path = "timer_other.rs"]
pub mod timer;

#[cfg(target_os = "linux")]
#[path = "timer_timerfd.rs"]
#[path = "timer_unix.rs"]
pub mod timer;

#[cfg(target_os = "win32")]
Expand Down
327 changes: 0 additions & 327 deletions src/libnative/io/timer_timerfd.rs

This file was deleted.

Expand Up @@ -312,17 +312,20 @@ mod imp {

#[cfg(target_os = "android")]
#[cfg(target_os = "freebsd")]
#[cfg(target_os = "linux")]
mod imp {
use libc;
use std::uint;

pub static FD_SETSIZE: uint = 1024;

pub struct fd_set {
fds_bits: [u64, ..(FD_SETSIZE / 64)]
fds_bits: [uint, ..(FD_SETSIZE / uint::BITS)]
}

pub fn fd_set(set: &mut fd_set, fd: i32) {
set.fds_bits[(fd / 64) as uint] |= (1 << (fd % 64)) as u64;
let fd = fd as uint;
set.fds_bits[fd / uint::BITS] |= 1 << (fd % uint::BITS);
}

extern {
Expand Down

13 comments on commit 28ba3a7

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at alexcrichton@28ba3a7

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/rust/jettison-timerfd = 28ba3a7 into auto

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/rust/jettison-timerfd = 28ba3a7 merged ok, testing candidate = c5c25574

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at alexcrichton@28ba3a7

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/rust/jettison-timerfd = 28ba3a7 into auto

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/rust/jettison-timerfd = 28ba3a7 merged ok, testing candidate = b101c1d6

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at alexcrichton@28ba3a7

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/rust/jettison-timerfd = 28ba3a7 into auto

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/rust/jettison-timerfd = 28ba3a7 merged ok, testing candidate = 9d75f23

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 13, 2014

@bors
Copy link
Contributor

@bors bors commented on 28ba3a7 Apr 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 9d75f23

Please sign in to comment.