mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 09:23:25 +00:00
Select should not return ETIME
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
2766d95c18
commit
49eef0c094
@ -52,13 +52,26 @@ pub fn sys_select(
|
|||||||
nfds, readfds, writefds, exceptfds, timeout
|
nfds, readfds, writefds, exceptfds, timeout
|
||||||
);
|
);
|
||||||
|
|
||||||
let num_revents = do_select(
|
let num_revents = match do_select(
|
||||||
nfds,
|
nfds,
|
||||||
readfds.as_mut(),
|
readfds.as_mut(),
|
||||||
writefds.as_mut(),
|
writefds.as_mut(),
|
||||||
exceptfds.as_mut(),
|
exceptfds.as_mut(),
|
||||||
timeout,
|
timeout,
|
||||||
)?;
|
) {
|
||||||
|
Ok(num_revents) => num_revents,
|
||||||
|
Err(e) if e.error() == Errno::ETIME => {
|
||||||
|
// The return value is zero if the timeout expires
|
||||||
|
// before any file descriptors became ready
|
||||||
|
return Ok(SyscallReturn::Return(0));
|
||||||
|
}
|
||||||
|
Err(e) => return Err(e),
|
||||||
|
};
|
||||||
|
|
||||||
|
// FIXME: The Linux select() and pselect6() system call
|
||||||
|
// modifies its timeout argument to reflect the amount of time not slept.
|
||||||
|
// However, the glibc wrapper function hides this behavior.
|
||||||
|
// Maybe we should follow the Linux behavior.
|
||||||
|
|
||||||
let set_fdset = |fdset_addr: Vaddr, fdset: Option<FdSet>| -> Result<()> {
|
let set_fdset = |fdset_addr: Vaddr, fdset: Option<FdSet>| -> Result<()> {
|
||||||
if let Some(fdset) = fdset {
|
if let Some(fdset) = fdset {
|
||||||
|
Reference in New Issue
Block a user