Hi,

I just stumbled over a weird problem in Cygwin's socket code, which I
tracked down to a wrong definition of struct sockaddr_in6.  It had the
correct size (28 bytes) in the application but it was supposedly 40
bytes in the Cygwin DLL.

I tracked it down to the fact that the re-definition of u_long for LP64
systems is missing in ws2ipdef.h.  While looking I found that ws2tcpip.h
and mstcpip.h are affected as well.

So I'd like to propose the below patch which adds LP64 u_long overrides
to these files.


Thanks,
Corinna


        * mstcpip.h: Add LP64 u_long override.
        * ws2ipdef.h: Ditto.
        * ws2tcpip.h: Ditto.


Index: mstcpip.h
===================================================================
--- mstcpip.h   (revision 6598)
+++ mstcpip.h   (working copy)
@@ -9,6 +9,12 @@
 #include <_mingw_unicode.h>
 #include <winapifamily.h>
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 struct tcp_keepalive {
   u_long onoff;
   u_long keepalivetime;
@@ -131,5 +137,9 @@
 #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
 #endif /*(_WIN32_WINNT >= 0x0502)*/
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
+#endif
+
 #endif /* _MSTCPIP_ */
 
Index: ws2ipdef.h
===================================================================
--- ws2ipdef.h  (revision 6598)
+++ ws2ipdef.h  (working copy)
@@ -5,8 +5,15 @@
 #ifndef _WS2IPDEF_
 #define _WS2IPDEF_
 
+#include <_mingw_unicode.h>
 #include <winapifamily.h>
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
 
 #include <in6addr.h>
@@ -132,4 +139,8 @@
 
 #endif /* WINAPI_PARTION_DESKTOP.  */
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
+#endif
+
 #endif /*_WS2IPDEF_ */
Index: ws2tcpip.h
===================================================================
--- ws2tcpip.h  (revision 6598)
+++ ws2tcpip.h  (working copy)
@@ -8,6 +8,12 @@
 
 #include <_mingw_unicode.h>
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 #include <winsock2.h>
 #include <ws2ipdef.h>
 #include <psdk_inc/_ip_mreq1.h>
@@ -435,4 +441,8 @@
 }
 #endif
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
+#endif
+
 #endif /* _WS2TCPIP_H_ */

Attachment: pgprOzfCGh4Ji.pgp
Description: PGP signature

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to