authorgravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-10-03 14:34:01+02:00
committergravatar for joran@ronomon.comJoran Dirk Greef <joran@ronomon.com> 2020-10-03 14:34:01+02:00
log95def89c232acc53c926731fe5143ea093128d73
tree6f238176f31c5b37730007f3f86ee073595b03a2
parent5f99d2c2407a057e0b239c19189c9e1a36fb1c0f

Handle EBADFD (ring fd in bad state) in enter()


1 files changed, 7 insertions(+), 4 deletions(-)

lib/std/os/linux/io_uring.zig+7-4
...@@ -192,17 +192,20 @@ pub const IO_Uring = struct {...@@ -192,17 +192,20 @@ pub const IO_Uring = struct {
192 // The kernel was unable to allocate memory or ran out of resources for the request.192 // The kernel was unable to allocate memory or ran out of resources for the request.
193 // The application should wait for some completions and try again:193 // The application should wait for some completions and try again:
194 linux.EAGAIN => return error.SystemResources,194 linux.EAGAIN => return error.SystemResources,
195 // The SQE `fd` is invalid, or IOSQE_FIXED_FILE was set but no files were registered:
196 linux.EBADF => return error.FileDescriptorInvalid,
197 // The file descriptor is valid, but the ring is not in the right state.
198 // See io_uring_register(2) for how to enable the ring.
199 linux.EBADFD => return error.FileDescriptorInBadState,
195 // The application attempted to overcommit the number of requests it can have pending.200 // The application attempted to overcommit the number of requests it can have pending.
196 // The application should wait for some completions and try again:201 // The application should wait for some completions and try again:
197 linux.EBUSY => return error.CompletionQueueOvercommitted,202 linux.EBUSY => return error.CompletionQueueOvercommitted,
198 // The SQE `fd` is invalid, or IOSQE_FIXED_FILE was set but no files were registered:203 // The SQE is invalid, or valid but the ring was setup with IORING_SETUP_IOPOLL:
199 linux.EBADF => return error.FileDescriptorInvalid,204 linux.EINVAL => return error.SubmissionQueueEntryInvalid,
200 // The buffer is outside the process' accessible address space, or IORING_OP_READ_FIXED205 // The buffer is outside the process' accessible address space, or IORING_OP_READ_FIXED
201 // or IORING_OP_WRITE_FIXED was specified but no buffers were registered, or the range206 // or IORING_OP_WRITE_FIXED was specified but no buffers were registered, or the range
202 // described by `addr` and `len` is not within the buffer registered at `buf_index`:207 // described by `addr` and `len` is not within the buffer registered at `buf_index`:
203 linux.EFAULT => return error.BufferInvalid,208 linux.EFAULT => return error.BufferInvalid,
204 // The SQE is invalid, or valid but the ring was setup with IORING_SETUP_IOPOLL:
205 linux.EINVAL => return error.SubmissionQueueEntryInvalid,
206 linux.ENXIO => return error.RingShuttingDown,209 linux.ENXIO => return error.RingShuttingDown,
207 // The kernel believes our `self.fd` does not refer to an io_uring instance,210 // The kernel believes our `self.fd` does not refer to an io_uring instance,
208 // or the opcode is valid but not supported by this kernel (more likely):211 // or the opcode is valid but not supported by this kernel (more likely):