Commit 9dd13ebf authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Provide replacement for CMSG_LEN and CMSG_SPACE

parent cabfae61
...@@ -45,6 +45,16 @@ ...@@ -45,6 +45,16 @@
#ifndef AF_LOCAL #ifndef AF_LOCAL
# define AF_LOCAL AF_UNIX # define AF_LOCAL AF_UNIX
#endif #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) static inline int is_allowed_port (uint16_t port)
{ {
......
...@@ -45,6 +45,17 @@ int rootwrap_bind (int, int, int, const struct sockaddr *, size_t); ...@@ -45,6 +45,17 @@ int rootwrap_bind (int, int, int, const struct sockaddr *, size_t);
#include <netinet/in.h> #include <netinet/in.h>
#include <pthread.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 * Receive a file descriptor from another process
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment