Skip to content

Conversation

@sugarraysam
Copy link
Contributor

@sugarraysam sugarraysam commented Sep 19, 2025

Need to expose the SubmitArgs::get_args() getter because I can't implement missing liburing cqe helpers like this one otherwise.

Makes it easier than working directly with sys::io_uring_getevents_arg.

    // Expose missing cqes only enter methods from `liburing`.
    pub fn wait_cqes_timeout(&self, min_complete: u32, timeout: Duration) -> Result<usize> {
        let flags = sys::IORING_ENTER_EXT_ARG | sys::IORING_ENTER_GETEVENTS;

        let ts = types::Timespec::from(timeout);
        let args = types::SubmitArgs::new().timespec(&ts);

        unsafe {
            self.ring
                .submitter()
                .enter(0, to_complete, flags, Some(&args.args)) // <--- private field !!
        }
    }

src/types.rs Outdated

#[inline]
/// Get the args to pass to raw [`Submitter::enter`](super::Submitter::enter) interface.
pub fn get_args(&self) -> &sys::io_uring_getevents_arg {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot expose private types

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is very true. I found another issue after all, where all of the io_uring_enter flags are defined in the sys:: module, but the module is private.

What do you think would be the best way to expose these flags to developers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quininer how about this ? #364

@quininer
Copy link
Member

You can add a repr(transparent) to SubmitArgs , then I think passing SubmitArgs to .enter() will be legal.

@sugarraysam sugarraysam force-pushed the add-submit-args-getter branch from 98a5024 to 0834ae0 Compare September 20, 2025 08:17
@sugarraysam
Copy link
Contributor Author

You can add a repr(transparent) to SubmitArgs , then I think passing SubmitArgs to .enter() will be legal.

Works like a charm ! Fixed and tested:

$ cargo test
$ cargo run -p io-uring-test

@quininer quininer merged commit 8a753aa into tokio-rs:master Sep 24, 2025
17 checks passed
@quininer
Copy link
Member

Thank you!

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