[Mono-dev] [PATCH] Handle absence of socket constants

Andreas Färber andreas.faerber at web.de
Sun Mar 21 14:19:38 EDT 2010


AF_SNA, AF_DECnet and SOCK_RDM are not part of POSIX, and Haiku does not
supply them.
Check for their presence before using them, as already done for AF_IPX.

	* socket-io.c: Don't depend on AF_SNA, AF_DECnet,
	SOCK_RDM.
	
This commit is licensed under the MIT X11 license.
---
 Hello,
 
 This patch helps fix compilation on Haiku. Okay to commit?
 
 Regards,
 Andreas
 
 mono/metadata/ChangeLog   |    7 +++++++
 mono/metadata/socket-io.c |   10 ++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index 197e7f8..b61f60a 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-21  Andreas Färber  <andreas.faerber at web.de>
+
+	* socket-io.c: Don't depend on AF_SNA, AF_DECnet,
+	SOCK_RDM.
+	
+	Code is contributed under MIT/X11 license.
+
 2010-03-20  Sanjoy Das <sanjoy at playingwithpointers.com>
 
 	* sgen-gc.c (mono_gc_get_write_barrier): Handle non-aligned
diff --git a/mono/metadata/socket-io.c b/mono/metadata/socket-io.c
index 090f5b3..bc0b4e9 100644
--- a/mono/metadata/socket-io.c
+++ b/mono/metadata/socket-io.c
@@ -141,11 +141,15 @@ static gint32 convert_family(MonoAddressFamily mono_family)
 		break;
 		
 	case AddressFamily_Sna:
+#ifdef AF_SNA
 		family=AF_SNA;
+#endif
 		break;
 		
 	case AddressFamily_DecNet:
+#ifdef AF_DECnet
 		family=AF_DECnet;
+#endif
 		break;
 		
 	case AddressFamily_AppleTalk:
@@ -192,13 +196,17 @@ static MonoAddressFamily convert_to_mono_family(guint16 af_family)
 		break;
 #endif
 		
+#ifdef AF_SNA
 	case AF_SNA:
 		family=AddressFamily_Sna;
 		break;
+#endif
 		
+#ifdef AF_DECnet
 	case AF_DECnet:
 		family=AddressFamily_DecNet;
 		break;
+#endif
 		
 	case AF_APPLETALK:
 		family=AddressFamily_AppleTalk;
@@ -240,7 +248,9 @@ static gint32 convert_type(MonoSocketType mono_type)
 		break;
 
 	case SocketType_Rdm:
+#ifdef SOCK_RDM
 		type=SOCK_RDM;
+#endif
 		break;
 
 	case SocketType_Seqpacket:
-- 
1.7.0.14.g7e948



More information about the Mono-devel-list mailing list