[Libreoffice-commits] core.git: 2 commits - include/osl sal/osl

Stephan Bergmann sbergman at redhat.com
Thu Jan 8 03:30:19 PST 2015


 include/osl/process.h   |   17 ------
 sal/osl/all/compat.cxx  |   11 ++++
 sal/osl/unx/process.cxx |   17 ------
 sal/osl/w32/process.cxx |  128 ------------------------------------------------
 4 files changed, 11 insertions(+), 162 deletions(-)

New commits:
commit 6e6cb0ec83dc1ad1131fb6ef1466e6666449ffed
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jan 8 12:25:49 2015 +0100

    [API CHANGE] remove oslDescriptorType/Flag
    
    ...apparently unused since the corresponding code was removed with
    2ad023906439164a10e7e2bbd6ae85f0e8958efe "#87132#removed obsolete parameter in
    executeProcess" in 2001
    
    (detected after 45ec1d9b56cec41596f806ebf845ebfcd30c9f46 "brute-force
    find-and-remove of unused #define constants" boldly removed the corresponding
    osl_Process_DF* defines from osl/process.h)
    
    Change-Id: I49c20aec9b4acb08d42bfa0371ee1149d6c4e9d4

diff --git a/include/osl/process.h b/include/osl/process.h
index 96be678..068ef0c 100644
--- a/include/osl/process.h
+++ b/include/osl/process.h
@@ -69,16 +69,6 @@ typedef enum {
     osl_Process_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
 } oslProcessError;
 
-typedef enum {
-    osl_Process_TypeNone,       /* no descriptor */
-    osl_Process_TypeSocket,     /* socket */
-    osl_Process_TypeFile,       /* file   */
-    osl_Process_TypePipe,       /* pipe   */
-    osl_Process_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
-} oslDescriptorType;
-
-typedef sal_Int32 oslDescriptorFlag;
-
 #ifdef SAL_W32
 #   pragma pack(push, 8)
 #endif
commit 393132ca73f2deead95c000ea7381727a25731e2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jan 8 12:21:16 2015 +0100

    [API CHANGE] Remove osl_send/receiveResourcePipe
    
    ...they had not been documented in osl/process.h and the sal/osl/unx
    implementation had been stubbed out since
    7b37265b8e1afe480a6bbd271bf48fa1cbb44d55 "sal: remove unx implementation of
    osl_sendResourcePipe/osl_receiveResourcePipe" in 2012
    
    Change-Id: Ia3ae853d95b6f3b2d2743f06755ef8f6246501d8

diff --git a/include/osl/process.h b/include/osl/process.h
index 4f334b0..96be678 100644
--- a/include/osl/process.h
+++ b/include/osl/process.h
@@ -433,13 +433,6 @@ SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessLocale(
 SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setProcessLocale(
         rtl_Locale * pLocale );
 
-
-SAL_DLLPUBLIC sal_Bool SAL_CALL osl_sendResourcePipe(
-        oslPipe Pipe, oslSocket Socket );
-
-SAL_DLLPUBLIC oslSocket SAL_CALL osl_receiveResourcePipe(
-        oslPipe Pipe );
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/sal/osl/all/compat.cxx b/sal/osl/all/compat.cxx
index 3f072a1..592ac90 100644
--- a/sal/osl/all/compat.cxx
+++ b/sal/osl/all/compat.cxx
@@ -12,6 +12,8 @@
 #include <cstdlib>
 
 #include "osl/module.h"
+#include "osl/pipe.h"
+#include "osl/socket.h"
 #include "osl/time.h"
 #include "sal/types.h"
 
@@ -49,6 +51,10 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_getEthernetAddress(sal_uInt8 *) {
     for (;;) { std::abort(); } // avoid "must return a value" warnings
 }
 
+SAL_DLLPUBLIC_EXPORT oslSocket SAL_CALL osl_receiveResourcePipe(oslPipe) {
+    for (;;) { std::abort(); } // avoid "must return a value" warnings
+}
+
 SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_releaseSemaphore(void *) {
     for (;;) { std::abort(); } // avoid "must return a value" warnings
 }
@@ -59,6 +65,11 @@ SAL_DLLPUBLIC_EXPORT sal_Int32 SAL_CALL osl_reportError(
     for (;;) { std::abort(); } // avoid "must return a value" warnings
 }
 
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_sendResourcePipe(oslPipe, oslSocket)
+{
+    for (;;) { std::abort(); } // avoid "must return a value" warnings
+}
+
 namespace {
 typedef void (SAL_CALL * pfunc_osl_printDebugMessage)(char const *);
 }
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx
index 8030664..ea60b2b 100644
--- a/sal/osl/unx/process.cxx
+++ b/sal/osl/unx/process.cxx
@@ -110,23 +110,6 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName,
 
 /******************************************************************************
  *
- *                  New io resource transfer functions
- *
- *****************************************************************************/
-
-sal_Bool osl_sendResourcePipe(oslPipe /*pPipe*/, oslSocket /*pSocket*/)
-{
-    return osl_Process_E_InvalidError;
-}
-
-oslSocket osl_receiveResourcePipe(oslPipe /*pPipe*/)
-{
-    oslSocket pSocket = 0;
-    return pSocket;
-}
-
-/******************************************************************************
- *
  *                  Functions for starting a process
  *
  *****************************************************************************/
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 087ee2e..23001f9 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -506,132 +506,4 @@ oslProcessError SAL_CALL osl_setProcessLocale( rtl_Locale * pLocale )
     return osl_Process_E_None;
 }
 
