Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Feb 2016 18:29:36 +0000 (UTC)
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r408494 - in head/editors/libreoffice: . files
Message-ID:  <201602081829.u18ITa0k086258@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tijl
Date: Mon Feb  8 18:29:36 2016
New Revision: 408494
URL: https://svnweb.freebsd.org/changeset/ports/408494

Log:
  Add upstream patches that resolve a deadlock when one thread closes a
  socket or pipe while another thread is still accepting connections.
  
  PR:		205922
  Approved by:	office (jkim)

Added:
  head/editors/libreoffice/files/patch-sal_osl_unx_pipe.cxx   (contents, props changed)
  head/editors/libreoffice/files/patch-sal_osl_unx_socket.cxx   (contents, props changed)
  head/editors/libreoffice/files/patch-sal_osl_unx_sockimpl.hxx   (contents, props changed)
Modified:
  head/editors/libreoffice/Makefile.common

Modified: head/editors/libreoffice/Makefile.common
==============================================================================
--- head/editors/libreoffice/Makefile.common	Mon Feb  8 18:14:24 2016	(r408493)
+++ head/editors/libreoffice/Makefile.common	Mon Feb  8 18:29:36 2016	(r408494)
@@ -2,7 +2,7 @@
 
 PORTNAME=	libreoffice
 PORTVERSION=	5.0.4
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES+=	editors
  
 MAINTAINER=	office@FreeBSD.org

Added: head/editors/libreoffice/files/patch-sal_osl_unx_pipe.cxx
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/editors/libreoffice/files/patch-sal_osl_unx_pipe.cxx	Mon Feb  8 18:29:36 2016	(r408494)
@@ -0,0 +1,65 @@
+--- sal/osl/unx/pipe.cxx.orig	2015-12-11 02:29:35 UTC
++++ sal/osl/unx/pipe.cxx
+@@ -82,10 +82,10 @@ oslPipe __osl_createPipeImpl()
+         return NULL;
+     pPipeImpl->m_nRefCount =1;
+     pPipeImpl->m_bClosed = false;
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     pPipeImpl->m_bIsInShutdown = false;
+     pPipeImpl->m_bIsAccepting = false;
+-#endif
++#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
+     return pPipeImpl;
+ }
+ 
+@@ -359,7 +359,7 @@ void SAL_CALL osl_closePipe( oslPipe pPi
+       Thread does not return from accept on linux, so
+       connect to the accepting pipe
+      */
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     struct sockaddr_un addr;
+ 
+     if ( pPipe->m_bIsAccepting )
+@@ -387,7 +387,7 @@ void SAL_CALL osl_closePipe( oslPipe pPi
+         }
+         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 
+ 
+     OSL_ASSERT(strlen(pPipe->m_Name) > 0);
+ 
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     pPipe->m_bIsAccepting = true;
+ #endif
+ 
+     s = accept(pPipe->m_Socket, NULL, NULL);
+ 
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     pPipe->m_bIsAccepting = false;
+ #endif
+ 
+@@ -437,13 +437,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 */

Added: head/editors/libreoffice/files/patch-sal_osl_unx_socket.cxx
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/editors/libreoffice/files/patch-sal_osl_unx_socket.cxx	Mon Feb  8 18:29:36 2016	(r408494)
@@ -0,0 +1,98 @@
+--- sal/osl/unx/socket.cxx.orig	2015-12-11 02:29:35 UTC
++++ sal/osl/unx/socket.cxx
+@@ -447,7 +447,7 @@ oslSocket __osl_createSocketImpl(int Soc
+     pSocket->m_nLastError = 0;
+     pSocket->m_nRefCount = 1;
+ 
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     pSocket->m_bIsAccepting = false;
+ #endif
+ 
+@@ -1364,13 +1364,13 @@ void SAL_CALL osl_releaseSocket( oslSock
+ {
+     if( pSocket && 0 == osl_atomic_decrement( &(pSocket->m_nRefCount) ) )
+     {
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     if ( pSocket->m_bIsAccepting )
+     {
+         SAL_WARN( "sal.osl", "attempt to destroy socket while accepting" );
+         return;
+     }
+-#endif /* LINUX */
++#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
+         osl_closeSocket( pSocket );
+         __osl_destroySocketImpl( pSocket );
+     }
+@@ -1393,7 +1393,7 @@ void SAL_CALL osl_closeSocket(oslSocket 
+ 
+     pSocket->m_Socket = OSL_INVALID_SOCKET;
+ 
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     pSocket->m_bIsInShutdown = true;
+ 
+     if ( pSocket->m_bIsAccepting )
+@@ -1437,7 +1437,7 @@ void SAL_CALL osl_closeSocket(oslSocket 
+         }
+         pSocket->m_bIsAccepting = false;
+     }
+-#endif /* LINUX */
++#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
+ 
+     nRet=close(nFD);
+     if ( nRet != 0 )
+@@ -1695,9 +1695,9 @@ oslSocket SAL_CALL osl_acceptConnectionO
+     }
+ 
+     pSocket->m_nLastError=0;
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     pSocket->m_bIsAccepting = true;
+-#endif /* LINUX */
++#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
+ 
+     if( ppAddr && *ppAddr )
+     {
+@@ -1718,22 +1718,22 @@ oslSocket SAL_CALL osl_acceptConnectionO
+         int nErrno = errno;
+         SAL_WARN( "sal.osl", "accept connection failed: (" << nErrno << ") " << strerror(nErrno) );
+ 
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+         pSocket->m_bIsAccepting = false;
+-#endif /* LINUX */
++#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
+         return 0;
+     }
+ 
+     assert(AddrLen == sizeof(struct sockaddr));
+ 
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     if ( pSocket->m_bIsInShutdown )
+     {
+         close(Connection);
+         SAL_WARN( "sal.osl", "close while accept" );
+         return 0;
+     }
+-#endif /* LINUX */
++#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
+ 
+     if(ppAddr)
+     {
+@@ -1758,11 +1758,11 @@ oslSocket SAL_CALL osl_acceptConnectionO
+ 
+     pConnectionSockImpl->m_Socket           = Connection;
+     pConnectionSockImpl->m_nLastError       = 0;
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     pConnectionSockImpl->m_bIsAccepting     = false;
+ 
+     pSocket->m_bIsAccepting = false;
+-#endif /* LINUX */
++#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
+     return pConnectionSockImpl;
+ }
+ 

Added: head/editors/libreoffice/files/patch-sal_osl_unx_sockimpl.hxx
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/editors/libreoffice/files/patch-sal_osl_unx_sockimpl.hxx	Mon Feb  8 18:29:36 2016	(r408494)
@@ -0,0 +1,28 @@
+--- sal/osl/unx/sockimpl.hxx.orig	2015-12-11 02:29:35 UTC
++++ sal/osl/unx/sockimpl.hxx
+@@ -24,11 +24,15 @@
+ #include <osl/socket.h>
+ #include <osl/interlck.h>
+ 
++#if defined(FREEBSD) || defined(LINUX)
++#define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1
++#endif
++
+ struct oslSocketImpl {
+     int                 m_Socket;
+     int                 m_nLastError;
+     oslInterlockedCount m_nRefCount;
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     bool                m_bIsAccepting;
+     bool                m_bIsInShutdown;
+ #endif
+@@ -45,7 +49,7 @@ struct oslPipeImpl {
+     sal_Char m_Name[PATH_MAX + 1];
+     oslInterlockedCount m_nRefCount;
+     bool m_bClosed;
+-#if defined(LINUX)
++#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
+     bool m_bIsAccepting;
+     bool m_bIsInShutdown;
+ #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602081829.u18ITa0k086258>