Add support for monitoring epoll fds with epoll
This commit is contained in:
parent
25350b0e85
commit
1c707eda30
@ -97,6 +97,12 @@ impl EpollFile {
|
|||||||
socket.fd()
|
socket.fd()
|
||||||
} else if let Ok(eventfd) = fd_ref.as_event() {
|
} else if let Ok(eventfd) = fd_ref.as_event() {
|
||||||
eventfd.get_host_fd()
|
eventfd.get_host_fd()
|
||||||
|
} else if let Ok(epoll_file) = fd_ref.as_epfile() {
|
||||||
|
let target_host_fd = epoll_file.get_host_fd();
|
||||||
|
if self.host_fd == target_host_fd {
|
||||||
|
return_errno!(EINVAL, "epfd should not be same as the target fd");
|
||||||
|
}
|
||||||
|
target_host_fd
|
||||||
} else {
|
} else {
|
||||||
return_errno!(EPERM, "unsupported file type");
|
return_errno!(EPERM, "unsupported file type");
|
||||||
}
|
}
|
||||||
@ -145,6 +151,10 @@ impl EpollFile {
|
|||||||
|
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_host_fd(&self) -> c_int {
|
||||||
|
self.host_fd
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for EpollFile {
|
impl Drop for EpollFile {
|
||||||
|
Loading…
Reference in New Issue
Block a user