comparison src/os/unix/ngx_posix_config.h @ 1901:d880fa02fb65

use CMSG_LEN(), this fixes an alert "sendmsg() failed (9: Bad file descriptor)" on some 64-bit platforms
author Igor Sysoev <igor@sysoev.ru>
date Tue, 19 Feb 2008 16:34:55 +0000
parents 81774dc3db28
children d85e291b99f9
comparison
equal deleted inserted replaced
1900:55a9d867e3c8 1901:d880fa02fb65
108 108
109 #if (__FreeBSD__) && (__FreeBSD_version < 400017) 109 #if (__FreeBSD__) && (__FreeBSD_version < 400017)
110 110
111 #include <sys/param.h> /* ALIGN() */ 111 #include <sys/param.h> /* ALIGN() */
112 112
113 /* FreeBSD 3.x has no CMSG_SPACE() at all and has the broken CMSG_DATA() */ 113 /*
114 * FreeBSD 3.x has no CMSG_SPACE() and CMSG_LEN() and has the broken CMSG_DATA()
115 */
114 116
115 #undef CMSG_SPACE 117 #undef CMSG_SPACE
116 #define CMSG_SPACE(l) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(l)) 118 #define CMSG_SPACE(l) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(l))
119
120 #undef CMSG_LEN
121 #define CMSG_LEN(l) (ALIGN(sizeof(struct cmsghdr)) + (l))
117 122
118 #undef CMSG_DATA 123 #undef CMSG_DATA
119 #define CMSG_DATA(cmsg) ((u_char *)(cmsg) + ALIGN(sizeof(struct cmsghdr))) 124 #define CMSG_DATA(cmsg) ((u_char *)(cmsg) + ALIGN(sizeof(struct cmsghdr)))
120 125
121 #endif 126 #endif