Provide replacement for CMSG_LEN and CMSG_SPACE

This commit is contained in:
Rémi Denis-Courmont 2008-10-09 20:49:49 +03:00
parent cabfae6149
commit 9dd13ebf18
2 changed files with 21 additions and 0 deletions

View File

@ -45,6 +45,16 @@
#ifndef AF_LOCAL
# define AF_LOCAL AF_UNIX
#endif
/* Required yet non-standard cmsg functions */
#ifndef CMSG_ALIGN
# define CMSG_ALIGN(len) (((len) + sizeof(intptr_t)-1) & ~(sizeof(intptr_t)-1))
#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
static inline int is_allowed_port (uint16_t port)
{

View File

@ -45,6 +45,17 @@ int rootwrap_bind (int, int, int, const struct sockaddr *, size_t);
#include <netinet/in.h>
#include <pthread.h>
/* Required yet non-standard cmsg functions */
#ifndef CMSG_ALIGN
# define CMSG_ALIGN(len) (((len) + sizeof(intptr_t)-1) & ~(sizeof(intptr_t)-1))
#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
/**
* Receive a file descriptor from another process
*/