hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit c5c9138b05c5495f73aaf6734bf594ec1e710016
parent 78a14ed9397f5fb8ae48cc26695e7610edb993ff
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 22 Oct 2021 09:38:22 +0200

iobus: add error handling for register_file

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Miobus/io_uring/bus.ha | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/iobus/io_uring/bus.ha b/iobus/io_uring/bus.ha @@ -97,12 +97,12 @@ fn _dispatch(bus: *bus) (result | error) = { // Registers a file with the iobus, returning a [[registered_file]] object to // use for I/O operations. It is not necessary to register files to use them for // I/O, but it improves performance if you do. -export fn register_file(bus: *bus, file: io::file) registered_file = { +export fn register_file(bus: *bus, file: io::file) (registered_file | error) = { let registered: int = if (bus.lastfd >= len(bus.fdset)) { static const init: [256]int = [-1...]; append(bus.fdset, init...); bus.fdset[bus.lastfd] = file; - io_uring::register_files(&bus.uring, bus.fdset)!; + io_uring::register_files(&bus.uring, bus.fdset)?; yield bus.lastfd: int; } else { let updates = [ @@ -113,7 +113,7 @@ export fn register_file(bus: *bus, file: io::file) registered_file = { }, ]; bus.fdset[bus.lastfd] = file; - io_uring::register_files_update(&bus.uring, updates)!; + io_uring::register_files_update(&bus.uring, updates)?; yield bus.lastfd: int; }; for (bus.fdset[bus.lastfd] != -1; bus.lastfd += 1) void;