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
86
87
88
89
90
91
92
93
94
95
96
97
98
|
--- sal/osl/unx/pipe.c.orig 2014-02-25 08:31:45 UTC
+++ sal/osl/unx/pipe.c
@@ -115,7 +115,7 @@ oslPipe __osl_createPipeImpl()
pPipeImpl = (oslPipe)calloc(1, sizeof(struct oslPipeImpl));
pPipeImpl->m_nRefCount =1;
pPipeImpl->m_bClosed = sal_False;
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
pPipeImpl->m_bIsInShutdown = sal_False;
pPipeImpl->m_bIsAccepting = sal_False;
#endif
@@ -321,7 +321,7 @@ void SAL_CALL osl_releasePipe( oslPipe p
void SAL_CALL osl_closePipe( oslPipe pPipe )
{
int nRet;
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
size_t len;
struct sockaddr_un addr;
int fd;
@@ -341,10 +341,10 @@ void SAL_CALL osl_closePipe( oslPipe pPi
ConnFD = pPipe->m_Socket;
/*
- Thread does not return from accept on linux, so
+ Thread does not return from accept on some operating systems, so
connect to the accepting pipe
*/
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
if ( pPipe->m_bIsAccepting )
{
pPipe->m_bIsInShutdown = sal_True;
@@ -356,7 +356,11 @@ void SAL_CALL osl_closePipe( oslPipe pPi
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, pPipe->m_Name, sizeof(addr.sun_path));
- len = sizeof(addr);
+#if defined(FREEBSD)
+ len = SUN_LEN(&addr);
+#else
+ len = sizeof(addr);
+#endif
nRet = connect( fd, (struct sockaddr *)&addr, len);
#if OSL_DEBUG_LEVEL > 1
@@ -367,7 +371,7 @@ void SAL_CALL osl_closePipe( oslPipe pPi
#endif /* OSL_DEBUG_LEVEL */
close(fd);
}
-#endif /* LINUX */
+#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
nRet = shutdown(ConnFD, 2);
@@ -408,13 +412,13 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe
OSL_ASSERT(strlen(pPipe->m_Name) > 0);
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
pPipe->m_bIsAccepting = sal_True;
#endif
s = accept(pPipe->m_Socket, NULL, NULL);
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
pPipe->m_bIsAccepting = sal_False;
#endif
@@ -424,13 +428,13 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe
return NULL;
}
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
if ( pPipe->m_bIsInShutdown )
{
close(s);
return NULL;
}
-#endif /* LINUX */
+#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
else
{
/* alloc memory */
--- sal/osl/unx/sockimpl.h.orig 2015-10-21 07:03:17 UTC
+++ sal/osl/unx/sockimpl.h
@@ -63,7 +63,7 @@ struct oslPipeImpl {
sal_Char m_Name[PATH_MAX + 1];
oslInterlockedCount m_nRefCount;
sal_Bool m_bClosed;
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
sal_Bool m_bIsAccepting;
sal_Bool m_bIsInShutdown;
#endif
|