This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function
pubfnenter(self: *IoUring, to_submit: u32, min_complete: u32, flags: u32) !u32 {
assert(self.fd >= 0);
constres = linux.io_uring_enter(self.fd, to_submit, min_complete, flags, null);
switch (linux.errno(res)) {
.SUCCESS => {},
// The kernel was unable to allocate memory or ran out of resources for the request.// The application should wait for some completions and try again:
.AGAIN => returnerror.SystemResources,
// The SQE `fd` is invalid, or IOSQE_FIXED_FILE was set but no files were registered:
.BADF => returnerror.FileDescriptorInvalid,
// The file descriptor is valid, but the ring is not in the right state.// See io_uring_register(2) for how to enable the ring.
.BADFD => returnerror.FileDescriptorInBadState,
// The application attempted to overcommit the number of requests it can have pending.// The application should wait for some completions and try again:
.BUSY => returnerror.CompletionQueueOvercommitted,
// The SQE is invalid, or valid but the ring was setup with IORING_SETUP_IOPOLL:
.INVAL => returnerror.SubmissionQueueEntryInvalid,
// The buffer is outside the process' accessible address space, or IORING_OP_READ_FIXED// or IORING_OP_WRITE_FIXED was specified but no buffers were registered, or the range// described by `addr` and `len` is not within the buffer registered at `buf_index`:
.FAULT => returnerror.BufferInvalid,
.NXIO => returnerror.RingShuttingDown,
// The kernel believes our `self.fd` does not refer to an io_uring instance,// or the opcode is valid but not supported by this kernel (more likely):
.OPNOTSUPP => returnerror.OpcodeNotSupported,
// The thread submitting the work is invalid. This may occur if IORING_ENTER_GETEVENTS// and IORING_SETUP_DEFER_TASKRUN is set, but the submitting thread is not the thread// that initially created or enabled the io_uring associated with fd.
.EXIST => returnerror.InvalidThread,
// The operation was interrupted by a delivery of a signal before it could complete.// This can happen while waiting for events with IORING_ENTER_GETEVENTS:
.INTR => returnerror.SignalInterrupt,
else => |errno| returnposix.unexpectedErrno(errno),
}
return@as(u32, @intCast(res));
}
Tell the kernel we have submitted SQEs and/or want to wait for CQEs. Returns the number of SQEs submitted.