Skip to content
Snippets Groups Projects
Verified Commit 8ab61e3d authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Convert syscall events to EPOLL events

parent 0f5e6a56
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,20 @@ fn epoll_to_event_flags(epoll: c_uint) -> syscall::EventFlags { ...@@ -34,6 +34,20 @@ fn epoll_to_event_flags(epoll: c_uint) -> syscall::EventFlags {
event_flags event_flags
} }
fn event_flags_to_epoll(flags: syscall::EventFlags) -> c_uint {
let mut epoll = 0;
if flags.contains(syscall::EventFlags::EVENT_READ) {
epoll |= EPOLLIN;
}
if flags.contains(syscall::EventFlags::EVENT_WRITE) {
epoll |= EPOLLOUT;
}
epoll
}
impl PalEpoll for Sys { impl PalEpoll for Sys {
fn epoll_create1(flags: c_int) -> c_int { fn epoll_create1(flags: c_int) -> c_int {
Sys::open(c_str!("event:"), O_RDWR | flags, 0) Sys::open(c_str!("event:"), O_RDWR | flags, 0)
...@@ -153,7 +167,7 @@ impl PalEpoll for Sys { ...@@ -153,7 +167,7 @@ impl PalEpoll for Sys {
} }
} }
*target_ptr = epoll_event { *target_ptr = epoll_event {
events: event.flags.bits() as _, events: event_flags_to_epoll(event.flags),
data: epoll_data { data: epoll_data {
u64: event.data as u64, u64: event.data as u64,
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment