diff --git a/kernel/aster-nix/src/syscall/poll.rs b/kernel/aster-nix/src/syscall/poll.rs index ad377819e..340036569 100644 --- a/kernel/aster-nix/src/syscall/poll.rs +++ b/kernel/aster-nix/src/syscall/poll.rs @@ -100,7 +100,15 @@ pub fn do_poll(poll_fds: &[PollFd], timeout: Option) -> Result } if let Some(timeout) = timeout.as_ref() { - poller.wait_timeout(timeout)?; + match poller.wait_timeout(timeout) { + Ok(_) => {} + Err(e) if e.error() == Errno::ETIME => { + // The return value is zero if the timeout expires + // before any file descriptors became ready + return Ok(0); + } + Err(e) => return Err(e), + }; } else { poller.wait()?; }