diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-01-08 12:21:16 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-01-08 12:29:49 +0100 |
commit | 393132ca73f2deead95c000ea7381727a25731e2 (patch) | |
tree | 0460951830d3a9c52bae77611854709e564ef51b /sal/osl/w32 | |
parent | 350824178333b58948dbc3826ad759f10b0f026e (diff) |
[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
Diffstat (limited to 'sal/osl/w32')
-rw-r--r-- | sal/osl/w32/process.cxx | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx index 087ee2e20c01..23001f9cd4c6 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: */ |