~sircmpwn/hare unlisted

1bae701e502fa4f5ad392a1a269782a08e7ff638 — Drew DeVault 30 days ago 81d4c67
linux::io_uring: add must_get_sqe

Signed-off-by: Drew DeVault <sir@cmpwn.com>
1 files changed, 7 insertions(+), 0 deletions(-)

M linux/io_uring/queue.ha
M linux/io_uring/queue.ha => linux/io_uring/queue.ha +7 -0
@@ 16,6 16,13 @@ export fn get_sqe(ring: *io_uring) nullable *sqe = {
	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;