Fix a bug in poll's handling of input pollfds
This commit is contained in:
parent
554f7dd2c5
commit
5b6d06b808
@ -200,17 +200,12 @@ impl EventMonitorBuilder {
|
||||
}
|
||||
|
||||
pub fn add_file(&mut self, file: FileRef, events: IoEvents) {
|
||||
let host_file_idx = if file.host_fd().is_some() {
|
||||
Some(self.files_and_events.len())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
self.files_and_events.push((file, events));
|
||||
|
||||
if let Some(host_file_idx) = host_file_idx {
|
||||
if file.host_fd().is_some() {
|
||||
let host_file_idx = self.files_and_events.len();
|
||||
self.host_file_idxes.push(host_file_idx);
|
||||
}
|
||||
|
||||
self.files_and_events.push((file, events));
|
||||
}
|
||||
|
||||
fn init_ocall_pollfds(&mut self) {
|
||||
|
@ -13,6 +13,12 @@ mod event_monitor;
|
||||
pub fn do_poll_new(poll_fds: &[PollFd], mut timeout: Option<&mut Duration>) -> Result<usize> {
|
||||
debug!("poll: poll_fds: {:?}, timeout: {:?}", poll_fds, timeout);
|
||||
|
||||
// Always clear the revents fields first
|
||||
for poll_fd in poll_fds {
|
||||
poll_fd.revents.set(IoEvents::empty());
|
||||
}
|
||||
|
||||
// Map poll_fds to FileRef's
|
||||
let thread = current!();
|
||||
let files: Vec<FileRef> = poll_fds
|
||||
.iter()
|
||||
|
Loading…
Reference in New Issue
Block a user