-/************************************************
- * Portal send/receive interface implementation
- ************************************************/
-
-static sal_Bool ReadPipe(oslPipe hPipe,
-                void* pBuffer,
-                sal_Int32 BytesToRead,
-                sal_Int32* nBytes)
-{
-        *nBytes = osl_receivePipe(hPipe, pBuffer, BytesToRead);
-        OSL_TRACE("tried to receive %d, received %d.\n",
-                        BytesToRead, *nBytes);
-        return (sal_Bool)((*nBytes >= 0) && (osl_getLastPipeError(hPipe) == osl_Pipe_E_None));
-}
-
-static sal_Bool WritePipe(oslPipe hPipe,
-                void* pBuffer,
-                sal_Int32 BytesToSend,
-                sal_Int32* nBytes)
-{
-        *nBytes = osl_sendPipe(hPipe, pBuffer, BytesToSend);
-        OSL_TRACE("tried to send %d, sent %d\n",
-                        BytesToSend, *nBytes);
-        return (sal_Bool)((*nBytes == BytesToSend) && (osl_getLastPipeError(hPipe) == osl_Pipe_E_None));
-}
-
-sal_Bool SAL_CALL osl_sendResourcePipe(oslPipe hPipe, oslSocket pSocket)
-{
-    sal_Bool bRet = sal_False;
-    sal_Int32 bytes = 0;
-
-    /*  duplicate handle on this other side ->
-        receive remote process
-        duplicate handle and send it */
-    DWORD remoteProcessID = 0;
-    HANDLE fd = (HANDLE)pSocket->m_Socket;
-    oslDescriptorType code = osl_Process_TypeSocket;
-
-    OSL_TRACE("osl_sendResourcePipe: enter...");
-
-    if (ReadPipe(hPipe, &remoteProcessID, sizeof(remoteProcessID), &bytes))
-    {
-        HANDLE hRemoteProc = OpenProcess(PROCESS_DUP_HANDLE,
-                                         FALSE,
-                                         remoteProcessID);
-
-        if (hRemoteProc != (HANDLE)NULL)
-        {
-            HANDLE newFd;
-
-            if (DuplicateHandle(GetCurrentProcess(),
-                                fd,
-                                hRemoteProc,
-                                &newFd,
-                                0, FALSE, DUPLICATE_SAME_ACCESS))
-            {
-                if (
-                    WritePipe(hPipe, &code, sizeof(code), &bytes) &&
-                    WritePipe(hPipe, &newFd, sizeof(fd), &bytes)
-                    )
-                    bRet = sal_True;
-            }
-
-            CloseHandle(hRemoteProc);
-        }
-    }
-
-    if (bRet)
-    {
-        sal_Int32 commitCode;
-        OSL_TRACE("osl_sendResourcePipe: handle sent successfully, verify...");
-
-        if (
-            !ReadPipe(hPipe, &commitCode, sizeof(commitCode), &bytes) ||
-            (commitCode <= 0)
-            )
-            bRet = sal_False;
-    }
-
-    OSL_TRACE("osl_sendResourcePipe: exit... %d", bRet);
-    return(bRet);
-}
-
-oslSocket SAL_CALL osl_receiveResourcePipe(oslPipe hPipe)
-{
-    sal_Bool bRet = sal_False;
-    sal_Int32 bytes = 0;
-    sal_Int32 commitCode;
-    oslSocket pSocket = NULL;
-
-    /* duplicate handle on the other side ->
-       send my process id receive duplicated handle */
-    HANDLE fd = INVALID_HANDLE_VALUE;
-    DWORD myProcessID = GetCurrentProcessId();
-    oslDescriptorType code = osl_Process_TypeNone;
-
-    OSL_TRACE("osl_receiveResourcePipe: enter...");
-
-    if (
-        WritePipe(hPipe, &myProcessID, sizeof(myProcessID), &bytes) &&
-        ReadPipe(hPipe, &code, sizeof(code), &bytes) &&
-                ReadPipe(hPipe, &fd, sizeof(fd), &bytes)
-        )
-    {
-        if (code == osl_Process_TypeSocket)
-        {
-            pSocket = __osl_createSocketImpl((SOCKET)fd);
-            bRet = sal_True;
-        }
-        else
-        {
-            OSL_TRACE("osl_receiveResourcePipe: UNKNOWN");
-            bRet = sal_False;
-        }
-        }
-
-    if (bRet)
-        commitCode = 1;
-    else
-        commitCode = 0;
-
-    WritePipe(hPipe, &commitCode, sizeof(commitCode), &bytes);
-
-    OSL_TRACE("osl_receiveResourcePipe: exit... %d, %p", bRet, pSocket);
-
-    return pSocket;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list