changeset 2253:509923906599 HEAD

added comment about solaris and changed the macros once again, although may be useless change..
author Timo Sirainen <tss@iki.fi>
date Tue, 29 Jun 2004 15:10:36 +0300
parents 54c3bc549e34
children 4b24a962ef89
files src/lib/fdpass.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/fdpass.c	Tue Jun 29 12:29:55 2004 +0300
+++ b/src/lib/fdpass.c	Tue Jun 29 15:10:36 2004 +0300
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2003 Timo Sirainen */
+/* Copyright (c) 2002-2004 Timo Sirainen */
 
 /*
    fdpass.c - File descriptor passing between processes via UNIX sockets
@@ -30,10 +30,15 @@
 #include <sys/un.h>
 #include <sys/uio.h>
 
+/* Solaris uses 32bit socklen_t as cmsg_len, so with Solaris we use
+   _CMSG_DATA_ALIGN() macro to do the alignment for us.
+
+   Perhaps the best solution would be to change sizeof(size_t) calculations
+   to sizeof(cmsg->cmsg_len)? At least if other OSes have similiar problems.. */
 #ifndef CMSG_SPACE
 #  if defined(_CMSG_DATA_ALIGN) && defined(_CMSG_HDR_ALIGN)  /* for Solaris */
 #    define CMSG_SPACE(len) \
-	(_CMSG_DATA_ALIGN(len) + _CMSG_HDR_ALIGN(sizeof(struct cmsghdr)))
+	(_CMSG_DATA_ALIGN(len) + _CMSG_DATA_ALIGN(sizeof(struct cmsghdr)))
 #    define CMSG_LEN(len) \
 	(_CMSG_DATA_ALIGN(sizeof(struct cmsghdr)) + (len))
 #  else