Skip to content

Commit

Permalink
Merge pull request #122 from TheSayOL/fix_poll
Browse files Browse the repository at this point in the history
fix a bug for sys_poll and sys_ppoll
  • Loading branch information
coolyjg authored Jun 6, 2024
2 parents 027391d + 5030322 commit f841b85
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/ruxos_posix_api/src/imp/io_mpx/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@ fn poll_all(fds: &mut [ctypes::pollfd]) -> LinuxResult<usize> {
Err(_) => {
if (events & ctypes::EPOLLERR as i16) != 0 {
*revents |= ctypes::EPOLLERR as i16;
events_num += 1;
}
}
Ok(state) => {
if state.readable && (events & ctypes::EPOLLIN as i16 != 0) {
*revents |= ctypes::EPOLLIN as i16;
events_num += 1;
}

if state.writable && (events & ctypes::EPOLLOUT as i16 != 0) {
*revents |= ctypes::EPOLLOUT as i16;
events_num += 1;
}
}
}
events_num += 1;
}
Ok(events_num)
}
Expand Down

0 comments on commit f841b85

Please sign in to comment.