--- /dev/null
+/*\r
+ * Compatibility-layer for CMSG_\r
+ */\r
+\r
+#ifndef CMSG_H_\r
+#define CMSG_H_\r
+\r
+/* mostly windows-specific */\r
+#ifndef CMSG_SPACE\r
+typedef struct {\r
+ unsigned int cmsg_len;\r
+ int cmsg_level;\r
+ int cmsg_type;\r
+ /* followed by UCHAR cmsg_data[]; */\r
+} cmsghdr;\r
+\r
+/* lifted off https://metacpan.org/source/SAMPO/Socket-PassAccessRights-0.03/passfd.c */\r
+#ifndef CMSG_DATA\r
+# define CMSG_DATA(cmsg) ((cmsg)->cmsg_data)\r
+#endif\r
+\r
+#ifndef CMSG_NXTHDR\r
+# define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)\r
+#endif\r
+\r
+#ifndef CMSG_FIRSTHDR\r
+# define CMSG_FIRSTHDR(mhdr) \\r
+ ((size_t) (mhdr)->msg_controllen >= sizeof ( cmsghdr) \\r
+ ? ( cmsghdr *) (mhdr)->msg_control : ( cmsghdr *) NULL)\r
+#endif\r
+\r
+#ifndef CMSG_ALIGN\r
+# define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \\r
+ & ~(sizeof (size_t) - 1))\r
+#endif\r
+\r
+#ifndef CMSG_SPACE\r
+# define CMSG_SPACE(len) (CMSG_ALIGN (len) \\r
+ + CMSG_ALIGN (sizeof ( cmsghdr)))\r
+#endif\r
+\r
+#ifndef CMSG_LEN\r
+# define CMSG_LEN(len) (CMSG_ALIGN (sizeof ( cmsghdr)) + (len))\r
+#endif\r
+\r
+struct msghdr {\r
+ void *msg_name; /* Address to send to/receive from. */\r
+ socklen_t msg_namelen; /* Length of address data. */\r
+\r
+ struct iovec *msg_iov; /* Vector of data to send/receive into. */\r
+ size_t msg_iovlen; /* Number of elements in the vector. */\r
+\r
+ void *msg_control; /* Ancillary data (eg BSD filedesc passing). */\r
+ size_t msg_controllen; /* Ancillary data buffer length.\r
+ !! The type should be socklen_t but the\r
+ definition of the kernel is incompatible\r
+ with this. */\r
+\r
+ int msg_flags; /* Flags on received message. */\r
+};\r
+\r
+\r
+struct iovec {\r
+\r
+};\r
+struct sockaddr_un {\r
+ char sun_path[256]; /* pathname */\r
+};\r
+\r
+#endif /* CMSG_SPACE */\r
+\r
+#endif /* CMSG_H_ */\r
#if _SQUID_MINGW_
/* broken mingw header... */
-# ifdef WSA_CMSG_FIRSTHDR
-# define CMSG_FIRSTHDR(x) WSA_CMSG_FIRSTHDR(x)
-# endif
-# ifdef WSA_CMSG_NXTHDR
-# define CMSG_NXTHDR(x, y) WSA_CMSG_NXTHDR(x, y)
-# endif
-# ifdef WSA_CMSG_DATA
-# define CMSG_DATA(x) WSA_CMSG_DATA(x)
-# endif
-# ifdef WSA_CMSG_LEN
-# define CMSG_LEN(x) WSA_CMSG_LEN(x)
-# endif
-# ifdef WSA_CMSG_SPACE
-# define CMSG_SPACE(x) WSA_CMSG_SPACE(x)
-# endif
-# ifdef WSA_CMSG_FIRSTHDR
-# define CMSG_FIRSTHDR(x) WSA_CMSG_FIRSTHDR(x)
-# endif
-
-struct msghdr {
- void *msg_name; /* Address to send to/receive from. */
- socklen_t msg_namelen; /* Length of address data. */
-
- struct iovec *msg_iov; /* Vector of data to send/receive into. */
- size_t msg_iovlen; /* Number of elements in the vector. */
-
- void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
- size_t msg_controllen; /* Ancillary data buffer length.
- !! The type should be socklen_t but the
- definition of the kernel is incompatible
- with this. */
-
- int msg_flags; /* Flags on received message. */
-};
-struct iovec {
-
-};
-struct sockaddr_un {
- char sun_path[256]; /* pathname */
-};
/* MinGW missing bits from sys/wait.h */
/* A status looks like: