nix icon indicating copy to clipboard operation
nix copied to clipboard

`recvmsg` should take `&mut [u8]` instead of `&mut Vec<u8>` for cmsg_buffer

Open erenon opened this issue 1 year ago • 1 comments
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.

erenon avatar Oct 21 '24 12:10 erenon