diff options
author | Darren Tucker <dtucker@zip.com.au> | 2003-08-21 17:08:43 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2003-08-21 17:08:43 +1000 |
commit | 1df4bb2b64e0688dc6999e309ae829b2e2c2715f (patch) | |
tree | 6dd7fb1ceeba858445d7b7bcb26114122af4d07d | |
parent | 92339b24893440e94db8f1eb13a371aae7568ad2 (diff) |
- (dtucker) [defines.h] Bug #336: Add CMSG_DATA and CMSG_FIRSTHDR macros if
not already defined (eg Linux with some versions of libc5), based on those
from OpenBSD.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | defines.h | 26 |
2 files changed, 29 insertions, 2 deletions
@@ -9,6 +9,9 @@ and Reliant Unix. Fixes "can't set controlling tty errors". - (dtucker) [openbsd-compat/realpath.c] strcat -> strlcat, rootd -> needslash to fix check for ENAMETOOLONG (OpenBSD realpath.c rev 1.10). + - (dtucker) [defines.h] Bug #336: Add CMSG_DATA and CMSG_FIRSTHDR macros if + not already defined (eg Linux with some versions of libc5), based on those + from OpenBSD. 20030429 - (djm) Add back radix.o (used by AFS support), after it went missing from @@ -1314,4 +1317,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2648.2.5 2003/08/21 06:41:41 dtucker Exp $ +$Id: ChangeLog,v 1.2648.2.6 2003/08/21 07:08:43 dtucker Exp $ @@ -1,7 +1,7 @@ #ifndef _DEFINES_H #define _DEFINES_H -/* $Id: defines.h,v 1.98 2003/04/28 23:30:43 mouring Exp $ */ +/* $Id: defines.h,v 1.97.4.1 2003/08/21 07:08:43 dtucker Exp $ */ /* Constants */ @@ -188,21 +188,28 @@ typedef unsigned long u_int32_t; #ifndef HAVE_INT64_T # if (SIZEOF_LONG_INT == 8) typedef long int int64_t; +# define HAVE_INT64_T 1 # else # if (SIZEOF_LONG_LONG_INT == 8) typedef long long int int64_t; +# define HAVE_INT64_T 1 # endif # endif #endif #ifndef HAVE_U_INT64_T # if (SIZEOF_LONG_INT == 8) typedef unsigned long int u_int64_t; +# define HAVE_U_INT64_T 1 # else # if (SIZEOF_LONG_LONG_INT == 8) typedef unsigned long long int u_int64_t; +# define HAVE_U_INT64_T 1 # endif # endif #endif +#if !defined(HAVE_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT == 8) +# define HAVE_LONG_LONG_INT 1 +#endif #ifndef HAVE_U_CHAR typedef unsigned char u_char; @@ -413,6 +420,23 @@ struct winsize { #define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len)) #endif +/* given pointer to struct cmsghdr, return pointer to data */ +#ifndef CMSG_DATA +#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr))) +#endif /* CMSG_DATA */ + +/* + * RFC 2292 requires to check msg_controllen, in case that the kernel returns + * an empty list for some reasons. + */ +#ifndef CMSG_FIRSTHDR +#define CMSG_FIRSTHDR(mhdr) \ + ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ + (struct cmsghdr *)(mhdr)->msg_control : \ + (struct cmsghdr *)NULL) +#endif /* CMSG_FIRSTHDR */ + + /* Function replacement / compatibility hacks */ #if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO)) |