From 84a8cdb37b84c0804ffaedbbbd4c37c785d0ab61 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 18 May 2021 18:15:40 -0400 Subject: [PATCH] linux::io_uring: add must_get_sqe Signed-off-by: Drew DeVault --- io_uring/queue.ha | 7 +++++++ diff --git a/io_uring/queue.ha b/io_uring/queue.ha index db43998643dab79581a255a1f75748b328b0877b..6e7cc1d5462746c0d487341e1d498cba38930534 100644 --- a/io_uring/queue.ha +++ b/io_uring/queue.ha @@ -16,6 +16,13 @@ }; return null; }; +// Returns the next available [[sqe]] for this [[io_uring]], or aborts the +// program if the queue is full. +export fn must_get_sqe(ring: *io_uring) *sqe = match (get_sqe(ring)) { + null => abort("I/O queue full"), + sq: *sqe => sq, +}; + fn needs_enter(ring: *io_uring, flags: *enter_flags) bool = { if (ring.flags & setup_flags::IOPOLL == setup_flags::IOPOLL) { return true; -- 2.48.1