From 997b40622addb1a2a3c1a668d3d542ab0c300de6 Mon Sep 17 00:00:00 2001
From: Dave Bakker
Date: Thu, 1 Feb 2024 15:15:07 +0100
Subject: [PATCH] Require there to be at least one item. Fixes
https://github.com/WebAssembly/wasi-io/issues/67
---
imports.md | 7 +++++--
wit/poll.wit | 5 +++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/imports.md b/imports.md
index 1ae5b12..1eb7047 100644
--- a/imports.md
+++ b/imports.md
@@ -77,8 +77,11 @@ containing only this pollable.
interest, and waits until one or more of the events is ready for I/O.
The result list<u32>
contains one or more indices of handles in the
argument list that is ready for I/O.
-If the list contains more elements than can be indexed with a u32
-value, this function traps.
+This function traps if either:
+
+- the list is empty, or:
+- the list contains more elements than can be indexed with a
u32
value.
+
A timeout can be implemented by adding a pollable from the
wasi-clocks API to the list.
This function does not return a result
; polling in itself does not
diff --git a/wit/poll.wit b/wit/poll.wit
index ddc67f8..8139064 100644
--- a/wit/poll.wit
+++ b/wit/poll.wit
@@ -27,8 +27,9 @@ interface poll {
/// The result `list` contains one or more indices of handles in the
/// argument list that is ready for I/O.
///
- /// If the list contains more elements than can be indexed with a `u32`
- /// value, this function traps.
+ /// This function traps if either:
+ /// - the list is empty, or:
+ /// - the list contains more elements than can be indexed with a `u32` value.
///
/// A timeout can be implemented by adding a pollable from the
/// wasi-clocks API to the list.