]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed some windows cmsg emulation.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Tue, 24 Jan 2012 14:28:31 +0000 (15:28 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Tue, 24 Jan 2012 14:28:31 +0000 (15:28 +0100)
compat/cmsg.h

index 3441ef29ffd345c84ac1cda6ef24833a1b004de6..b9627ab577c3f945c9b163d1efba053faff87c55 100644 (file)
@@ -7,12 +7,13 @@
 \r
 /* mostly windows-specific */\r
 #ifndef CMSG_SPACE\r
-typedef struct  {\r
+struct cmsghdr{\r
         unsigned int    cmsg_len;\r
         int  cmsg_level;\r
         int     cmsg_type;\r
+        unsigned char cmsg_data[16]; /* dummy */\r
         /* followed by UCHAR cmsg_data[]; */\r
-} cmsghdr;\r
+} ;\r
 \r
 /* lifted off https://metacpan.org/source/SAMPO/Socket-PassAccessRights-0.03/passfd.c */\r
 #ifndef CMSG_DATA\r
@@ -25,8 +26,8 @@ typedef struct  {
 \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
+  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)        \\r
+   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)\r
 #endif\r
 \r
 #ifndef CMSG_ALIGN\r
@@ -36,11 +37,11 @@ typedef struct  {
 \r
 #ifndef CMSG_SPACE\r
 # define CMSG_SPACE(len) (CMSG_ALIGN (len) \\r
-             + CMSG_ALIGN (sizeof ( cmsghdr)))\r
+             + CMSG_ALIGN (sizeof (struct cmsghdr)))\r
 #endif\r
 \r
 #ifndef CMSG_LEN\r
-# define CMSG_LEN(len)   (CMSG_ALIGN (sizeof ( cmsghdr)) + (len))\r
+# define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))\r
 #endif\r
 \r
 struct msghdr {\r
@@ -61,12 +62,31 @@ struct msghdr {
 \r
 \r
 struct iovec {\r
-\r
+       void *iov_base;\r
+       size_t iov_len;\r
 };\r
 struct sockaddr_un {\r
-        char sun_path[256];   /* pathname */\r
+       char sun_family;\r
+    char sun_path[256];   /* pathname */\r
 };\r
+# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path)        \\r
+        + strlen ((ptr)->sun_path))\r
+\r
 \r
 #endif /* CMSG_SPACE */\r
 \r
+#ifndef SCM_RIGHTS\r
+#define SCM_RIGHTS 1\r
+#endif\r
+#ifndef SCM_CREDENTIALS\r
+#define SCM_CREDENTIALS 2\r
+#endif\r
+#ifndef SCM_SECURITY\r
+#define SCM_SECURITY 3\r
+#endif\r
+\r
+#ifndef AF_LOCAL\r
+#define AF_LOCAL 1\r
+#endif\r
+\r
 #endif /* CMSG_H_ */\r