changeset 2127:5cb49f75e512 HEAD

Solaris fix by Tim Hurman
author Timo Sirainen <tss@iki.fi>
date Tue, 15 Jun 2004 02:42:23 +0300
parents 57078e1f2bfc
children 2da965864bc4
files src/lib/fdpass.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/fdpass.c	Tue Jun 15 02:35:17 2004 +0300
+++ b/src/lib/fdpass.c	Tue Jun 15 02:42:23 2004 +0300
@@ -31,12 +31,20 @@
 #include <sys/uio.h>
 
 #ifndef CMSG_SPACE
-#  define CMSG_ALIGN(len) \
+#  if defined(_CMSG_DATA_ALIGN) && defined(_CMSG_HDR_ALIGN)  /* for Solaris */
+#    define CMSG_ALIGN(len) _CMSG_DATA_ALIGN(len)
+#    define CMSG_SPACE(len) \
+	(_CMSG_DATA_ALIGN(len) + _CMSG_HDR_ALIGN(sizeof(struct cmsghdr)))
+#    define CMSG_LEN(len) \
+	(_CMSG_HDR_ALIGN(sizeof(struct cmsghdr)) + (len))
+#  else
+#    define CMSG_ALIGN(len) \
 	(((len) + sizeof(size_t) - 1) & ~(sizeof(size_t) - 1))
-#  define CMSG_SPACE(len) \
+#    define CMSG_SPACE(len) \
 	(CMSG_ALIGN(len) + CMSG_ALIGN(sizeof(struct cmsghdr)))
-#  define CMSG_LEN(len) \
+#    define CMSG_LEN(len) \
 	(CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+#  endif
 #endif
 
 #ifdef SCM_RIGHTS