]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
portability of CMSG_SPACE
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 16 Apr 2010 08:41:08 +0000 (08:41 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 16 Apr 2010 08:41:08 +0000 (08:41 +0000)
git-svn-id: file:///svn/unbound/trunk@2081 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/netevent.c

index d32886b0220084b49b8c1d300cd0fcfbf330eb92..403f7dd97fccd626e1e5a43bcf6ce092fd658514 100644 (file)
@@ -1,3 +1,6 @@
+16 April 2010: Wouter
+       - more portability defines for CMSG_SPACE, CMSG_ALIGN, CMSG_LEN.
+
 15 April 2010: Wouter
        - ECC-GOST algorithm number 12 that is assigned by IANA.  New test
          example key and signatures for GOST.  GOST requires openssl-1.0.0.
index 2c0a9577e7cb45128da4b0ba4df3e4f7e5b9baac..4b6a0a3cefb8cdf8e4d92b454b7af6792d483a81 100644 (file)
 #include "util/fptr_wlist.h"
 
 /* -------- Start of local definitions -------- */
+/** if CMSG_ALIGN is not defined on this platform, a workaround */
+#ifndef CMSG_ALIGN
+#  ifdef _CMSG_DATA_ALIGN
+#    define CMSG_ALIGN _CMSG_DATA_ALIGN
+#  else
+#    define CMSG_ALIGN(len) (((len)+sizeof(long)-1) & ~(sizeof(long)-1))
+#  endif
+#endif
+
+/** if CMSG_LEN is not defined on this platform, a workaround */
+#ifndef CMSG_LEN
+#  define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr))+(len))
+#endif
+
+/** if CMSG_SPACE is not defined on this platform, a workaround */
+#ifndef CMSG_SPACE
+#  ifdef _CMSG_HDR_ALIGN
+#    define CMSG_SPACE(l) (CMSG_ALIGN(l)+_CMSG_HDR_ALIGN(sizeof(struct cmsghdr)))
+#  else
+#    define CMSG_SPACE(l) (CMSG_ALIGN(l)+CMSG_ALIGN(sizeof(struct cmsghdr)))
+#  endif
+#endif
+
 /** The TCP reading or writing query timeout in seconds */
 #define TCP_QUERY_TIMEOUT 120 
 
@@ -295,11 +318,6 @@ comm_point_send_udp_msg(struct comm_point *c, ldns_buffer* packet,
        return 1;
 }
 
-/** if no CMSG_LEN (Solaris 9) define something reasonable for one element */
-#ifndef CMSG_LEN
-#define CMSG_LEN(x) (sizeof(struct cmsghdr)+(x))
-#endif
-
 /** print debug ancillary info */
 void p_ancil(const char* str, struct comm_reply* r)
 {