sendmsg(3p) and recvmsg(3p)
- Dominant language
- Rust
- Stars
- 1.5k
- Forks
- 132
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 39
Description
The kernel should provide system calls corresponding to [sendmsg(3p)] and [recvmsg(3p)], which are basic operations of the POSIX socket interface.
These functions are usually used with UDP sockets. They are prominently used in [QUIC](https://quicwg.org/).
If I understand correctly, we should be able to implement [send(3p)] on top of [sendto(3p)] on top of [sendmsg(3p)] and [recv(3p)] on top of [recvfrom(3p)] on top of [recvmsg(3p)].
[send(3p)]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/send.html
[sendto(3p)]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/sendto.html
[sendmsg(3p)]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/sendmsg.html
[recv(3p)]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/recv.html
[recvfrom(3p)]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/recvfrom.html
[recvmsg(3p)]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/recvmsg.html
For `struct msghdr`, see [](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html).
Our newlib has stubbed these functions for the mean time:
- https://github.com/hermit-os/newlib/pull/83
### IETF RFCs that list these functions as basic operations
- [RFC 2292 - Advanced Sockets API for IPv6](https://datatracker.ietf.org/doc/html/rfc2292)
- [RFC 6458 - Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)](https://datatracker.ietf.org/doc/html/rfc6458)
- [RFC DRAFT - Sockets API Extensions for In-kernel QUIC Implementations](https://www.ietf.org/archive/id/draft-lxin-quic-socket-apis-00.html)
### Respective functions in the Rust ecosystem
- [`socket2::Socket::sendmsg`](https://docs.rs/socket2/0.5.8/socket2/struct.Socket.html#method.sendmsg)
- [`socket2::Socket::recvmsg`](https://docs.rs/socket2/0.5.8/socket2/struct.Socket.html#method.recvmsg)
- [`nix::sys::socket::sendmsg`](https://docs.rs/nix/0.29.0/nix/sys/socket/fn.sendmsg.html)
- [`nix::sys::socket::recvmsg`](https://docs.rs/nix/0.29.0/nix/sys/socket/fn.recvmsg.html)
- [`tokio_uring::net::UdpSocket::sendmsg`](https://docs.rs/tokio-uring/latest/tokio_uring/net/struct.UdpSocket.html#method.sendmsg)
- [`tokio_uring::net::UdpSocket::recvmsg`](https://docs.rs/tokio-uring/latest/tokio_uring/net/struct.UdpSocket.html#method.recvmsg)
- [`quinn_udp::UdpSocketState::send`](https://docs.rs/quinn-udp/latest/quinn_udp/struct.UdpSocketState.html#method.send)
- [`quinn_udp::UdpSocketState::recv`](https://docs.rs/quinn-udp/latest/quinn_udp/struct.UdpSocketState.html#method.recv)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.