aboutsummaryrefslogtreecommitdiffstats
path: root/man3
diff options
context:
space:
mode:
Diffstat (limited to 'man3')
-rw-r--r--man3/cmsg.37
1 files changed, 7 insertions, 0 deletions
diff --git a/man3/cmsg.3 b/man3/cmsg.3
index a537a0c69b..060b96fd8c 100644
--- a/man3/cmsg.3
+++ b/man3/cmsg.3
@@ -200,12 +200,19 @@ struct msghdr msg = { 0 };
struct cmsghdr *cmsg;
int myfds[NUM_FD]; /* Contains the file descriptors to pass */
int *fdptr;
+char iobuf[1];
+struct iovec io = {
+ .iov_base = iobuf,
+ .iov_len = sizeof(iobuf)
+};
union { /* Ancillary data buffer, wrapped in a union
in order to ensure it is suitably aligned */
char buf[CMSG_SPACE(sizeof(myfds))];
struct cmsghdr align;
} u;
+msg.msg_iov = &io;
+msg.msg_iovlen = 1;
msg.msg_control = u.buf;
msg.msg_controllen = sizeof(u.buf);
cmsg = CMSG_FIRSTHDR(&msg);