From a3e5c9b263775d6955dd3eccfb0e8931346f48c4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 20 Jul 2023 18:45:55 -0700 Subject: [PATCH] use explicit error set for io_uring --- src/backend/io_uring.zig | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/io_uring.zig b/src/backend/io_uring.zig index 1ffc3f3..b3985b5 100644 --- a/src/backend/io_uring.zig +++ b/src/backend/io_uring.zig @@ -159,9 +159,25 @@ pub const Loop = struct { } } + /// The errors that can come from submit. This has to be explicit + /// for now since Zig 0.11 has issues with the inferred error set. + /// We should try again someday. + pub const SubmitError = error{ + Unexpected, + SystemResources, + FileDescriptorInvalid, + FileDescriptorInBadState, + CompletionQueueOvercommitted, + SubmissionQueueEntryInvalid, + BufferInvalid, + RingShuttingDown, + OpcodeNotSupported, + SignalInterrupt, + }; + /// Submit all queued operations. This never does an io_uring submit /// and wait operation. - pub fn submit(self: *Loop) !void { + pub fn submit(self: *Loop) SubmitError!void { _ = try self.ring.submit(); // If we have any submissions that failed to submit, we try to