mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Rewrite Windows poll()
We can now await signals, files, pipes, and console simultaneously. This change also gives a deeper review and testing to changes made yesterday.
This commit is contained in:
parent
cceddd21b2
commit
fbdf9d028c
15 changed files with 425 additions and 191 deletions
|
@ -90,8 +90,11 @@
|
|||
* was determined about the file descriptor
|
||||
* @param timeout if null will block indefinitely
|
||||
* @param sigmask may be null in which case no mask change happens
|
||||
* @raise E2BIG if we exceeded the 64 socket limit on Windows
|
||||
* @raise EINVAL if we exceeded the 64 socket limit on Windows
|
||||
* @raise ECANCELED if thread was cancelled in masked mode
|
||||
* @raise EINVAL if `nfds` exceeded `RLIMIT_NOFILE`
|
||||
* @raise ENOMEM on failure to allocate memory
|
||||
* @raise EINVAL if `*timeout` is invalid
|
||||
* @raise EINTR if signal was delivered
|
||||
* @cancelationpoint
|
||||
* @asyncsignalsafe
|
||||
|
@ -104,6 +107,10 @@ int ppoll(struct pollfd *fds, size_t nfds, const struct timespec *timeout,
|
|||
struct timespec ts, *tsp;
|
||||
BEGIN_CANCELATION_POINT;
|
||||
|
||||
// validate timeout
|
||||
if (timeout && timeout->tv_nsec >= 1000000000)
|
||||
return einval();
|
||||
|
||||
// The OpenBSD poll() man pages claims it'll ignore POLLERR, POLLHUP,
|
||||
// and POLLNVAL in pollfd::events except it doesn't actually do this.
|
||||
size_t bytes = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue