aboutsummaryrefslogtreecommitdiff
path: root/patches/libbu++-osx-compatability.patch
blob: 73f4d7ac2a4d9ed5455e8725f1fee79993a2afd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Index: src/server.cpp
===================================================================
--- src/server.cpp	(revision 345)
+++ src/server.cpp	(working copy)
@@ -3,6 +3,7 @@
 #include "bu/serversocket.h"
 #include "bu/client.h"
 #include "bu/socket.h"
+#include "osx_compatibility.h"
 
 Bu::Server::Server() :
 	nTimeoutSec( 0 ),
Index: src/socket.cpp
===================================================================
--- src/socket.cpp	(revision 345)
+++ src/socket.cpp	(working copy)
@@ -13,6 +13,7 @@
 #include <fcntl.h>
 #include "socket.h"
 #include "exceptions.h"
+#include "osx_compatibility.h"
 
 #define RBS (1024*2)
 
Index: src/osx_compatibility.h
===================================================================
--- src/osx_compatibility.h	(revision 0)
+++ src/osx_compatibility.h	(revision 0)
@@ -0,0 +1,19 @@
+#ifndef OSX_COMPATIBILITY__H
+#define OSX_COMPATIBILITY__H
+
+#ifdef __APPLE__
+
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression)            \
+  (__extension__                                  \
+    ({ long int __result;                         \
+      do __result = (long int) (expression);      \
+      while (__result == -1L && errno == EINTR);  \
+      __result; }))
+#endif
+
+#include <sched.h>
+
+#define pthread_yield() sched_yield()
+#endif /* __APPLE__ */
+#endif
\ No newline at end of file
Index: src/serversocket.cpp
===================================================================
--- src/serversocket.cpp	(revision 345)
+++ src/serversocket.cpp	(working copy)
@@ -13,6 +13,7 @@
 #include <fcntl.h>
 #include "serversocket.h"
 #include "exceptions.h"
+#include "osx_compatibility.h"
 
 Bu::ServerSocket::ServerSocket( int nPort, int nPoolSize ) :
 	nPort( nPort )
@@ -118,8 +119,12 @@
 				(int *)&size
 				);
 #else
-		nClient = ::accept( nServer, (struct sockaddr *)&clientname, &size );
+#ifdef __APPLE__
+  		nClient = ::accept( nServer, (struct sockaddr *)&clientname, (socklen_t*)&size );
+#else
+  		nClient = ::accept( nServer, (struct sockaddr *)&clientname, &size );
 #endif
+#endif
 		if( nClient < 0 )
 		{
 			throw SocketException(
Index: src/ito.cpp
===================================================================
--- src/ito.cpp	(revision 345)
+++ src/ito.cpp	(working copy)
@@ -1,4 +1,5 @@
 #include "ito.h"
+#include "osx_compatibility.h"
 
 Bu::Ito::Ito()
 {