nix
nix copied to clipboard
`recvmsg` should take `&mut [u8]` instead of `&mut Vec<u8>` for cmsg_buffer
trafficstars
Currently, recvmsg takes a mut cmsg_buffer: Option<&'a mut Vec<u8>> argument. This potentially forces the caller to allocate a right-sized Vec (or keep one around), though recvmsg implementation immediately produces a slice of the vector, and never uses it as a vector.
What's the reason for having Vec on the interface? Could we have a &mut [u8] instead? That'd allow the called to put the buffer onto the stack.