Skip to content

[skip ci] Revert signature simplification of sendmmsg and recvmmsg #2167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Jan561
Copy link
Contributor

@Jan561 Jan561 commented Oct 8, 2023

Changes the Iterator Item of XS of recvmmsg back to Item = &'a mut AsMut<I> and of sendmmsg back to Item = &'a AsRef<I>.

This partially reverts #2120. Short explanation using recvmmsg:

pub fn recvmmsg<'a, XS, S, I>(
    // elided...
    slices: XS,
) -> crate::Result<MultiResults<'a, S>>
where
    XS: IntoIterator<Item = I>,
    I: AsMut<[IoSliceMut<'a>]>,
{
    for (i, (slice, mmsghdr)) in slices.into_iter().zip(data.items.iter_mut()).enumerate() {
        let p = &mut mmsghdr.msg_hdr;
        p.msg_iov = slice.as_mut().as_mut_ptr().cast();
        p.msg_iovlen = slice.as_mut().len() as _;
        
        // `slice` gets dropped here! If `slice` was not a pointer, `p.msg_iov` could be dangling now!
    }

    // elided ...
}

CI build: https://cirrus-ci.com/build/6131779443097600 (I'll update this if the commit changes)

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@Jan561 Jan561 changed the title [skip ci] Revert signature change of sendmmsg and recvmmsg [skip ci] Revert signature simplification of sendmmsg and recvmmsg Oct 8, 2023
@Jan561 Jan561 closed this Nov 14, 2023
@Jan561 Jan561 deleted the mmsg_fix branch November 14, 2023 17:06
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.

1 participant