Solaris 9 is missing CMSG_ALIGN and some of the RFC2292 CMSG_*. From

Dagobert Michelsen.
This commit is contained in:
Nicholas Marriott 2010-05-19 21:40:49 +00:00
parent 278effd7ea
commit 9c01a3d0db

View File

@ -1,4 +1,4 @@
/* $Id: compat.h,v 1.21 2010-05-19 21:31:37 nicm Exp $ */ /* $Id: compat.h,v 1.22 2010-05-19 21:40:49 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -84,7 +84,7 @@ typedef uint64_t u_int64_t;
#endif #endif
#ifdef HAVE_BROKEN_CMSG_FIRSTHDR #ifdef HAVE_BROKEN_CMSG_FIRSTHDR
/* Broken on OS X. */ /* CMSG_FIRSTHDR broken on OS X. */
#undef CMSG_FIRSTHDR #undef CMSG_FIRSTHDR
#define CMSG_FIRSTHDR(mhdr) \ #define CMSG_FIRSTHDR(mhdr) \
((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
@ -92,6 +92,23 @@ typedef uint64_t u_int64_t;
(struct cmsghdr *)NULL) (struct cmsghdr *)NULL)
#endif #endif
/* CMSG_ALIGN, CMSG_SPACE, CMSG_LEN missing from Solaris 9. */
#ifndef CMSG_ALIGN
#ifdef __sun
#define CMSG_ALIGN _CMSG_DATA_ALIGN
#else
#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
#ifndef INFTIM #ifndef INFTIM
#define INFTIM -1 #define INFTIM -1
#endif #endif
@ -135,7 +152,7 @@ typedef uint64_t u_int64_t;
#endif #endif
#ifndef HAVE_BZERO #ifndef HAVE_BZERO
#define bzero(buf, len) memset((buf), 0, (len)); #define bzero(buf, len) memset(buf, 0, len);
#endif #endif
#ifndef HAVE_STRCASESTR #ifndef HAVE_STRCASESTR