.\" %%%LICENSE_END
.\"
.\" $Id: cmsg.3,v 1.8 2000/12/20 18:10:31 ak Exp $
-.TH CMSG 3 2008-11-20 "Linux" "Linux Programmer's Manual"
+.TH CMSG 3 2014-12-31 "Linux" "Linux Programmer's Manual"
.SH NAME
CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- access ancillary data
.SH SYNOPSIS
.IR msghdr .
.SH CONFORMING TO
This ancillary data model conforms to the POSIX.1g draft, 4.4BSD-Lite,
-the IPv6 advanced API described in RFC\ 2292 and the SUSv2.
+the IPv6 advanced API described in RFC\ 2292 and SUSv2.
.BR CMSG_ALIGN ()
is a Linux extension.
.SH NOTES
struct msghdr msg = {0};
struct cmsghdr *cmsg;
int myfds[NUM_FD]; /* Contains the file descriptors to pass. */
-char buf[CMSG_SPACE(sizeof myfds)]; /* ancillary data buffer */
+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;
int *fdptr;
-msg.msg_control = buf;
-msg.msg_controllen = sizeof buf;
+msg.msg_control = u.buf;
+msg.msg_controllen = sizeof u.buf;
cmsg = CMSG_FIRSTHDR(&msg);
cmsg\->cmsg_level = SOL_SOCKET;
cmsg\->cmsg_type = SCM_RIGHTS;
.PP
RFC\ 2292
.SH COLOPHON
-This page is part of release 3.64 of the Linux
+This page is part of release 3.79 of the Linux
.I man-pages
project.
A description of the project,
-and information about reporting bugs,
+information about reporting bugs,
+and the latest version of this page,
can be found at
\%http://www.kernel.org/doc/man\-pages/.