Skip to content
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

reimplement sendmmsg/recvmmsg with better API #1744

Merged
merged 7 commits into from
Oct 14, 2022
Merged

Commits on Oct 14, 2022

  1. socket: stop setting vector length inside read_mhdr

    CMSG_FIRSTHDR/CMSG_NEXTHDR operate in terms of pointers contained
    inside msghdr structure, vector capacity doesn't matter for them.
    
    This would change external behavior of recvmsg/recvmmsg in a sense
    that buffer passed to store controll messages won't have it's length
    updated but intended way to receive control messages is with cmsgs
    iterator on `RecvMsg` which would still work.
    
    This change is required to allow using a single vector to store
    control messages from multiple packets
    pacak committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    482a6b1 View commit details
    Browse the repository at this point in the history
  2. pack_mhdr_to_receive: pass pointer and capacity directly

    This is already an unsafe function, dealing with pointers directly
    does not make it much more unsafe but simplifies lifetimes later on
    and similar to a previous commit allows to alocate a single buffer
    to store all the control messages
    pacak committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    dd1d4fd View commit details
    Browse the repository at this point in the history
  3. pack_mhdr_to_receive: pass iovec ptr and capacity separately

    We'll be using that to reinitialize buffers later
    pacak committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    d600ddd View commit details
    Browse the repository at this point in the history
  4. Update changelog

    pacak committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    7f0fdf2 View commit details
    Browse the repository at this point in the history
  5. reimplement recvmsg/sendmmsg

    New implementation performs no allocations after all the necessary
    structures are created, removes potentially unsound code that
    was used by the old version (see below) and adds a bit more
    documentation about bugs in how timeout is actually handled
    
    ```
        let timeout = if let Some(mut t) = timeout {
            t.as_mut() as *mut libc::timespec
        } else {
            ptr::null_mut()
        };
    ```
    pacak committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    19c83af View commit details
    Browse the repository at this point in the history
  6. disable a flaky test on aarch64

    See nix-rust#1744 for more details
    pacak committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    475819c View commit details
    Browse the repository at this point in the history
  7. include docs

    pacak committed Oct 14, 2022
    Configuration menu
    Copy the full SHA
    d13c2cc View commit details
    Browse the repository at this point in the history