From 1ef0db4b33cc63985713515ac35598c2884900bf Mon Sep 17 00:00:00 2001 From: david Date: Sat, 3 Sep 2011 01:51:35 +0000 Subject: [PATCH] Define CMSG_ALIGN, CMSG_SPACE, and CMSG_LEN for old Solaris. This was reported by Dagobert Michelsen and comes from http://wiki.opencsw.org/porting-faq#toc10. --- libnetutil/netutil.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index b75c8dfac..5128736ba 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -111,6 +111,26 @@ #endif #include +/* Define CMSG_* symbols for Solaris 9 and earlier. See + http://wiki.opencsw.org/porting-faq#toc10. */ +#if defined(__sun) || defined(__sun__) +# ifndef CMSG_ALIGN +# ifdef __sun__ +# define CMSG_ALIGN(len) _CMSG_DATA_ALIGN (len) +# else + /* aligning to sizeof (long) is assumed to be portable (fd.o#40235) */ +# define CMSG_ALIGN(len) (((len) + sizeof (long) - 1) & ~(sizeof (long) - 1)) +# endif +# endif +# ifndef CMSG_SPACE +# define CMSG_SPACE(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + CMSG_ALIGN (len)) +# endif +# ifndef CMSG_LEN +# define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) +# endif +#endif /* Solaris */ + + #if HAVE_NETINET_IN_H #include #endif