portability of CMSG_SPACE

git-svn-id: file:///svn/unbound/trunk@2081 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2010-04-16 08:41:08 +00:00
parent 8452c8cd5d
commit 1085e72135
2 changed files with 26 additions and 5 deletions

View 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.

View file

@ -46,6 +46,29 @@
#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)
{