Changeset 101962 in vbox for trunk/src/libs/xpcom18a4/ipc/ipcd
- Timestamp:
- Nov 8, 2023 12:01:00 PM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcConfig.cpp
r16561 r101962 47 47 #include "ipcConfig.h" 48 48 #include "ipcLog.h" 49 #include "prenv.h"50 49 #include "plstr.h" 50 51 #include <iprt/env.h> 51 52 52 53 #if defined(XP_OS2) && !defined(XP_OS2_NATIVEIPC) … … 75 76 bufLen -= (sizeof(kDefaultSocketPrefix) - 1); 76 77 77 logName = PR_GetEnv("VBOX_IPC_SOCKETID");78 logName = RTEnvGet("VBOX_IPC_SOCKETID"); 78 79 #if defined(VBOX) && defined(XP_UNIX) 79 80 if (!logName || !logName[0]) { … … 84 85 #endif 85 86 if (!logName || !logName[0]) { 86 logName = PR_GetEnv("LOGNAME");87 logName = RTEnvGet("LOGNAME"); 87 88 if (!logName || !logName[0]) { 88 logName = PR_GetEnv("USER");89 logName = RTEnvGet("USER"); 89 90 if (!logName || !logName[0]) { 90 91 LOG(("could not determine username from environment\n")); -
trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcLog.cpp
r46593 r101962 48 48 #include "plstr.h" 49 49 50 #ifdef VBOX 51 # if defined(__OS2__) && defined(PAGE_SIZE) 52 # undef PAGE_SIZE 53 # endif 54 # include <iprt/initterm.h> // for RTR3InitDll 55 #else // !VBOX 56 PRBool ipcLogEnabled = PR_FALSE; 57 #endif // !VBOX 50 #include <iprt/initterm.h> // for RTR3InitDll 58 51 59 52 char ipcLogPrefix[10] = {0}; 60 61 #ifndef VBOX62 63 //-----------------------------------------------------------------------------64 // UNIX65 //-----------------------------------------------------------------------------66 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)67 68 #include <sys/types.h>69 #include <unistd.h>70 71 static inline PRUint3272 WritePrefix(char *buf, PRUint32 bufLen)73 {74 return PR_snprintf(buf, bufLen, "[%u:%p] %s ",75 (unsigned) getpid(),76 PR_GetCurrentThread(),77 ipcLogPrefix);78 }79 #endif80 81 //-----------------------------------------------------------------------------82 // WIN3283 //-----------------------------------------------------------------------------84 #ifdef XP_WIN85 #include <windows.h>86 87 static inline PRUint3288 WritePrefix(char *buf, PRUint32 bufLen)89 {90 return PR_snprintf(buf, bufLen, "[%u:%p] %s ",91 GetCurrentProcessId(),92 PR_GetCurrentThread(),93 ipcLogPrefix);94 }95 #endif96 97 #endif // !VBOX98 53 99 54 //----------------------------------------------------------------------------- … … 104 59 IPC_InitLog(const char *prefix) 105 60 { 106 #ifdef VBOX107 61 // initialize VBox Runtime 108 62 RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE); 109 63 110 64 PL_strncpyz(ipcLogPrefix, prefix, sizeof(ipcLogPrefix)); 111 #else112 if (PR_GetEnv("IPC_LOG_ENABLE")) {113 ipcLogEnabled = PR_TRUE;114 PL_strncpyz(ipcLogPrefix, prefix, sizeof(ipcLogPrefix));115 }116 #endif117 65 } 118 66 … … 125 73 char buf[512]; 126 74 127 #ifdef VBOX128 75 if (ipcLogPrefix[0]) { 129 76 nb = strlen(ipcLogPrefix); … … 133 80 buf[nb++] = ' '; 134 81 } 135 #else136 if (ipcLogPrefix[0])137 nb = WritePrefix(buf, sizeof(buf));138 #endif139 82 140 83 PR_vsnprintf(buf + nb, sizeof(buf) - nb, fmt, ap); 141 84 buf[sizeof(buf) - 1] = '\0'; 142 85 143 #ifdef VBOX144 86 LogFlow(("%s", buf)); 145 #else146 fwrite(buf, strlen(buf), 1, stdout);147 #endif148 149 87 va_end(ap); 150 88 }
Note:
See TracChangeset
for help on using the changeset viewer.