From d0f3d5eb384d08b5c3a6995dadeacce2203f8f47 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Sun, 7 May 2017 04:22:16 +1000 Subject: osl: remove comment cruft, whitespace cleanup of process.cxx Change-Id: I9609306dfe70595e67ee6100ce236e849e7a3eca --- sal/osl/unx/process.cxx | 35 ++++++++--------------------------- sal/osl/w32/process.cxx | 41 ----------------------------------------- 2 files changed, 8 insertions(+), 68 deletions(-) (limited to 'sal') diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index 52b676ab8827..a9fb2986dc4f 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -108,12 +108,6 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, oslFileHandle *pOutputRead, oslFileHandle *pErrorRead ); -/****************************************************************************** - * - * Functions for starting a process - * - *****************************************************************************/ - extern "C" { static void ChildStatusProc(void *pData) @@ -364,9 +358,9 @@ static void ChildStatusProc(void *pData) if (stdOutput[0] != -1) close( stdOutput[0] ); if (stdError[0] != -1) close( stdError[0] ); - //if pid > 0 then a process was created, even if it later failed - //e.g. bash searching for a command to execute, and we still - //need to clean it up to avoid "defunct" processes + /* if pid > 0 then a process was created, even if it later failed + e.g. bash searching for a command to execute, and we still + need to clean it up to avoid "defunct" processes */ if (pid > 0) { pid_t child_pid; @@ -584,7 +578,7 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, oslFileHandle *pErrorRead ) { - int i; + int i; ProcessData Data; oslThread hThread; @@ -680,12 +674,6 @@ oslProcessError SAL_CALL osl_psz_executeProcess(sal_Char *pszImageName, return osl_Process_E_Unknown; } -/****************************************************************************** - * - * Functions for processes - * - *****************************************************************************/ - oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process) { if (Process == nullptr) @@ -1114,9 +1102,8 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F return (pInfo->Fields == Fields) ? osl_Process_E_None : osl_Process_E_Unknown; } -/*********************************************** - helper function for osl_joinProcessWithTimeout - **********************************************/ +/** Helper function for osl_joinProcessWithTimeout + */ static bool is_timeout(const struct timeval* tend) { @@ -1125,22 +1112,16 @@ static bool is_timeout(const struct timeval* tend) return (tcurrent.tv_sec >= tend->tv_sec); } -/********************************************** - kill(pid, 0) is useful for checking if a +/* kill(pid, 0) is useful for checking if a process is still alive, but remember that kill even returns 0 if the process is already - a zombie. - *********************************************/ + a zombie. */ static bool is_process_dead(pid_t pid) { return ((kill(pid, 0) == -1) && (ESRCH == errno)); } -/********************************************** - osl_joinProcessWithTimeout - *********************************************/ - oslProcessError SAL_CALL osl_joinProcessWithTimeout(oslProcess Process, const TimeValue* pTimeout) { oslProcessImpl* pChild = ChildList; diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx index 8aa06b468c52..9f76dc40bd1a 100644 --- a/sal/osl/w32/process.cxx +++ b/sal/osl/w32/process.cxx @@ -47,10 +47,6 @@ #include #include -/*************************************************************************** - * Process. - ***************************************************************************/ - oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process) { if (Process == nullptr) @@ -155,8 +151,6 @@ oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process) return (TerminateProcess(hProcess, 0) == FALSE) ? osl_Process_E_Unknown : osl_Process_E_None; } -/***************************************************************************/ - oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident) { oslProcessImpl* pProcImpl; @@ -175,8 +169,6 @@ oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident) return pProcImpl; } -/***************************************************************************/ - void SAL_CALL osl_freeProcessHandle(oslProcess Process) { if (Process != nullptr) @@ -187,8 +179,6 @@ void SAL_CALL osl_freeProcessHandle(oslProcess Process) } } -/***************************************************************************/ - oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData Fields, oslProcessInfo* pInfo) { @@ -269,15 +259,11 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F return (pInfo->Fields == Fields) ? osl_Process_E_None : osl_Process_E_Unknown; } -/***************************************************************************/ - oslProcessError SAL_CALL osl_joinProcess(oslProcess Process) { return osl_joinProcessWithTimeout(Process, nullptr); } -/***************************************************************************/ - oslProcessError SAL_CALL osl_joinProcessWithTimeout(oslProcess Process, const TimeValue* pTimeout) { DWORD timeout = INFINITE; @@ -330,10 +316,6 @@ oslProcessError bootstrap_getExecutableFile(rtl_uString ** ppFileURL) } -/*************************************************************************** - * Command Line Arguments. - ***************************************************************************/ - struct CommandArgs_Impl { sal_uInt32 m_nCount; @@ -399,8 +381,6 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **) #pragma warning( pop ) #endif -/***************************************************************************/ - oslProcessError SAL_CALL osl_getExecutableFile( rtl_uString **ppustrFile ) { osl_acquireMutex (*osl_getGlobalMutex()); @@ -416,8 +396,6 @@ oslProcessError SAL_CALL osl_getExecutableFile( rtl_uString **ppustrFile ) return osl_Process_E_None; } -/***************************************************************************/ - sal_uInt32 SAL_CALL osl_getCommandArgCount() { sal_uInt32 result = 0; @@ -436,8 +414,6 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount() return result; } -/***************************************************************************/ - oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCommandArg) { oslProcessError result = osl_Process_E_NotFound; @@ -455,8 +431,6 @@ oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCo return result; } -/***************************************************************************/ - void SAL_CALL osl_setCommandArgs (int argc, char ** argv) { assert(argc > 0); @@ -474,9 +448,6 @@ void SAL_CALL osl_setCommandArgs (int argc, char ** argv) osl_releaseMutex (*osl_getGlobalMutex()); } -/*************************************************************************** - * Environment - ***************************************************************************/ #define ENV_BUFFER_SIZE (32*1024-1) oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString **ustrValue) @@ -526,10 +497,6 @@ oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString *ustrVar) return osl_Process_E_Unknown; } -/*************************************************************************** - * Current Working Directory. - ***************************************************************************/ - oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir ) { ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH ); @@ -558,14 +525,8 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir return osl_Process_E_Unknown; } -/*************************************************************************** - * Process Locale. - ***************************************************************************/ - static rtl_Locale * g_theProcessLocale = nullptr; -/***************************************************************************/ - oslProcessError SAL_CALL osl_getProcessLocale( rtl_Locale ** ppLocale ) { osl_acquireMutex( *osl_getGlobalMutex() ); @@ -581,8 +542,6 @@ oslProcessError SAL_CALL osl_getProcessLocale( rtl_Locale ** ppLocale ) return osl_Process_E_None; } -/***************************************************************************/ - oslProcessError SAL_CALL osl_setProcessLocale( rtl_Locale * pLocale ) { osl_acquireMutex( *osl_getGlobalMutex() ); -- cgit