diff options
author | Damjan Jovanovic <damjan@apache.org> | 2016-02-06 19:07:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-02-07 20:26:44 +0000 |
commit | ed983eb5ce71d0b9af07795eabd8686f24c4597e (patch) | |
tree | 09aea557352d98c51dbec0c98dd3f459490df56e /sal/osl | |
parent | 9faec4cd975de7cd62da558acbb9f5e6829fd54e (diff) |
Platforms that need CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT for sockets usually
need it for pipes too, and even if it isn't necessary it can't hurt.
In particular, on FreeBSD 11-CURRENT it seems pipes no longer wake up
from accept when closed in other threads, so let's deal with that before
FreeBSD 11 is released.
Reported by: Matthias Apitz <g u r u a t u n i x a r e a d o t d e>
Patch by: me
Tested by: Matthias Apitz <g u r u a t u n i x a r e a d o t d e>
(cherry picked from commit e18ecd4f644cfbe5d6b871c7ff6c76bd5c220504)
Change-Id: I1b4c0438fbcc2ea53625f235906936fc1403e195
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/unx/pipe.cxx | 14 | ||||
-rw-r--r-- | sal/osl/unx/sockimpl.hxx | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx index b598ddc1f727..93213952e382 100644 --- a/sal/osl/unx/pipe.cxx +++ b/sal/osl/unx/pipe.cxx @@ -82,7 +82,7 @@ oslPipe __osl_createPipeImpl() return nullptr; pPipeImpl->m_nRefCount =1; pPipeImpl->m_bClosed = false; -#if defined(LINUX) +#if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) pPipeImpl->m_bIsInShutdown = false; pPipeImpl->m_bIsAccepting = false; #endif @@ -359,7 +359,7 @@ void SAL_CALL osl_closePipe( oslPipe pPipe ) Thread does not return from accept on linux, so connect to the accepting pipe */ -#if defined(LINUX) +#if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) struct sockaddr_un addr; if ( pPipe->m_bIsAccepting ) @@ -387,7 +387,7 @@ void SAL_CALL osl_closePipe( oslPipe pPipe ) } close(fd); } -#endif /* LINUX */ +#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */ nRet = shutdown(ConnFD, 2); if ( nRet < 0 ) @@ -421,13 +421,13 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe) OSL_ASSERT(strlen(pPipe->m_Name) > 0); -#if defined(LINUX) +#if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) pPipe->m_bIsAccepting = true; #endif s = accept(pPipe->m_Socket, nullptr, nullptr); -#if defined(LINUX) +#if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) pPipe->m_bIsAccepting = false; #endif @@ -437,13 +437,13 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe) return nullptr; } -#if defined(LINUX) +#if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) if ( pPipe->m_bIsInShutdown ) { close(s); return nullptr; } -#endif /* LINUX */ +#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */ else { /* alloc memory */ diff --git a/sal/osl/unx/sockimpl.hxx b/sal/osl/unx/sockimpl.hxx index 900155c92184..0b702c6db3c7 100644 --- a/sal/osl/unx/sockimpl.hxx +++ b/sal/osl/unx/sockimpl.hxx @@ -48,7 +48,7 @@ struct oslPipeImpl { sal_Char m_Name[PATH_MAX + 1]; oslInterlockedCount m_nRefCount; bool m_bClosed; -#if defined(LINUX) +#if defined(CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT) bool m_bIsAccepting; bool m_bIsInShutdown; #endif |