Skip to content

Conversation

@asayers
Copy link

@asayers asayers commented Dec 15, 2025

The following text is found in many io_uring man pages:

Note that where synchronous system calls will return -1 on failure
and set errno to the actual error value, io_uring never uses errno.
Instead it returns the negated errno directly in the CQE res field.

My understanding is that a negative value in the res field is always a negated errno. Converting negative values to io::Error removes a footgun, and is often more convenient. You can recover the original errno with Error::raw_os_error().

(This is a backport of jordanisaacs/rustix-uring#11 and jordanisaacs/rustix-uring#15)

Quick access to the raw i32 is still possible via the `raw_result()`
method.  The same change is applied to `Entry32` to keep the APIs
in-sync.
@quininer
Copy link
Member

I don't reject this, but it would be a break change. would you can to add another method that returns io::Result? like io_result(self) -> io::Result<u32>

@asayers
Copy link
Author

asayers commented Dec 15, 2025

Yes, that's probably a good idea. io_result() works; but I wonder if there's something shorter we could use?

@quininer
Copy link
Member

Of course, you can consider a better name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants