Changeset 96442 in vbox
- Timestamp:
- Aug 23, 2022 2:12:35 PM (2 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r96420 r96442 780 780 r3/http-server.cpp \ 781 781 r3/init.cpp \ 782 r3/init-data.cpp \ 783 r3/process-data.cpp \ 782 784 r3/memsafer-r3.cpp \ 783 785 r3/path.cpp \ … … 2437 2439 r3/generic/semspinmutex-r3-generic.cpp \ 2438 2440 r3/init.cpp \ 2441 r3/init-data.cpp \ 2442 r3/process-data.cpp \ 2439 2443 r3/memsafer-r3.cpp \ 2440 2444 r3/path.cpp \ -
trunk/src/VBox/Runtime/include/internal/initterm.h
r96407 r96442 66 66 #endif /* IN_RING0 */ 67 67 68 #ifdef IN_RING3 69 70 extern DECL_HIDDEN_DATA(int32_t volatile) g_crtR3Users; 71 extern DECL_HIDDEN_DATA(bool volatile) g_frtR3Initializing; 72 extern DECL_HIDDEN_DATA(bool volatile) g_frtAtExitCalled; 73 74 /** 75 * Internal version of RTR3InitIsInitialized. 76 */ 77 DECLINLINE(bool) rtInitIsInitialized(void) 78 { 79 return g_crtR3Users >= 1 && !g_frtR3Initializing; 80 } 81 82 #endif 83 68 84 RT_C_DECLS_END 69 85 -
trunk/src/VBox/Runtime/include/internal/process.h
r96407 r96442 50 50 extern DECL_HIDDEN_DATA(char) g_szrtProcExePath[RTPATH_MAX]; 51 51 extern DECL_HIDDEN_DATA(size_t) g_cchrtProcExePath; 52 extern DECL_HIDDEN_DATA(size_t) g_cchrtProc Dir;52 extern DECL_HIDDEN_DATA(size_t) g_cchrtProcExeDir; 53 53 extern DECL_HIDDEN_DATA(size_t) g_offrtProcName; 54 extern DECL_HIDDEN_DATA(bool volatile) g_frtAtExitCalled;55 54 56 55 /** -
trunk/src/VBox/Runtime/r3/init.cpp
r96407 r96442 85 85 #include "init.h" 86 86 #include "internal/alignmentchecks.h" 87 #include "internal/initterm.h" 87 88 #include "internal/path.h" 88 89 #include "internal/process.h" … … 94 95 * Global Variables * 95 96 *********************************************************************************************************************************/ 96 /** The number of calls to RTR3Init*. */97 static int32_t volatile g_cUsers = 0;98 /** Whether we're currently initializing the IPRT. */99 static bool volatile g_fInitializing = false;100 101 #if !defined(IPRT_NO_CRT) || !defined(RT_OS_WINDOWS)102 /** The process path.103 * This is used by RTPathExecDir and RTProcGetExecutablePath and set by rtProcInitName. */104 DECL_HIDDEN_DATA(char) g_szrtProcExePath[RTPATH_MAX];105 /** The length of g_szrtProcExePath. */106 DECL_HIDDEN_DATA(size_t) g_cchrtProcExePath;107 /** The offset of the process name into g_szrtProcExePath. */108 DECL_HIDDEN_DATA(size_t) g_offrtProcName;109 #endif110 /** The length of directory path component of g_szrtProcExePath. */111 DECL_HIDDEN_DATA(size_t) g_cchrtProcDir;112 113 97 /** The IPRT init flags. */ 114 98 static uint32_t g_fInitFlags; … … 121 105 static char ** g_papszrtOrgArgs; 122 106 123 /**124 * Program start nanosecond TS.125 */126 DECL_HIDDEN_DATA(uint64_t) g_u64ProgramStartNanoTS;127 128 /**129 * The process identifier of the running process.130 */131 DECL_HIDDEN_DATA(RTPROCESS) g_ProcessSelf = NIL_RTPROCESS;132 133 /**134 * The current process priority.135 */136 DECL_HIDDEN_DATA(RTPROCPRIORITY) g_enmProcessPriority = RTPROCPRIORITY_DEFAULT;137 138 /**139 * Set if the atexit callback has been called, i.e. indicating140 * that the process is terminating.141 */142 DECL_HIDDEN_DATA(bool volatile) g_frtAtExitCalled = false;143 144 107 #ifdef IPRT_WITH_ALIGNMENT_CHECKS 145 108 /** … … 170 133 ASMAtomicWriteBool(&g_frtAtExitCalled, true); 171 134 172 if (g_c Users > 0)135 if (g_crtR3Users > 0) 173 136 { 174 137 PRTLOGGER pLogger = RTLogGetDefaultInstance(); … … 249 212 */ 250 213 ssize_t offName; 251 g_cchrtProcExePath = RTPathParseSimple(g_szrtProcExePath, &g_cchrtProc Dir, &offName, NULL);214 g_cchrtProcExePath = RTPathParseSimple(g_szrtProcExePath, &g_cchrtProcExeDir, &offName, NULL); 252 215 g_offrtProcName = offName; 253 216 return VINF_SUCCESS; … … 599 562 * first one, the real init, is running (second assertion). 600 563 */ 601 int32_t cUsers = ASMAtomicIncS32(&g_c Users);564 int32_t cUsers = ASMAtomicIncS32(&g_crtR3Users); 602 565 if (cUsers != 1) 603 566 { 604 567 AssertMsg(cUsers > 1, ("%d\n", cUsers)); 605 Assert(!g_f Initializing);568 Assert(!g_frtR3Initializing); 606 569 607 570 #if !defined(IN_GUEST) && !defined(RT_NO_GIP) … … 640 603 * Do the initialization. 641 604 */ 642 ASMAtomicWriteBool(&g_f Initializing, true);605 ASMAtomicWriteBool(&g_frtR3Initializing, true); 643 606 int rc = rtR3InitBody(fFlags, cArgs, ppapszArgs, pszProgramPath); 644 ASMAtomicWriteBool(&g_f Initializing, false);607 ASMAtomicWriteBool(&g_frtR3Initializing, false); 645 608 if (RT_FAILURE(rc)) 646 609 { 647 610 /* failure */ 648 ASMAtomicDecS32(&g_c Users);611 ASMAtomicDecS32(&g_crtR3Users); 649 612 return rc; 650 613 } … … 686 649 RTR3DECL(bool) RTR3InitIsInitialized(void) 687 650 { 688 return g_c Users >= 1 && !g_fInitializing;651 return g_crtR3Users >= 1 && !g_frtR3Initializing; 689 652 } 690 653 -
trunk/src/VBox/Runtime/r3/path.cpp
r96407 r96442 79 79 * Calc the length and check if there is space before copying. 80 80 */ 81 size_t cch = g_cchrtProc Dir;81 size_t cch = g_cchrtProcExeDir; 82 82 if (cch < cchPath) 83 83 { -
trunk/src/VBox/Runtime/r3/stream.cpp
r96407 r96442 89 89 #include "internal/alignmentchecks.h" 90 90 #include "internal/magics.h" 91 #ifdef IPRT_NO_CRT 92 # include "internal/initterm.h" 93 #endif 91 94 92 95 #ifdef RTSTREAM_STANDALONE … … 362 365 363 366 /* The native stream lock are normally not recursive. */ 364 int rc = RTCritSectInitEx(pCritSect, RTCRITSECT_FLAGS_NO_NESTING, 365 NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemSpinMutex"); 367 uint32_t fFlags = RTCRITSECT_FLAGS_NO_NESTING; 368 # ifdef IPRT_NO_CRT 369 /* IPRT is often used deliberatly without initialization in no-CRT 370 binaries (for instance VBoxAddInstallNt3x.exe), so in order to avoid 371 asserting in the lock validator we add the bootstrap hack that disable 372 lock validation for the section. */ 373 if (!rtInitIsInitialized()) 374 fFlags |= RTCRITSECT_FLAGS_BOOTSTRAP_HACK; 375 # endif 376 int rc = RTCritSectInitEx(pCritSect, fFlags, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemSpinMutex"); 366 377 if (RT_SUCCESS(rc)) 367 378 { -
trunk/src/VBox/Runtime/r3/win/nocrt-startup-common-win.cpp
r96407 r96442 53 53 54 54 #include "internal/compiler-vcc.h" 55 56 57 /********************************************************************************************************************************* 58 * Global Variables * 59 *********************************************************************************************************************************/ 60 RT_C_DECLS_BEGIN 61 DECL_HIDDEN_DATA(char) g_szrtProcExePath[RTPATH_MAX] = "Unknown.exe"; 62 DECL_HIDDEN_DATA(size_t) g_cchrtProcExePath = 11; 63 DECL_HIDDEN_DATA(size_t) g_cchrtProcExeDir = 0; 64 DECL_HIDDEN_DATA(size_t) g_offrtProcName = 0; 65 RT_C_DECLS_END 55 #include "internal/process.h" 66 56 67 57
Note:
See TracChangeset
for help on using the changeset viewer.