From 5030322c1e3aebe3f0be0a8acdf149b3e9e01ace Mon Sep 17 00:00:00 2001 From: thesayol Date: Tue, 4 Jun 2024 16:15:49 +0800 Subject: [PATCH] fix a bug for sys_poll and sys_ppoll --- api/ruxos_posix_api/src/imp/io_mpx/poll.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/ruxos_posix_api/src/imp/io_mpx/poll.rs b/api/ruxos_posix_api/src/imp/io_mpx/poll.rs index 2daad9428..595639ef3 100644 --- a/api/ruxos_posix_api/src/imp/io_mpx/poll.rs +++ b/api/ruxos_posix_api/src/imp/io_mpx/poll.rs @@ -24,19 +24,21 @@ fn poll_all(fds: &mut [ctypes::pollfd]) -> LinuxResult { 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) }