| 1 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/io/::{AsRawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/AsRawFd#, RawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/RawFd#}; |
| •2 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::fdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/::AsFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/owned/AsFd#; |
| 3 |
|
| 4 |
use superrust-analyzer cargo calloop 0.10.5 sys/::{Interestrust-analyzer cargo calloop 0.10.5 sys/Interest#, Moderust-analyzer cargo calloop 0.10.5 sys/Mode#, PollEventrust-analyzer cargo calloop 0.10.5 sys/PollEvent#, Readinessrust-analyzer cargo calloop 0.10.5 sys/Readiness#, Tokenrust-analyzer cargo calloop 0.10.5 sys/Token#}; |
| 5 |
|
| 6 |
use nixrust-analyzer cargo nix 0.30.1 crate/::sysrust-analyzer cargo nix 0.30.1 sys/::{ |
| 7 |
epollrust-analyzer cargo nix 0.30.1 sys/epoll/::{ |
| 8 |
epoll_create1rust-analyzer cargo nix 0.30.1 sys/epoll/epoll_create1()., epoll_ctlrust-analyzer cargo nix 0.30.1 sys/epoll/epoll_ctl()., epoll_waitrust-analyzer cargo nix 0.30.1 sys/epoll/epoll_wait()., EpollCreateFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollCreateFlags#, EpollEventrust-analyzer cargo nix 0.30.1 sys/epoll/EpollEvent#, EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#, EpollOprust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#, |
| 9 |
}, |
| 10 |
timerust-analyzer cargo nix 0.30.1 sys/time/::TimeSpecrust-analyzer cargo nix 0.30.1 sys/time/TimeSpec#, |
| 11 |
timerfdrust-analyzer cargo nix 0.30.1 sys/timerfd/::{ClockIdrust-analyzer cargo nix 0.30.1 sys/timerfd/ClockId#, Expirationrust-analyzer cargo nix 0.30.1 sys/time/timer/Expiration#, TimerFdrust-analyzer cargo nix 0.30.1 sys/timerfd/TimerFd#, TimerFlagsrust-analyzer cargo nix 0.30.1 sys/timerfd/TimerFlags#, TimerSetTimeFlagsrust-analyzer cargo nix 0.30.1 sys/time/timer/TimerSetTimeFlags#}, |
| 12 |
}; |
| 13 |
|
| 14 |
pub struct Epollrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll# { |
| 15 |
epoll_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#epoll_fd.: RawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/RawFd#, |
| 16 |
timer_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#timer_fd.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<TimerFdrust-analyzer cargo nix 0.30.1 sys/timerfd/TimerFd#>, |
| 17 |
} |
| 18 |
|
| 19 |
const TIMER_DATArust-analyzer cargo calloop 0.10.5 sys/epoll/TIMER_DATA.: u64 = u64::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]MAX.; |
| 20 |
|
| 21 |
fn make_flagsrust-analyzer cargo calloop 0.10.5 sys/epoll/make_flags().(interest: Interestrust-analyzer cargo calloop 0.10.5 sys/Interest#, mode: Moderust-analyzer cargo calloop 0.10.5 sys/Mode#) -> EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags# { |
| 22 |
let mut flags = EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::emptyrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]empty().(); |
| 23 |
if interest.readablerust-analyzer cargo calloop 0.10.5 sys/Interest#readable. { |
| 24 |
flags rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign().EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::EPOLLINrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]EPOLLIN.; |
| 25 |
} |
| 26 |
if interest.writablerust-analyzer cargo calloop 0.10.5 sys/Interest#writable. { |
| 27 |
flags rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign().EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::EPOLLOUTrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]EPOLLOUT.; |
| 28 |
} |
| 29 |
match mode { |
| 30 |
Moderust-analyzer cargo calloop 0.10.5 sys/Mode#::Levelrust-analyzer cargo calloop 0.10.5 sys/Mode#Level# => { /* This is the default */ } |
| 31 |
Moderust-analyzer cargo calloop 0.10.5 sys/Mode#::Edgerust-analyzer cargo calloop 0.10.5 sys/Mode#Edge# => flags rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign().EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::EPOLLETrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]EPOLLET., |
| 32 |
Moderust-analyzer cargo calloop 0.10.5 sys/Mode#::OneShotrust-analyzer cargo calloop 0.10.5 sys/Mode#OneShot# => flags rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags][`BitOrAssign<Self>`]bitor_assign().EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::EPOLLONESHOTrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]EPOLLONESHOT., |
| 33 |
} |
| 34 |
flags |
| 35 |
} |
| 36 |
|
| 37 |
fn flags_to_readinessrust-analyzer cargo calloop 0.10.5 sys/epoll/flags_to_readiness().(flags: EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#) -> Readinessrust-analyzer cargo calloop 0.10.5 sys/Readiness# { |
| 38 |
Readinessrust-analyzer cargo calloop 0.10.5 sys/Readiness# { |
| 39 |
readablerust-analyzer cargo calloop 0.10.5 sys/Readiness#readable.: flags.containsrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]contains().(EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::EPOLLINrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]EPOLLIN.), |
| 40 |
writablerust-analyzer cargo calloop 0.10.5 sys/Readiness#writable.: flags.containsrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]contains().(EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::EPOLLOUTrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]EPOLLOUT.), |
| 41 |
errorrust-analyzer cargo calloop 0.10.5 sys/Readiness#error.: flags.containsrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]contains().(EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::EPOLLERRrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]EPOLLERR.), |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
impl Epollrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll# { |
| 46 |
pub(craterust-analyzer cargo calloop 0.10.5 crate/) fn newrust-analyzer cargo calloop 0.10.5 sys/epoll/impl#[Epoll]new().(high_precision: bool) -> craterust-analyzer cargo calloop 0.10.5 crate/::Resultrust-analyzer cargo calloop 0.10.5 error/Result#<Epollrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#> { |
| 47 |
let epoll_fd = epoll_create1rust-analyzer cargo nix 0.30.1 sys/epoll/epoll_create1().(EpollCreateFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollCreateFlags#::EPOLL_CLOEXECrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollCreateFlags]EPOLL_CLOEXEC.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 48 |
let mut timer_fd = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 49 |
if high_precision { |
| 50 |
// Prepare a timerfd for precise time tracking and register it to the event queue |
| 51 |
// This timerfd allows for nanosecond precision in setting the timout up (though in practice |
| 52 |
// we rather get ~10 microsecond precision), while epoll_wait() API only allows millisecond |
| 53 |
// granularity |
| 54 |
let timer = TimerFdrust-analyzer cargo nix 0.30.1 sys/timerfd/TimerFd#::newrust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFd]new().( |
| 55 |
ClockIdrust-analyzer cargo nix 0.30.1 sys/timerfd/ClockId#::CLOCK_MONOTONICrust-analyzer cargo nix 0.30.1 sys/timerfd/ClockId#CLOCK_MONOTONIC#, |
| 56 |
TimerFlagsrust-analyzer cargo nix 0.30.1 sys/timerfd/TimerFlags#::TFD_CLOEXECrust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFlags]TFD_CLOEXEC. rust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFlags][`BitOr<Self>`]bitor().TimerFlagsrust-analyzer cargo nix 0.30.1 sys/timerfd/TimerFlags#::TFD_NONBLOCKrust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFlags]TFD_NONBLOCK., |
| 57 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 58 |
let mut timer_event = EpollEventrust-analyzer cargo nix 0.30.1 sys/epoll/EpollEvent#::newrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollEvent]new().(EpollFlagsrust-analyzer cargo nix 0.30.1 sys/epoll/EpollFlags#::EPOLLINrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollFlags]EPOLLIN., TIMER_DATArust-analyzer cargo calloop 0.10.5 sys/epoll/TIMER_DATA.); |
| 59 |
epoll_ctlrust-analyzer cargo nix 0.30.1 sys/epoll/epoll_ctl().( |
| 60 |
epoll_fd, |
| 61 |
EpollOprust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#::EpollCtlAddrust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#EpollCtlAdd#, |
| •62 |
timer.as_fdrust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFd][AsFd]as_fd().().as_raw_fdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/owned/impl#[`BorrowedFd<'_>`][AsRawFd]as_raw_fd().(), |
| 63 |
&mut timer_event, |
| 64 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 65 |
timer_fd = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(timer); |
| 66 |
} |
| 67 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Epollrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll# { epoll_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#epoll_fd., timer_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#timer_fd. }) |
| 68 |
} |
| 69 |
|
| 70 |
pub(craterust-analyzer cargo calloop 0.10.5 crate/) fn pollrust-analyzer cargo calloop 0.10.5 sys/epoll/impl#[Epoll]poll().( |
| 71 |
&mut self, |
| 72 |
timeout: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#>, |
| 73 |
) -> craterust-analyzer cargo calloop 0.10.5 crate/::Resultrust-analyzer cargo calloop 0.10.5 error/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PollEventrust-analyzer cargo calloop 0.10.5 sys/PollEvent#>> { |
| 74 |
let mut buffer = [EpollEventrust-analyzer cargo nix 0.30.1 sys/epoll/EpollEvent#::emptyrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollEvent]empty().(); 32]; |
| 75 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref timer) = self.timer_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#timer_fd. { |
| 76 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(timeout) = timeout { |
| 77 |
// Set up the precise timer |
| 78 |
timer.setrust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFd]set().( |
| 79 |
Expirationrust-analyzer cargo nix 0.30.1 sys/time/timer/Expiration#::OneShotrust-analyzer cargo nix 0.30.1 sys/time/timer/Expiration#OneShot#(TimeSpecrust-analyzer cargo nix 0.30.1 sys/time/TimeSpec#::from_durationrust-analyzer cargo nix 0.30.1 sys/time/impl#[TimeSpec]from_duration().(timeout)), |
| 80 |
TimerSetTimeFlagsrust-analyzer cargo nix 0.30.1 sys/time/timer/TimerSetTimeFlags#::emptyrust-analyzer cargo nix 0.30.1 sys/time/timer/impl#[TimerSetTimeFlags]empty().(), |
| 81 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 82 |
} |
| 83 |
} |
| 84 |
// add 1 to the millisecond wait, to round up for timer tracking. If the high precision timer is set up |
| 85 |
// it'll fire before that timeout |
| 86 |
let timeout = timeout.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|d| (d.as_millisrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]as_millis().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u128][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u128][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u128][`Add<Self>`]add().1) as isize).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().1); |
| 87 |
let n_ready = epoll_waitrust-analyzer cargo nix 0.30.1 sys/epoll/epoll_wait().(self.epoll_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#epoll_fd., &mut buffer, timeout)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 88 |
let events = buffer |
| 89 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 90 |
.takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(n_ready) |
| 91 |
.flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|event| { |
| 92 |
if event.datarust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollEvent]data().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().TIMER_DATArust-analyzer cargo calloop 0.10.5 sys/epoll/TIMER_DATA. { |
| 93 |
// We woke up because the high-precision timer fired, we need to disarm it by reading its |
| 94 |
// contents to ensure it will be ready for next time |
| 95 |
// Timer is created in non-blocking mode, and should have already fired anyway, this |
| 96 |
// cannot possibly block |
| 97 |
let _ = self |
| 98 |
.timer_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#timer_fd. |
| 99 |
.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 100 |
.expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("Got an event from high-precision timer while it is not set up?!") |
| 101 |
.waitrust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFd]wait().(); |
| 102 |
// don't forward this event to downstream |
| 103 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 104 |
} else { |
| 105 |
// In C, the underlying data type is a union including a void |
| 106 |
// pointer; in Rust's FFI bindings, it only exposes the u64. The |
| 107 |
// round-trip conversion is valid however. |
| 108 |
let token_ptr = event.datarust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollEvent]data().() as usize as *const Tokenrust-analyzer cargo calloop 0.10.5 sys/Token#; |
| 109 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(PollEventrust-analyzer cargo calloop 0.10.5 sys/PollEvent# { |
| 110 |
readinessrust-analyzer cargo calloop 0.10.5 sys/PollEvent#readiness.: flags_to_readinessrust-analyzer cargo calloop 0.10.5 sys/epoll/flags_to_readiness().(event.eventsrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollEvent]events().()), |
| 111 |
// Why this is safe: it points to memory boxed and owned by |
| 112 |
// the parent Poller type. |
| 113 |
tokenrust-analyzer cargo calloop 0.10.5 sys/PollEvent#token.: unsafe { *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().token_ptr }, |
| 114 |
}) |
| 115 |
} |
| 116 |
}) |
| 117 |
.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 118 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref timer) = self.timer_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#timer_fd. { |
| 119 |
// in all cases, disarm the timer |
| 120 |
timer.unsetrust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFd]unset().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 121 |
// clear the timer in case it fired between epoll_wait and now, as timer is in |
| 122 |
// non-blocking mode, this will return Err(WouldBlock) if it had not fired, so |
| 123 |
// we ignore the error |
| 124 |
let _ = timer.waitrust-analyzer cargo nix 0.30.1 sys/timerfd/impl#[TimerFd]wait().(); |
| 125 |
} |
| 126 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(events) |
| 127 |
} |
| 128 |
|
| 129 |
pub fn registerrust-analyzer cargo calloop 0.10.5 sys/epoll/impl#[Epoll]register().( |
| 130 |
&mut self, |
| 131 |
fd: RawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/RawFd#, |
| 132 |
interest: Interestrust-analyzer cargo calloop 0.10.5 sys/Interest#, |
| 133 |
mode: Moderust-analyzer cargo calloop 0.10.5 sys/Mode#, |
| 134 |
token: *const Tokenrust-analyzer cargo calloop 0.10.5 sys/Token#, |
| 135 |
) -> craterust-analyzer cargo calloop 0.10.5 crate/::Resultrust-analyzer cargo calloop 0.10.5 error/Result#<()> { |
| 136 |
let mut event = EpollEventrust-analyzer cargo nix 0.30.1 sys/epoll/EpollEvent#::newrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollEvent]new().(make_flagsrust-analyzer cargo calloop 0.10.5 sys/epoll/make_flags().(interest, mode), token as usize as u64); |
| 137 |
epoll_ctlrust-analyzer cargo nix 0.30.1 sys/epoll/epoll_ctl().(self.epoll_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#epoll_fd., EpollOprust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#::EpollCtlAddrust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#EpollCtlAdd#, fd, &mut event).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().) |
| 138 |
} |
| 139 |
|
| 140 |
pub fn reregisterrust-analyzer cargo calloop 0.10.5 sys/epoll/impl#[Epoll]reregister().( |
| 141 |
&mut self, |
| 142 |
fd: RawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/RawFd#, |
| 143 |
interest: Interestrust-analyzer cargo calloop 0.10.5 sys/Interest#, |
| 144 |
mode: Moderust-analyzer cargo calloop 0.10.5 sys/Mode#, |
| 145 |
token: *const Tokenrust-analyzer cargo calloop 0.10.5 sys/Token#, |
| 146 |
) -> craterust-analyzer cargo calloop 0.10.5 crate/::Resultrust-analyzer cargo calloop 0.10.5 error/Result#<()> { |
| 147 |
let mut event = EpollEventrust-analyzer cargo nix 0.30.1 sys/epoll/EpollEvent#::newrust-analyzer cargo nix 0.30.1 sys/epoll/impl#[EpollEvent]new().(make_flagsrust-analyzer cargo calloop 0.10.5 sys/epoll/make_flags().(interest, mode), token as usize as u64); |
| 148 |
epoll_ctlrust-analyzer cargo nix 0.30.1 sys/epoll/epoll_ctl().(self.epoll_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#epoll_fd., EpollOprust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#::EpollCtlModrust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#EpollCtlMod#, fd, &mut event).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().) |
| 149 |
} |
| 150 |
|
| 151 |
pub fn unregisterrust-analyzer cargo calloop 0.10.5 sys/epoll/impl#[Epoll]unregister().(&mut self, fd: RawFdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/fd/raw/RawFd#) -> craterust-analyzer cargo calloop 0.10.5 crate/::Resultrust-analyzer cargo calloop 0.10.5 error/Result#<()> { |
| 152 |
epoll_ctlrust-analyzer cargo nix 0.30.1 sys/epoll/epoll_ctl().(self.epoll_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#epoll_fd., EpollOprust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#::EpollCtlDelrust-analyzer cargo nix 0.30.1 sys/epoll/EpollOp#EpollCtlDel#, fd, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().) |
| 153 |
} |
| 154 |
} |
| 155 |
|
| 156 |
impl Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for Epollrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll# { |
| 157 |
fn droprust-analyzer cargo calloop 0.10.5 sys/epoll/impl#[Epoll][Drop]drop().(&mut self) { |
| 158 |
let _ = nixrust-analyzer cargo nix 0.30.1 crate/::unistdrust-analyzer cargo nix 0.30.1 unistd/::closerust-analyzer cargo nix 0.30.1 unistd/close().(self.epoll_fdrust-analyzer cargo calloop 0.10.5 sys/epoll/Epoll#epoll_fd.); |
| 159 |
} |
| 160 |
} |