Add all 3 epoll_ctl ops

This commit is contained in:
Jeremy Soller
2019-04-28 11:30:14 -06:00
parent 16083a6020
commit 61dea7f52b
+16 -3
View File
@@ -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;
}
}
}