sendmsg takes a const struct msghdr *, so it can't write to the struct msghdr itself. struct msghdr contains a non-const pointer to struct iovec. Theoretically, sendmsg could write to the struct iovec and the buffers these iovec point to.
It seems like sendmsg never writes to these data buffers, but is this guaranteed somewhere?
Additionally, can the ancillary data (control data) be written to during sendmsg? It seems like SCM_RIGHTS and SCM_CREDENTIALS don't write to control data during sendmsg, but could there be other ancillary message types that do so?
Background is that Nightly Rust has send_vectored_with_ancillary_to, a safe abstraction for sendmsg. Rust distinguishes mutable (non-const) and non-mutable (const) data. Currently, it assumes that sendmsg data is mutable, but I think these buffers should be non-mutable instead.