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

Add all 3 epoll_ctl ops

parent 16083a60
No related branches found
No related tags found
No related merge requests found
......@@ -24,20 +24,33 @@ impl PalEpoll for Sys {
fn epoll_ctl(epfd: c_int, op: c_int, fd: c_int, event: *mut epoll_event) -> c_int {
match op {
EPOLL_CTL_ADD => {
EPOLL_CTL_ADD | EPOLL_CTL_MOD => {
Sys::write(
epfd,
&Event {
id: fd as usize,
flags: unsafe { (*event).events as usize },
// NOTE: Danger when using non 64-bit systems. If this is
// needed, use a box or something
data: unsafe { mem::transmute((*event).data) },
},
) as c_int
},
_ => unimplemented!()
EPOLL_CTL_DEL => {
Sys::write(
epfd,
&Event {
id: fd as usize,
flags: 0,
//TODO: Is data required?
data: 0,
},
) as c_int
},
_ => {
platform::errno = errno::EINVAL;
return -1;
}
}
}
......
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