Commit 1504a776 authored by Dan Winship's avatar Dan Winship

GSocket: define CMSG_LEN and CMSG_SPACE if the system doesn't

https://bugzilla.gnome.org/show_bug.cgi?id=589989
parent 29f3e3f7
......@@ -68,6 +68,17 @@
#define _PATH_RESCONF "/etc/resolv.conf"
#endif
#ifndef CMSG_LEN
/* CMSG_LEN and CMSG_SPACE are defined by RFC 2292, but missing on
* some older platforms.
*/
#define CMSG_LEN(len) ((size_t)CMSG_DATA((struct cmsghdr *)NULL) + (len))
/* CMSG_SPACE must add at least as much padding as CMSG_NXTHDR()
* adds. We overestimate here.
*/
#define ALIGN_TO_SIZEOF(len, obj) (((len) + sizeof (obj) - 1) & ~(sizeof (obj) - 1))
#define CMSG_SPACE(len) ALIGN_TO_SIZEOF (CMSG_LEN (len), struct cmsghdr)
#endif
G_BEGIN_DECLS
......
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