diff --git a/expected/wasm32-wasi-eh/predefined-macros.txt b/expected/wasm32-wasi-eh/predefined-macros.txt index 826a19ac0..efd1ede6d 100644 --- a/expected/wasm32-wasi-eh/predefined-macros.txt +++ b/expected/wasm32-wasi-eh/predefined-macros.txt @@ -2461,7 +2461,7 @@ #define POLLIN POLLRDNORM #define POLLNVAL 0x4000 #define POLLOUT POLLWRNORM -#define POLLPRI POLLIN +#define POLLPRI 0x4 #define POLLRDNORM 0x1 #define POLLWRNORM 0x2 #define POSIX_CLOSE_RESTART 0 @@ -6082,6 +6082,7 @@ #define __WASI_EVENTFDFLAGS_SEMAPHORE ((__wasi_eventfdflags_t)+(1 << 0)) #define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP ((__wasi_eventrwflags_t)+(1 << 0)) #define __WASI_EVENTTYPE_CLOCK (UINT8_C(0)) +#define __WASI_EVENTTYPE_FD_EXCEPT (UINT8_C(3)) #define __WASI_EVENTTYPE_FD_READ (UINT8_C(1)) #define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2)) #define __WASI_FDFLAGSEXT_CLOEXEC ((__wasi_fdflagsext_t)+(1 << 0)) @@ -6125,6 +6126,7 @@ #define __WASI_PROC_SPAWN_FD_OP_NAME_OPEN (UINT8_C(2)) #define __WASI_RIFLAGS_RECV_DATA_TRUNCATED ((__wasi_riflags_t)+(1 << 2)) #define __WASI_RIFLAGS_RECV_DONT_WAIT ((__wasi_riflags_t)+(1 << 3)) +#define __WASI_RIFLAGS_RECV_OOB ((__wasi_riflags_t)+(1 << 4)) #define __WASI_RIFLAGS_RECV_PEEK ((__wasi_riflags_t)+(1 << 0)) #define __WASI_RIFLAGS_RECV_WAITALL ((__wasi_riflags_t)+(1 << 1)) #define __WASI_RIGHTS_FD_ADVISE ((__wasi_rights_t)+(1 << 7)) @@ -6170,6 +6172,7 @@ #define __WASI_SDFLAGS_RD ((__wasi_sdflags_t)+(1 << 0)) #define __WASI_SDFLAGS_WR ((__wasi_sdflags_t)+(1 << 1)) #define __WASI_SIFLAGS_SEND_DONT_WAIT ((__wasi_siflags_t)+(1 << 0)) +#define __WASI_SIFLAGS_SEND_OOB ((__wasi_siflags_t)+(1 << 1)) #define __WASI_SIGNAL_ABRT (UINT8_C(6)) #define __WASI_SIGNAL_ALRM (UINT8_C(14)) #define __WASI_SIGNAL_BUS (UINT8_C(7)) diff --git a/expected/wasm32-wasi-ehpic/predefined-macros.txt b/expected/wasm32-wasi-ehpic/predefined-macros.txt index 8081fbcf5..3eb41e26d 100644 --- a/expected/wasm32-wasi-ehpic/predefined-macros.txt +++ b/expected/wasm32-wasi-ehpic/predefined-macros.txt @@ -2461,7 +2461,7 @@ #define POLLIN POLLRDNORM #define POLLNVAL 0x4000 #define POLLOUT POLLWRNORM -#define POLLPRI POLLIN +#define POLLPRI 0x4 #define POLLRDNORM 0x1 #define POLLWRNORM 0x2 #define POSIX_CLOSE_RESTART 0 @@ -6091,6 +6091,7 @@ #define __WASI_EVENTFDFLAGS_SEMAPHORE ((__wasi_eventfdflags_t)+(1 << 0)) #define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP ((__wasi_eventrwflags_t)+(1 << 0)) #define __WASI_EVENTTYPE_CLOCK (UINT8_C(0)) +#define __WASI_EVENTTYPE_FD_EXCEPT (UINT8_C(3)) #define __WASI_EVENTTYPE_FD_READ (UINT8_C(1)) #define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2)) #define __WASI_FDFLAGSEXT_CLOEXEC ((__wasi_fdflagsext_t)+(1 << 0)) @@ -6134,6 +6135,7 @@ #define __WASI_PROC_SPAWN_FD_OP_NAME_OPEN (UINT8_C(2)) #define __WASI_RIFLAGS_RECV_DATA_TRUNCATED ((__wasi_riflags_t)+(1 << 2)) #define __WASI_RIFLAGS_RECV_DONT_WAIT ((__wasi_riflags_t)+(1 << 3)) +#define __WASI_RIFLAGS_RECV_OOB ((__wasi_riflags_t)+(1 << 4)) #define __WASI_RIFLAGS_RECV_PEEK ((__wasi_riflags_t)+(1 << 0)) #define __WASI_RIFLAGS_RECV_WAITALL ((__wasi_riflags_t)+(1 << 1)) #define __WASI_RIGHTS_FD_ADVISE ((__wasi_rights_t)+(1 << 7)) @@ -6179,6 +6181,7 @@ #define __WASI_SDFLAGS_RD ((__wasi_sdflags_t)+(1 << 0)) #define __WASI_SDFLAGS_WR ((__wasi_sdflags_t)+(1 << 1)) #define __WASI_SIFLAGS_SEND_DONT_WAIT ((__wasi_siflags_t)+(1 << 0)) +#define __WASI_SIFLAGS_SEND_OOB ((__wasi_siflags_t)+(1 << 1)) #define __WASI_SIGNAL_ABRT (UINT8_C(6)) #define __WASI_SIGNAL_ALRM (UINT8_C(14)) #define __WASI_SIGNAL_BUS (UINT8_C(7)) diff --git a/expected/wasm32-wasi-threads/predefined-macros.txt b/expected/wasm32-wasi-threads/predefined-macros.txt index 2c80edec3..acdd763cf 100644 --- a/expected/wasm32-wasi-threads/predefined-macros.txt +++ b/expected/wasm32-wasi-threads/predefined-macros.txt @@ -2357,7 +2357,7 @@ #define POLLIN POLLRDNORM #define POLLNVAL 0x4000 #define POLLOUT POLLWRNORM -#define POLLPRI POLLIN +#define POLLPRI 0x4 #define POLLRDNORM 0x1 #define POLLWRNORM 0x2 #define POSIX_CLOSE_RESTART 0 @@ -5881,6 +5881,7 @@ #define __WASI_EVENTFDFLAGS_SEMAPHORE ((__wasi_eventfdflags_t)(1 << 0)) #define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP ((__wasi_eventrwflags_t)(1 << 0)) #define __WASI_EVENTTYPE_CLOCK (UINT8_C(0)) +#define __WASI_EVENTTYPE_FD_EXCEPT (UINT8_C(3)) #define __WASI_EVENTTYPE_FD_READ (UINT8_C(1)) #define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2)) #define __WASI_FDFLAGS_APPEND ((__wasi_fdflags_t)(1 << 0)) diff --git a/expected/wasm32-wasi/predefined-macros.txt b/expected/wasm32-wasi/predefined-macros.txt index d75a22804..314ea294c 100644 --- a/expected/wasm32-wasi/predefined-macros.txt +++ b/expected/wasm32-wasi/predefined-macros.txt @@ -2461,7 +2461,7 @@ #define POLLIN POLLRDNORM #define POLLNVAL 0x4000 #define POLLOUT POLLWRNORM -#define POLLPRI POLLIN +#define POLLPRI 0x4 #define POLLRDNORM 0x1 #define POLLWRNORM 0x2 #define POSIX_CLOSE_RESTART 0 @@ -6090,6 +6090,7 @@ #define __WASI_EVENTFDFLAGS_SEMAPHORE ((__wasi_eventfdflags_t)+(1 << 0)) #define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP ((__wasi_eventrwflags_t)+(1 << 0)) #define __WASI_EVENTTYPE_CLOCK (UINT8_C(0)) +#define __WASI_EVENTTYPE_FD_EXCEPT (UINT8_C(3)) #define __WASI_EVENTTYPE_FD_READ (UINT8_C(1)) #define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2)) #define __WASI_FDFLAGSEXT_CLOEXEC ((__wasi_fdflagsext_t)+(1 << 0)) @@ -6133,6 +6134,7 @@ #define __WASI_PROC_SPAWN_FD_OP_NAME_OPEN (UINT8_C(2)) #define __WASI_RIFLAGS_RECV_DATA_TRUNCATED ((__wasi_riflags_t)+(1 << 2)) #define __WASI_RIFLAGS_RECV_DONT_WAIT ((__wasi_riflags_t)+(1 << 3)) +#define __WASI_RIFLAGS_RECV_OOB ((__wasi_riflags_t)+(1 << 4)) #define __WASI_RIFLAGS_RECV_PEEK ((__wasi_riflags_t)+(1 << 0)) #define __WASI_RIFLAGS_RECV_WAITALL ((__wasi_riflags_t)+(1 << 1)) #define __WASI_RIGHTS_FD_ADVISE ((__wasi_rights_t)+(1 << 7)) @@ -6178,6 +6180,7 @@ #define __WASI_SDFLAGS_RD ((__wasi_sdflags_t)+(1 << 0)) #define __WASI_SDFLAGS_WR ((__wasi_sdflags_t)+(1 << 1)) #define __WASI_SIFLAGS_SEND_DONT_WAIT ((__wasi_siflags_t)+(1 << 0)) +#define __WASI_SIFLAGS_SEND_OOB ((__wasi_siflags_t)+(1 << 1)) #define __WASI_SIGNAL_ABRT (UINT8_C(6)) #define __WASI_SIGNAL_ALRM (UINT8_C(14)) #define __WASI_SIGNAL_BUS (UINT8_C(7)) diff --git a/expected/wasm64-wasi/predefined-macros.txt b/expected/wasm64-wasi/predefined-macros.txt index 77144a3e1..e10d68aa0 100644 --- a/expected/wasm64-wasi/predefined-macros.txt +++ b/expected/wasm64-wasi/predefined-macros.txt @@ -2403,7 +2403,7 @@ #define POLLIN POLLRDNORM #define POLLNVAL 0x4000 #define POLLOUT POLLWRNORM -#define POLLPRI POLLIN +#define POLLPRI 0x4 #define POLLRDNORM 0x1 #define POLLWRNORM 0x2 #define POSIX_CLOSE_RESTART 0 @@ -5946,6 +5946,7 @@ #define __WASI_EVENTFDFLAGS_SEMAPHORE ((__wasi_eventfdflags_t)(1 << 0)) #define __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP ((__wasi_eventrwflags_t)(1 << 0)) #define __WASI_EVENTTYPE_CLOCK (UINT8_C(0)) +#define __WASI_EVENTTYPE_FD_EXCEPT (UINT8_C(3)) #define __WASI_EVENTTYPE_FD_READ (UINT8_C(1)) #define __WASI_EVENTTYPE_FD_WRITE (UINT8_C(2)) #define __WASI_FDFLAGS_APPEND ((__wasi_fdflags_t)(1 << 0)) diff --git a/libc-bottom-half/cloudlibc/src/libc/poll/poll.c b/libc-bottom-half/cloudlibc/src/libc/poll/poll.c index 3ceb432ca..05c3cacac 100644 --- a/libc-bottom-half/cloudlibc/src/libc/poll/poll.c +++ b/libc-bottom-half/cloudlibc/src/libc/poll/poll.c @@ -9,7 +9,7 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { // Construct events for poll(). - size_t maxevents = 2 * nfds + 1; + size_t maxevents = 3 * nfds + 1; __wasi_subscription_t subscriptions[maxevents]; size_t nsubscriptions = 0; for (size_t i = 0; i < nfds; ++i) { @@ -35,6 +35,15 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { }; created_events = true; } + if ((pollfd->events & POLLPRI) != 0) { + __wasi_subscription_t *subscription = &subscriptions[nsubscriptions++]; + *subscription = (__wasi_subscription_t){ + .userdata = (uintptr_t)pollfd, + .u.tag = __WASI_EVENTTYPE_FD_EXCEPT, + .u.u.fd_read.file_descriptor = pollfd->fd, + }; + created_events = true; + } // As entries are decomposed into separate read/write subscriptions, // we cannot detect POLLERR, POLLHUP and POLLNVAL if POLLRDNORM and @@ -91,7 +100,8 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { for (size_t i = 0; i < nevents; ++i) { const __wasi_event_t *event = &events[i]; if (event->type == __WASI_EVENTTYPE_FD_READ || - event->type == __WASI_EVENTTYPE_FD_WRITE) { + event->type == __WASI_EVENTTYPE_FD_WRITE || + event->type == __WASI_EVENTTYPE_FD_EXCEPT) { struct pollfd *pollfd = (struct pollfd *)(uintptr_t)event->userdata; if (event->error == __WASI_ERRNO_BADF) { // Invalid file descriptor. @@ -103,7 +113,7 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { // Another error occurred. pollfd->revents |= POLLERR; } else { - // Data can be read or written. + // Data can be read or written, or an exceptional condition is pending. if (event->type == __WASI_EVENTTYPE_FD_READ) { pollfd->revents |= POLLRDNORM; if (event->fd_readwrite.flags & __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP) { @@ -114,6 +124,8 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { if (event->fd_readwrite.flags & __WASI_EVENTRWFLAGS_FD_READWRITE_HANGUP) { pollfd->revents |= POLLHUP; } + } else if (event->type == __WASI_EVENTTYPE_FD_EXCEPT) { + pollfd->revents |= POLLPRI; } } } diff --git a/libc-bottom-half/cloudlibc/src/libc/sys/select/pselect.c b/libc-bottom-half/cloudlibc/src/libc/sys/select/pselect.c index d555040e1..d1b722837 100644 --- a/libc-bottom-half/cloudlibc/src/libc/sys/select/pselect.c +++ b/libc-bottom-half/cloudlibc/src/libc/sys/select/pselect.c @@ -18,13 +18,6 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, return -1; } - // This implementation does not support polling for exceptional - // conditions, such as out-of-band data on TCP sockets. - if (errorfds != NULL && errorfds->__nfds > 0) { - errno = ENOSYS; - return -1; - } - // Replace NULL pointers by the empty set. fd_set empty; FD_ZERO(&empty); @@ -32,9 +25,11 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, readfds = ∅ if (writefds == NULL) writefds = ∅ + if (errorfds == NULL) + errorfds = ∅ // Determine the maximum number of events. - size_t maxevents = readfds->__nfds + writefds->__nfds + 1; + size_t maxevents = readfds->__nfds + writefds->__nfds + errorfds->__nfds + 1; __wasi_subscription_t subscriptions[maxevents]; size_t nsubscriptions = 0; @@ -64,6 +59,19 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, } } + // Convert the errorfds set. + for (size_t i = 0; i < errorfds->__nfds; ++i) { + int fd = errorfds->__fds[i]; + if (fd < nfds) { + __wasi_subscription_t *subscription = &subscriptions[nsubscriptions++]; + *subscription = (__wasi_subscription_t){ + .userdata = fd, + .u.tag = __WASI_EVENTTYPE_FD_EXCEPT, + .u.u.fd_read.file_descriptor = fd, + }; + } + } + // Create extra event for the timeout. if (timeout != NULL) { __wasi_subscription_t *subscription = &subscriptions[nsubscriptions++]; @@ -103,7 +111,8 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, for (size_t i = 0; i < nevents; ++i) { const __wasi_event_t *event = &events[i]; if ((event->type == __WASI_EVENTTYPE_FD_READ || - event->type == __WASI_EVENTTYPE_FD_WRITE) && + event->type == __WASI_EVENTTYPE_FD_WRITE || + event->type == __WASI_EVENTTYPE_FD_EXCEPT) && event->error == __WASI_ERRNO_BADF) { errno = EBADF; return -1; @@ -113,13 +122,16 @@ int pselect(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, // Clear and set entries in the result sets. FD_ZERO(readfds); FD_ZERO(writefds); + FD_ZERO(errorfds); for (size_t i = 0; i < nevents; ++i) { const __wasi_event_t *event = &events[i]; if (event->type == __WASI_EVENTTYPE_FD_READ) { readfds->__fds[readfds->__nfds++] = event->userdata; } else if (event->type == __WASI_EVENTTYPE_FD_WRITE) { writefds->__fds[writefds->__nfds++] = event->userdata; + } else if (event->type == __WASI_EVENTTYPE_FD_EXCEPT) { + errorfds->__fds[errorfds->__nfds++] = event->userdata; } } - return readfds->__nfds + writefds->__nfds; + return readfds->__nfds + writefds->__nfds + errorfds->__nfds; } diff --git a/libc-bottom-half/cloudlibc/src/libc/sys/socket/recv.c b/libc-bottom-half/cloudlibc/src/libc/sys/socket/recv.c index e308b1469..0ea766d8c 100644 --- a/libc-bottom-half/cloudlibc/src/libc/sys/socket/recv.c +++ b/libc-bottom-half/cloudlibc/src/libc/sys/socket/recv.c @@ -21,6 +21,7 @@ ssize_t recv(int socket, void *restrict buffer, size_t length, int flags) { if ((flags & MSG_WAITALL) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_WAITALL; } if ((flags & MSG_TRUNC) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_DATA_TRUNCATED; } if ((flags & MSG_DONTWAIT) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_DONT_WAIT; } + if ((flags & MSG_OOB) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_OOB; } // Perform system call. __wasi_size_t ro_datalen; diff --git a/libc-bottom-half/cloudlibc/src/libc/sys/socket/recvfrom.c b/libc-bottom-half/cloudlibc/src/libc/sys/socket/recvfrom.c index c06e1e1b1..d73c787f5 100644 --- a/libc-bottom-half/cloudlibc/src/libc/sys/socket/recvfrom.c +++ b/libc-bottom-half/cloudlibc/src/libc/sys/socket/recvfrom.c @@ -20,6 +20,7 @@ ssize_t recvfrom(int socket, void* buffer, size_t length, int flags, struct sock if ((flags & MSG_WAITALL) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_WAITALL; } if ((flags & MSG_TRUNC) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_DATA_TRUNCATED; } if ((flags & MSG_DONTWAIT) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_DONT_WAIT; } + if ((flags & MSG_OOB) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_OOB; } // Perform system call. __wasi_size_t ro_datalen; diff --git a/libc-bottom-half/cloudlibc/src/libc/sys/socket/recvmsg.c b/libc-bottom-half/cloudlibc/src/libc/sys/socket/recvmsg.c index 74b404ead..ef5738aaa 100644 --- a/libc-bottom-half/cloudlibc/src/libc/sys/socket/recvmsg.c +++ b/libc-bottom-half/cloudlibc/src/libc/sys/socket/recvmsg.c @@ -18,6 +18,7 @@ ssize_t recvmsg(int socket, struct msghdr *restrict msg, int flags) { if ((flags & MSG_WAITALL) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_WAITALL; } if ((flags & MSG_TRUNC) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_DATA_TRUNCATED; } if ((flags & MSG_DONTWAIT) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_DONT_WAIT; } + if ((flags & MSG_OOB) != 0) { ri_flags |= __WASI_RIFLAGS_RECV_OOB; } __wasi_size_t ro_datalen; __wasi_roflags_t ro_flags; diff --git a/libc-bottom-half/cloudlibc/src/libc/sys/socket/send.c b/libc-bottom-half/cloudlibc/src/libc/sys/socket/send.c index 3a2b657a7..89a5d247d 100644 --- a/libc-bottom-half/cloudlibc/src/libc/sys/socket/send.c +++ b/libc-bottom-half/cloudlibc/src/libc/sys/socket/send.c @@ -21,6 +21,7 @@ ssize_t send(int socket, const void *buffer, size_t length, int flags) { __wasi_siflags_t si_flags = 0; if ((flags & MSG_DONTWAIT) != 0) { si_flags |= __WASI_SIFLAGS_SEND_DONT_WAIT; } + if ((flags & MSG_OOB) != 0) { si_flags |= __WASI_SIFLAGS_SEND_OOB; } // Perform system call. __wasi_size_t so_datalen; diff --git a/libc-bottom-half/cloudlibc/src/libc/sys/socket/sendmsg.c b/libc-bottom-half/cloudlibc/src/libc/sys/socket/sendmsg.c index f161afed9..4457f1623 100644 --- a/libc-bottom-half/cloudlibc/src/libc/sys/socket/sendmsg.c +++ b/libc-bottom-half/cloudlibc/src/libc/sys/socket/sendmsg.c @@ -23,6 +23,7 @@ ssize_t sendmsg(int socket, const struct msghdr* msg, int flags) { __wasi_errno_t error; if ((flags & MSG_DONTWAIT) != 0) { si_flags |= __WASI_SIFLAGS_SEND_DONT_WAIT; } + if ((flags & MSG_OOB) != 0) { si_flags |= __WASI_SIFLAGS_SEND_OOB; } if (msg->msg_name == NULL) { error = __wasi_sock_send(socket, si_data, si_data_len, si_flags, &so_datalen); diff --git a/libc-bottom-half/cloudlibc/src/libc/sys/socket/sendto.c b/libc-bottom-half/cloudlibc/src/libc/sys/socket/sendto.c index 8b050d648..72a681159 100644 --- a/libc-bottom-half/cloudlibc/src/libc/sys/socket/sendto.c +++ b/libc-bottom-half/cloudlibc/src/libc/sys/socket/sendto.c @@ -21,6 +21,7 @@ ssize_t sendto(int socket, const void *restrict buffer, size_t length, int flags __wasi_siflags_t si_flags = 0; if ((flags & MSG_DONTWAIT) != 0) { si_flags |= __WASI_SIFLAGS_SEND_DONT_WAIT; } + if ((flags & MSG_OOB) != 0) { si_flags |= __WASI_SIFLAGS_SEND_OOB; } __wasi_addr_port_t peer_addr; __wasi_errno_t error = sockaddr_to_wasi(addr, addrlen, &peer_addr); diff --git a/libc-bottom-half/headers/public/__header_poll.h b/libc-bottom-half/headers/public/__header_poll.h index 23b36f2f2..232fd0864 100644 --- a/libc-bottom-half/headers/public/__header_poll.h +++ b/libc-bottom-half/headers/public/__header_poll.h @@ -6,6 +6,7 @@ #define POLLRDNORM 0x1 #define POLLWRNORM 0x2 +#define POLLPRI 0x4 #define POLLIN POLLRDNORM #define POLLOUT POLLWRNORM diff --git a/libc-bottom-half/headers/public/wasi/api_poly.h b/libc-bottom-half/headers/public/wasi/api_poly.h index 8e8877f5c..37634f40b 100644 --- a/libc-bottom-half/headers/public/wasi/api_poly.h +++ b/libc-bottom-half/headers/public/wasi/api_poly.h @@ -4,6 +4,12 @@ #include #include +/** + * WASIX extension to the preview1 event type namespace. Indicates that a file + * descriptor has an exceptional condition pending, such as TCP urgent data. + */ +#define __WASI_EVENTTYPE_FD_EXCEPT (UINT8_C(3)) + #ifdef _REENTRANT /** * Request a new thread to be created by the host. diff --git a/libc-bottom-half/headers/public/wasi/api_wasix.h b/libc-bottom-half/headers/public/wasi/api_wasix.h index e43aa20c8..40ea1e8b3 100644 --- a/libc-bottom-half/headers/public/wasi/api_wasix.h +++ b/libc-bottom-half/headers/public/wasi/api_wasix.h @@ -765,6 +765,12 @@ typedef uint16_t __wasi_riflags_t; */ #define __WASI_RIFLAGS_RECV_DONT_WAIT ((__wasi_riflags_t)+(1 << 3)) +/** + * Receive out-of-band (urgent) data. Only meaningful for stream sockets + * whose transport supports it (e.g. TCP). + */ +#define __WASI_RIFLAGS_RECV_OOB ((__wasi_riflags_t)+(1 << 4)) + /** * Signal condition. */ @@ -1414,6 +1420,12 @@ typedef uint16_t __wasi_siflags_t; */ #define __WASI_SIFLAGS_SEND_DONT_WAIT ((__wasi_siflags_t)+(1 << 0)) +/** + * Send out-of-band (urgent) data. Only meaningful for stream sockets whose + * transport supports it (e.g. TCP). + */ +#define __WASI_SIFLAGS_SEND_OOB ((__wasi_siflags_t)+(1 << 1)) + /** *** Hidden type typedef uint8_t __wasi_sdflags_t; diff --git a/libc-top-half/musl/include/poll.h b/libc-top-half/musl/include/poll.h index cdd650e2b..cdbd29a21 100644 --- a/libc-top-half/musl/include/poll.h +++ b/libc-top-half/musl/include/poll.h @@ -28,10 +28,6 @@ extern "C" { #endif #else #include <__header_poll.h> -// Poll fulfill. Since there are no important polls -// we identify all Important as normals -#define POLLPRI POLLIN -#define EPOLLPRI EPOLLIN #endif #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */ diff --git a/result b/result new file mode 120000 index 000000000..d025da318 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/jpajkzk1isciic6887rwizv26ssi1j5q-subxt-0.50.3 \ No newline at end of file diff --git a/tools/wasix-headers/WASI b/tools/wasix-headers/WASI index 0dfbd35a0..b7f2529fe 160000 --- a/tools/wasix-headers/WASI +++ b/tools/wasix-headers/WASI @@ -1 +1 @@ -Subproject commit 0dfbd35a0f30f3fe7fd3b3ab5a50dc4191d5caed +Subproject commit b7f2529fe762eb2f83127f5374a0018292499a2b