Skip to content

Commit

Permalink
Fix the inner type of EpollFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Svensson committed Feb 22, 2017
1 parent 7435cb6 commit 51b5eac
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/sys/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ use ::Error;

bitflags!(
#[repr(C)]
pub flags EpollFlags: u32 {
const EPOLLIN = libc::EPOLLIN as u32,
const EPOLLPRI = libc::EPOLLPRI as u32,
const EPOLLOUT = libc::EPOLLOUT as u32,
const EPOLLRDNORM = libc::EPOLLRDNORM as u32,
const EPOLLRDBAND = libc::EPOLLRDBAND as u32,
const EPOLLWRNORM = libc::EPOLLWRNORM as u32,
const EPOLLWRBAND = libc::EPOLLWRBAND as u32,
const EPOLLMSG = libc::EPOLLMSG as u32,
const EPOLLERR = libc::EPOLLERR as u32,
const EPOLLHUP = libc::EPOLLHUP as u32,
const EPOLLRDHUP = libc::EPOLLRDHUP as u32,
pub flags EpollFlags: libc::c_int {
const EPOLLIN = libc::EPOLLIN,
const EPOLLPRI = libc::EPOLLPRI,
const EPOLLOUT = libc::EPOLLOUT,
const EPOLLRDNORM = libc::EPOLLRDNORM,
const EPOLLRDBAND = libc::EPOLLRDBAND,
const EPOLLWRNORM = libc::EPOLLWRNORM,
const EPOLLWRBAND = libc::EPOLLWRBAND,
const EPOLLMSG = libc::EPOLLMSG,
const EPOLLERR = libc::EPOLLERR,
const EPOLLHUP = libc::EPOLLHUP,
const EPOLLRDHUP = libc::EPOLLRDHUP,
const EPOLLEXCLUSIVE = 1 << 28,
const EPOLLWAKEUP = libc::EPOLLWAKEUP as u32,
const EPOLLONESHOT = libc::EPOLLONESHOT as u32,
const EPOLLET = libc::EPOLLET as u32,
const EPOLLWAKEUP = libc::EPOLLWAKEUP,
const EPOLLONESHOT = libc::EPOLLONESHOT,
const EPOLLET = libc::EPOLLET,
}
);

Expand All @@ -48,15 +48,15 @@ pub struct EpollEvent {

impl EpollEvent {
pub fn new(events: EpollFlags, data: u64) -> Self {
EpollEvent { event: libc::epoll_event { events: events.bits(), u64: data } }
EpollEvent { event: libc::epoll_event { events: events.bits() as u32, u64: data } }
}

pub fn empty() -> Self {
unsafe { mem::zeroed::<EpollEvent>() }
}

pub fn events(&self) -> EpollFlags {
EpollFlags::from_bits(self.event.events).unwrap()
EpollFlags::from_bits(self.event.events as libc::c_int).unwrap()
}

pub fn data(&self) -> u64 {
Expand Down

0 comments on commit 51b5eac

Please sign in to comment.