This is in preparation of adding fd-passing to messaging.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May 30 02:28:15 CEST 2014 on sn-devel-104
{
struct unix_dgram_ctx *ctx = (struct unix_dgram_ctx *)private_data;
ssize_t received;
+ struct msghdr msg;
+ struct iovec iov;
+
+ iov = (struct iovec) {
+ .iov_base = (void *)ctx->recv_buf,
+ .iov_len = ctx->max_msg,
+ };
+
+ msg = (struct msghdr) {
+ .msg_iov = &iov,
+ .msg_iovlen = 1,
+ .msg_control = NULL,
+ .msg_controllen = 0,
+ };
- received = recv(fd, ctx->recv_buf, ctx->max_msg, 0);
+ received = recvmsg(fd, &msg, 0);
if (received == -1) {
if ((errno == EAGAIN) ||
#ifdef EWOULDBLOCK