]> git.proxmox.com Git - wasi-libc.git/commit - libc-top-half/musl/include/unistd.h
Avoid calling `poll_oneoff` with zero subscriptions. (#162)
authorDan Gohman <sunfish@mozilla.com>
Tue, 2 Jun 2020 02:00:30 +0000 (19:00 -0700)
committerGitHub <noreply@github.com>
Tue, 2 Jun 2020 02:00:30 +0000 (19:00 -0700)
commit5a7ba74c1959691d79580a1c3f4d94bca94bab8e
tree4588150a08f7f0cd1a88e59bc77957d55ee570ae
parent753cc4344d73bed95d6e784e3fa8d5a5fd21d196
Avoid calling `poll_oneoff` with zero subscriptions. (#162)

* Avoid calling `poll_oneoff` with zero subscriptions.

With https://github.com/WebAssembly/WASI/pull/193 merged, WASI is moving
to make `poll_oneoff` with no arguments an error. Even though that's in
ephemeral and not yet in a snapshot, we can start to anticipate it in
libc:
 - Remove the `pause` function, since WASI has no signals and thus no
   way to ever wake it up short of having the host terminate it.
 - Make `poll` and `pselect` return `ENOTSUP` in the case of having no
   events to wait for.

* Remove `pause` from the defined-symbols.txt list.

* Fix __wasilibc_unmodified_upstream markers.

* Check for zero subscriptions, rather than zero events.

Make `poll` and `pselect` return `ENOTSUP` when asked to poll on zero
subscriptions, rather than when the systerm returns zero events.

While here, drop the `__wasilibc_unmodified_upstream` markers, which
were already pretty noisy here, and would be significantly worse with
this change.

* Add comments about the subtle relationship between nfds and nsubscriptions.

* Rewrite the comment.

* Fix code quotes.
expected/wasm32-wasi/defined-symbols.txt
libc-bottom-half/cloudlibc/src/libc/poll/poll.c
libc-bottom-half/cloudlibc/src/libc/sys/select/pselect.c
libc-bottom-half/sources/pause.c [deleted file]
libc-top-half/musl/include/unistd.h