Skip to content

fix(driver,unix): add some control API usages#832

Merged
Berrysoft merged 4 commits intocompio-rs:masterfrom
Berrysoft:fix/unix-control
Apr 6, 2026
Merged

fix(driver,unix): add some control API usages#832
Berrysoft merged 4 commits intocompio-rs:masterfrom
Berrysoft:fix/unix-control

Conversation

@Berrysoft
Copy link
Copy Markdown
Member

I don't know why they were forgotten last time.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Unix socket send/recv ops in the polling and io-uring backends to use the shared *MsgControl control structures (holding msghdr + iovecs) so self-referential msghdr state lives in OpCode::Control rather than on the op itself.

Changes:

  • Refactors poll-based recvmsg/sendmsg vectored ops to build and use SendMsgControl during init, and captures msg_namelen into the op result state.
  • Refactors io-uring RecvFrom*/SendTo* ops to create RecvMsgControl/SendMsgControl controls up-front and plumb them into create_entry, with name_len tracked on completion.
  • Refactors io-uring managed RecvFromManaged to move msghdr/iovec into a dedicated control type.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
compio-driver/src/sys/poll/op.rs Switches poll-based vectored send/recv-from ops to use SendMsgControl control state.
compio-driver/src/sys/iour/op/mod.rs Switches io-uring send-to/recv-from ops to build *MsgControl in init and use it in create_entry.
compio-driver/src/sys/iour/op/managed.rs Moves RecvFromManaged’s msghdr/iovec into Control to support control API usage with buffer selection.
Comments suppressed due to low confidence (1)

compio-driver/src/sys/iour/op/managed.rs:233

  • RecvFromManaged::new no longer validates the requested len (previously rejected values that don’t fit expected limits). Other managed ops in this module still return InvalidInput when len is too large (e.g. RecvManaged). Consider restoring a bounds check (at least rejecting values that don’t fit the underlying io-uring / buffer-pool constraints) to keep API behavior consistent and avoid kernel EINVALs for oversized iov lengths.
impl<S> RecvFromManaged<S> {
    /// Create [`RecvFromManaged`].
    pub fn new(fd: S, buffer_pool: &BufferPool, len: usize, flags: i32) -> io::Result<Self> {
        let addr = SockAddrStorage::zeroed();
        Ok(Self {
            fd,
            buffer_group: buffer_pool.buffer_group()?,
            flags,
            name_len: 0,
            buffer_len: len,
            addr,
            buffer_pool: buffer_pool.clone(),
            buffer: None,
        })
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Berrysoft Berrysoft requested a review from George-Miao April 3, 2026 15:30
@Berrysoft Berrysoft added driver: io-uring About the io-uring driver driver: polling About the polling driver labels Apr 3, 2026
@Berrysoft Berrysoft enabled auto-merge April 5, 2026 05:33
Copy link
Copy Markdown
Member

@George-Miao George-Miao left a comment

Choose a reason for hiding this comment

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

LGTM

@Berrysoft Berrysoft added this pull request to the merge queue Apr 6, 2026
Merged via the queue into compio-rs:master with commit cf7c095 Apr 6, 2026
66 checks passed
@Berrysoft Berrysoft deleted the fix/unix-control branch April 6, 2026 18:50
@github-actions github-actions bot mentioned this pull request Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

driver: io-uring About the io-uring driver driver: polling About the polling driver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants