David van Moolenbroek 722cbc6186 VFS: change select(2) semantics for closed filps
If a select(2) call was issued on a file descriptor for which the file
pointer was closed due to invalidation (FILP_CLOSED), typically as the
result of a character/socket driver dying, the call would previously
return with an error: EINTR upon call entry or EIO on invalidation at
at a later time.  Especially the former could severely confuse
applications, which would assume the call was interrupted by a signal,
restart the select call and immediately get EINTR again, ad infinitum.

This patch changes the select(2) semantics such that for closed filps,
the file descriptor is returned as readable and/or writable (depending
on the requested operations), as such letting the entire select call
finish successfully.  Applications will then typically attempt to read
from and/or write to the file descriptor, resulting in an I/O error
that they should generally be better equipped to handle.

This patch also fixes a potential problem with returning early from a
select(2) call if a bad file descriptor is given: previously, in such
cases not all actions taken so far would be undone; now they are.

Change-Id: Ia6581f8789473a8a6c200852fccf552691a17025
2017-03-09 23:39:50 +00:00
2016-01-13 20:32:52 +01:00
2016-01-13 20:32:50 +01:00
2017-03-09 20:04:33 +01:00
2017-02-23 14:08:39 +00:00
2016-10-29 17:08:10 +02:00
2017-02-22 17:17:28 +00:00
2016-01-16 14:04:25 +01:00
2016-09-01 21:16:13 +02:00
2017-03-09 20:04:33 +01:00
2017-02-23 14:08:56 +00:00
2017-02-23 14:08:39 +00:00
Description
A fun microkernel meant to match modern usecases
GPL-3.0 148 MiB
Languages
C 78.2%
Roff 10.2%
Assembly 4.6%
Shell 3.7%
Makefile 1.6%
Other 1.2%