mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Fix bugs with recent change
This change makes further effort towards improving our poll() implementation on the New Technology. The stdin worker didn't work out so well for Python so it's not being used for now. System call tracing with the --strace flag should now be less noisy now on Windows unless you modify the strace.internal.h defines to turn on some optional ones that are most useful for debugging the system call wrappers.
This commit is contained in:
parent
933411ba99
commit
dc0ea6640e
127 changed files with 1354 additions and 866 deletions
|
@ -28,13 +28,35 @@
|
|||
/**
|
||||
* Waits for something to happen on multiple file descriptors at once.
|
||||
*
|
||||
* Warning: XNU has an inconsistency with other platforms. If you have
|
||||
* pollfds with fd≥0 and none of the meaningful events flags are added
|
||||
* e.g. POLLIN then XNU won't check for POLLNVAL. This matters because
|
||||
* one of the use-cases for poll() is quickly checking for open files.
|
||||
*
|
||||
* Note: Polling works best on Windows for sockets. We're able to poll
|
||||
* input on named pipes. But for anything that isn't a socket, or pipe
|
||||
* with POLLIN, (e.g. regular file) then POLLIN/POLLOUT are always set
|
||||
* into revents if they're requested, provided they were opened with a
|
||||
* mode that permits reading and/or writing.
|
||||
*
|
||||
* Note: Windows has a limit of 64 file descriptors and ENOMEM with -1
|
||||
* is returned if that limit is exceeded. In practice the limit is not
|
||||
* this low. For example, pollfds with fd<0 don't count. So the caller
|
||||
* could flip the sign bit with a short timeout, to poll a larger set.
|
||||
*
|
||||
* @param fds[𝑖].fd should be a socket, input pipe, or conosle input
|
||||
* @param fds[𝑖].events flags can have POLLIN, POLLOUT, and POLLPRI
|
||||
* and if it's a negative number then the entry is ignored
|
||||
* @param fds[𝑖].events flags can have POLLIN, POLLOUT, POLLPRI,
|
||||
* POLLRDNORM, POLLWRNORM, POLLRDBAND, POLLWRBAND as well as
|
||||
* POLLERR, POLLHUP, and POLLNVAL although the latter are
|
||||
* always implied (assuming fd≥0) so they're ignored here
|
||||
* @param timeout_ms if 0 means don't wait and -1 means wait forever
|
||||
* @return number of items fds whose revents field has been set to
|
||||
* nonzero to describe its events, or -1 w/ errno
|
||||
* @return fds[𝑖].revents flags can have:
|
||||
* (fds[𝑖].events & POLL{IN,OUT,PRI,HUP,ERR,NVAL})
|
||||
* nonzero to describe its events, or 0 if the timeout elapsed,
|
||||
* or -1 w/ errno
|
||||
* @return fds[𝑖].revents is always zero initializaed and then will
|
||||
* be populated with POLL{IN,OUT,PRI,HUP,ERR,NVAL} if something
|
||||
* was determined about the file descriptor
|
||||
* @asyncsignalsafe
|
||||
* @threadsafe
|
||||
* @norestart
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue