OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / cmsg.3
index d327a55..279c449 100644 (file)
@@ -8,7 +8,7 @@
 .\" %%%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
@@ -140,7 +140,7 @@ member of the
 .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
@@ -198,11 +198,16 @@ UNIX domain socket using
 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;
@@ -220,10 +225,11 @@ msg.msg_controllen = cmsg\->cmsg_len;
 .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/.