VirtualBox

source: vbox/trunk/src/VBox/Runtime/r3/init.cpp@ 75440

Last change on this file since 75440 was 72863, checked in by vboxsync, 6 years ago

IPRT: RTTimeProgramXxxx must all be derived from the nanosecond timestamp or we may get rounding errors. This happened when mixing the ring-0 formatted 'msprog' and 'timeprog' prefixes with ones from ring-3.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 20.2 KB
Line 
1/* $Id: init.cpp 72863 2018-07-04 10:13:40Z vboxsync $ */
2/** @file
3 * IPRT - Init Ring-3.
4 */
5
6/*
7 * Copyright (C) 2006-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27
28/*********************************************************************************************************************************
29* Header Files *
30*********************************************************************************************************************************/
31#define LOG_GROUP RTLOGGROUP_DEFAULT
32#include <iprt/types.h> /* darwin: UINT32_C and others. */
33
34#ifdef RT_OS_WINDOWS
35# include <process.h>
36# include <iprt/win/windows.h>
37#else
38# include <unistd.h>
39# ifndef RT_OS_OS2
40# include <pthread.h>
41# include <signal.h>
42# include <errno.h>
43# define IPRT_USE_SIG_CHILD_DUMMY
44# endif
45#endif
46#ifdef RT_OS_OS2
47# include <InnoTekLIBC/fork.h>
48# define INCL_DOSMISC
49# include <os2.h>
50#endif
51#include <locale.h>
52
53#include <iprt/initterm.h>
54#include <iprt/asm.h>
55#include <iprt/assert.h>
56#include <iprt/err.h>
57#include <iprt/log.h>
58#include <iprt/mem.h>
59#include <iprt/path.h>
60#include <iprt/time.h>
61#include <iprt/string.h>
62#include <iprt/param.h>
63#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
64# include <iprt/file.h>
65# include <VBox/sup.h>
66#endif
67#include <stdlib.h>
68
69#include "init.h"
70#include "internal/alignmentchecks.h"
71#include "internal/path.h"
72#include "internal/process.h"
73#include "internal/thread.h"
74#include "internal/time.h"
75
76
77/*********************************************************************************************************************************
78* Global Variables *
79*********************************************************************************************************************************/
80/** The number of calls to RTR3Init*. */
81static int32_t volatile g_cUsers = 0;
82/** Whether we're currently initializing the IPRT. */
83static bool volatile g_fInitializing = false;
84
85/** The process path.
86 * This is used by RTPathExecDir and RTProcGetExecutablePath and set by rtProcInitName. */
87DECLHIDDEN(char) g_szrtProcExePath[RTPATH_MAX];
88/** The length of g_szrtProcExePath. */
89DECLHIDDEN(size_t) g_cchrtProcExePath;
90/** The length of directory path component of g_szrtProcExePath. */
91DECLHIDDEN(size_t) g_cchrtProcDir;
92/** The offset of the process name into g_szrtProcExePath. */
93DECLHIDDEN(size_t) g_offrtProcName;
94
95/** The IPRT init flags. */
96static uint32_t g_fInitFlags;
97
98/** The argument count of the program. */
99static int g_crtArgs = -1;
100/** The arguments of the program (UTF-8). This is "leaked". */
101static char ** g_papszrtArgs;
102/** The original argument vector of the program. */
103static char ** g_papszrtOrgArgs;
104
105/**
106 * Program start nanosecond TS.
107 */
108DECLHIDDEN(uint64_t) g_u64ProgramStartNanoTS;
109
110/**
111 * The process identifier of the running process.
112 */
113DECLHIDDEN(RTPROCESS) g_ProcessSelf = NIL_RTPROCESS;
114
115/**
116 * The current process priority.
117 */
118DECLHIDDEN(RTPROCPRIORITY) g_enmProcessPriority = RTPROCPRIORITY_DEFAULT;
119
120/**
121 * Set if the atexit callback has been called, i.e. indicating
122 * that the process is terminating.
123 */
124DECLHIDDEN(bool volatile) g_frtAtExitCalled = false;
125
126#ifdef IPRT_WITH_ALIGNMENT_CHECKS
127/**
128 * Whether alignment checks are enabled.
129 * This is set if the environment variable IPRT_ALIGNMENT_CHECKS is 1.
130 */
131RTDATADECL(bool) g_fRTAlignmentChecks = false;
132#endif
133
134
135#if defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) || defined(RT_OS_HAIKU) \
136 || defined(RT_OS_LINUX) || defined(RT_OS_OS2) || defined(RT_OS_SOLARIS) /** @todo add host init hooks everywhere. */
137/* Stubs */
138DECLHIDDEN(int) rtR3InitNativeFirst(uint32_t fFlags) { RT_NOREF_PV(fFlags); return VINF_SUCCESS; }
139DECLHIDDEN(int) rtR3InitNativeFinal(uint32_t fFlags) { RT_NOREF_PV(fFlags); return VINF_SUCCESS; }
140DECLHIDDEN(void) rtR3InitNativeObtrusive(uint32_t fFlags) { RT_NOREF_PV(fFlags); }
141#endif
142
143
144/**
145 * atexit callback.
146 *
147 * This makes sure any loggers are flushed and will later also work the
148 * termination callback chain.
149 */
150static void rtR3ExitCallback(void)
151{
152 ASMAtomicWriteBool(&g_frtAtExitCalled, true);
153
154 if (g_cUsers > 0)
155 {
156 PRTLOGGER pLogger = RTLogGetDefaultInstance();
157 if (pLogger)
158 RTLogFlush(pLogger);
159
160 pLogger = RTLogRelGetDefaultInstance();
161 if (pLogger)
162 RTLogFlush(pLogger);
163 }
164}
165
166
167#ifndef RT_OS_WINDOWS
168/**
169 * Fork callback, child context.
170 */
171static void rtR3ForkChildCallback(void)
172{
173 g_ProcessSelf = getpid();
174}
175#endif /* RT_OS_WINDOWS */
176
177#ifdef RT_OS_OS2
178/** Fork completion callback for OS/2. Only called in the child. */
179static void rtR3ForkOs2ChildCompletionCallback(void *pvArg, int rc, __LIBC_FORKCTX enmCtx)
180{
181 Assert(enmCtx == __LIBC_FORK_CTX_CHILD); NOREF(enmCtx);
182 NOREF(pvArg);
183
184 if (!rc)
185 rtR3ForkChildCallback();
186}
187
188/** Low-level fork callback for OS/2. */
189int rtR3ForkOs2Child(__LIBC_PFORKHANDLE pForkHandle, __LIBC_FORKOP enmOperation)
190{
191 if (enmOperation == __LIBC_FORK_OP_EXEC_CHILD)
192 return pForkHandle->pfnCompletionCallback(pForkHandle, rtR3ForkOs2ChildCompletionCallback, NULL, __LIBC_FORK_CTX_CHILD);
193 return 0;
194}
195
196# define static static volatile /** @todo _FORK_CHILD1 causes unresolved externals in optimized builds. Fix macro. */
197_FORK_CHILD1(0, rtR3ForkOs2Child);
198# undef static
199#endif /* RT_OS_OS2 */
200
201
202
203/**
204 * Internal worker which initializes or re-initializes the
205 * program path, name and directory globals.
206 *
207 * @returns IPRT status code.
208 * @param pszProgramPath The program path, NULL if not specified.
209 */
210static int rtR3InitProgramPath(const char *pszProgramPath)
211{
212 /*
213 * We're reserving 32 bytes here for file names as what not.
214 */
215 if (!pszProgramPath)
216 {
217 int rc = rtProcInitExePath(g_szrtProcExePath, sizeof(g_szrtProcExePath) - 32);
218 if (RT_FAILURE(rc))
219 return rc;
220 }
221 else
222 {
223 size_t cch = strlen(pszProgramPath);
224 Assert(cch > 1);
225 AssertMsgReturn(cch < sizeof(g_szrtProcExePath) - 32, ("%zu\n", cch), VERR_BUFFER_OVERFLOW);
226 memcpy(g_szrtProcExePath, pszProgramPath, cch + 1);
227 }
228
229 /*
230 * Parse the name.
231 */
232 ssize_t offName;
233 g_cchrtProcExePath = RTPathParseSimple(g_szrtProcExePath, &g_cchrtProcDir, &offName, NULL);
234 g_offrtProcName = offName;
235 return VINF_SUCCESS;
236}
237
238
239/**
240 * Internal worker which initializes or re-initializes the
241 * program path, name and directory globals.
242 *
243 * @returns IPRT status code.
244 * @param fFlags Flags, see RTR3INIT_XXX.
245 * @param cArgs Pointer to the argument count.
246 * @param ppapszArgs Pointer to the argument vector pointer. NULL
247 * allowed if @a cArgs is 0.
248 */
249static int rtR3InitArgv(uint32_t fFlags, int cArgs, char ***ppapszArgs)
250{
251 NOREF(fFlags);
252 if (cArgs)
253 {
254 AssertPtr(ppapszArgs);
255 AssertPtr(*ppapszArgs);
256 char **papszOrgArgs = *ppapszArgs;
257
258 /*
259 * Normally we should only be asked to convert arguments once. If we
260 * are though, it should be the already convered arguments.
261 */
262 if (g_crtArgs != -1)
263 {
264 AssertReturn( g_crtArgs == cArgs
265 && g_papszrtArgs == papszOrgArgs,
266 VERR_WRONG_ORDER); /* only init once! */
267 return VINF_SUCCESS;
268 }
269
270 if (!(fFlags & RTR3INIT_FLAGS_UTF8_ARGV))
271 {
272 /*
273 * Convert the arguments.
274 */
275 char **papszArgs = (char **)RTMemAllocZ((cArgs + 1) * sizeof(char *));
276 if (!papszArgs)
277 return VERR_NO_MEMORY;
278
279#ifdef RT_OS_WINDOWS
280 /* HACK ALERT! Try convert from unicode versions if possible.
281 Unfortunately for us, __wargv is only initialized if we have a
282 unicode main function. So, we have to use CommandLineToArgvW to get
283 something similar. It should do the same conversion... :-) */
284 /** @todo Replace this CommandLineToArgvW call with a call into
285 * getoptargv.cpp so we don't depend on shell32 and an API not present
286 * in NT 3.1. */
287 int cArgsW = -1;
288 PWSTR *papwszArgs = NULL;
289 if ( papszOrgArgs == __argv
290 && cArgs == __argc
291 && (papwszArgs = CommandLineToArgvW(GetCommandLineW(), &cArgsW)) != NULL )
292 {
293 AssertMsg(cArgsW == cArgs, ("%d vs %d\n", cArgsW, cArgs));
294 for (int i = 0; i < cArgs; i++)
295 {
296 int rc = RTUtf16ToUtf8Tag(papwszArgs[i], &papszArgs[i], "will-leak:rtR3InitArgv");
297 if (RT_FAILURE(rc))
298 {
299 while (i--)
300 RTStrFree(papszArgs[i]);
301 RTMemFree(papszArgs);
302 LocalFree(papwszArgs);
303 return rc;
304 }
305 }
306 LocalFree(papwszArgs);
307 }
308 else
309#endif
310 {
311 for (int i = 0; i < cArgs; i++)
312 {
313 int rc = RTStrCurrentCPToUtf8(&papszArgs[i], papszOrgArgs[i]);
314 if (RT_FAILURE(rc))
315 {
316 while (i--)
317 RTStrFree(papszArgs[i]);
318 RTMemFree(papszArgs);
319 return rc;
320 }
321 }
322 }
323
324 papszArgs[cArgs] = NULL;
325
326 g_papszrtOrgArgs = papszOrgArgs;
327 g_papszrtArgs = papszArgs;
328 g_crtArgs = cArgs;
329
330 *ppapszArgs = papszArgs;
331 }
332 else
333 {
334 /*
335 * The arguments are already UTF-8, no conversion needed.
336 */
337 g_papszrtOrgArgs = papszOrgArgs;
338 g_papszrtArgs = papszOrgArgs;
339 g_crtArgs = cArgs;
340 }
341 }
342
343 return VINF_SUCCESS;
344}
345
346
347#ifdef IPRT_USE_SIG_CHILD_DUMMY
348/**
349 * Dummy SIGCHILD handler.
350 *
351 * Assigned on rtR3Init only when SIGCHILD handler is set SIGIGN or SIGDEF to
352 * ensure waitpid works properly for the terminated processes.
353 */
354static void rtR3SigChildHandler(int iSignal)
355{
356 NOREF(iSignal);
357}
358#endif /* IPRT_USE_SIG_CHILD_DUMMY */
359
360
361/**
362 * rtR3Init worker.
363 */
364static int rtR3InitBody(uint32_t fFlags, int cArgs, char ***ppapszArgs, const char *pszProgramPath)
365{
366 /*
367 * Early native initialization.
368 */
369 int rc = rtR3InitNativeFirst(fFlags);
370 AssertMsgRCReturn(rc, ("rtR3InitNativeFirst failed with %Rrc\n", rc), rc);
371
372 /*
373 * Disable error popups.
374 */
375#if defined(RT_OS_OS2) /** @todo move to private code. */
376 DosError(FERR_DISABLEHARDERR);
377#endif
378
379 /*
380 * Init C runtime locale before we do anything that may end up converting
381 * paths or we'll end up using the "C" locale for path conversion.
382 */
383 setlocale(LC_CTYPE, "");
384
385 /*
386 * The Process ID.
387 */
388#ifdef _MSC_VER
389 g_ProcessSelf = _getpid(); /* crappy ansi compiler */
390#else
391 g_ProcessSelf = getpid();
392#endif
393
394 /*
395 * Save the init flags.
396 */
397 g_fInitFlags |= fFlags;
398
399#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
400# ifdef VBOX
401 /*
402 * This MUST be done as the very first thing, before any file is opened.
403 * The log is opened on demand, but the first log entries may be caused
404 * by rtThreadInit() below.
405 */
406 const char *pszDisableHostCache = getenv("VBOX_DISABLE_HOST_DISK_CACHE");
407 if ( pszDisableHostCache != NULL
408 && *pszDisableHostCache
409 && strcmp(pszDisableHostCache, "0") != 0)
410 {
411 RTFileSetForceFlags(RTFILE_O_WRITE, RTFILE_O_WRITE_THROUGH, 0);
412 RTFileSetForceFlags(RTFILE_O_READWRITE, RTFILE_O_WRITE_THROUGH, 0);
413 }
414# endif /* VBOX */
415#endif /* !IN_GUEST && !RT_NO_GIP */
416
417 /*
418 * Thread Thread database and adopt the caller thread as 'main'.
419 * This must be done before everything else or else we'll call into threading
420 * without having initialized TLS entries and suchlike.
421 */
422 rc = rtThreadInit();
423 AssertMsgRCReturn(rc, ("Failed to initialize threads, rc=%Rrc!\n", rc), rc);
424
425 /*
426 * The executable path before SUPLib (windows requirement).
427 */
428 rc = rtR3InitProgramPath(pszProgramPath);
429 AssertLogRelMsgRCReturn(rc, ("Failed to get executable directory path, rc=%Rrc!\n", rc), rc);
430
431#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
432 /*
433 * Initialize SUPLib here so the GIP can get going as early as possible
434 * (improves accuracy for the first client).
435 */
436 if (fFlags & RTR3INIT_FLAGS_SUPLIB)
437 {
438 rc = SUPR3Init(NULL);
439 AssertMsgRCReturn(rc, ("Failed to initialize the support library, rc=%Rrc!\n", rc), rc);
440 }
441#endif
442
443 /*
444 * Convert arguments.
445 */
446 rc = rtR3InitArgv(fFlags, cArgs, ppapszArgs);
447 AssertLogRelMsgRCReturn(rc, ("Failed to convert the arguments, rc=%Rrc!\n", rc), rc);
448
449#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
450 /*
451 * The threading is initialized we can safely sleep a bit if GIP
452 * needs some time to update itself updating.
453 */
454 if ((fFlags & RTR3INIT_FLAGS_SUPLIB) && g_pSUPGlobalInfoPage)
455 {
456 RTThreadSleep(20);
457 RTTimeNanoTS();
458 }
459#endif
460
461 /*
462 * Init the program start timestamp TS.
463 * Do that here to be sure that the GIP time was properly updated the 1st time.
464 */
465 g_u64ProgramStartNanoTS = RTTimeNanoTS();
466
467 /*
468 * The remainder cannot easily be undone, so it has to go last.
469 */
470
471 /* Fork and exit callbacks. */
472#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
473 rc = pthread_atfork(NULL, NULL, rtR3ForkChildCallback);
474 AssertMsg(rc == 0, ("%d\n", rc));
475#endif
476 atexit(rtR3ExitCallback);
477
478#ifdef IPRT_USE_SIG_CHILD_DUMMY
479 /*
480 * SIGCHLD must not be ignored (that's default), otherwise posix compliant waitpid
481 * implementations won't work right.
482 */
483 for (;;)
484 {
485 struct sigaction saOld;
486 rc = sigaction(SIGCHLD, 0, &saOld); AssertMsg(rc == 0, ("%d/%d\n", rc, errno));
487 if ( rc != 0
488 || (saOld.sa_flags & SA_SIGINFO)
489 || ( saOld.sa_handler != SIG_IGN
490 && saOld.sa_handler != SIG_DFL)
491 )
492 break;
493
494 /* Try install dummy handler. */
495 struct sigaction saNew = saOld;
496 saNew.sa_flags = SA_NOCLDSTOP | SA_RESTART;
497 saNew.sa_handler = rtR3SigChildHandler;
498 rc = sigemptyset(&saNew.sa_mask); AssertMsg(rc == 0, ("%d/%d\n", rc, errno));
499 struct sigaction saOld2;
500 rc = sigaction(SIGCHLD, &saNew, &saOld2); AssertMsg(rc == 0, ("%d/%d\n", rc, errno));
501 if ( rc != 0
502 || ( saOld2.sa_handler == saOld.sa_handler
503 && !(saOld2.sa_flags & SA_SIGINFO))
504 )
505 break;
506
507 /* Race during dynamic load, restore and try again... */
508 sigaction(SIGCHLD, &saOld2, NULL);
509 RTThreadYield();
510 }
511#endif /* IPRT_USE_SIG_CHILD_DUMMY */
512
513#ifdef IPRT_WITH_ALIGNMENT_CHECKS
514 /*
515 * Enable alignment checks.
516 */
517 const char *pszAlignmentChecks = getenv("IPRT_ALIGNMENT_CHECKS");
518 g_fRTAlignmentChecks = pszAlignmentChecks != NULL
519 && pszAlignmentChecks[0] == '1'
520 && pszAlignmentChecks[1] == '\0';
521 if (g_fRTAlignmentChecks)
522 IPRT_ALIGNMENT_CHECKS_ENABLE();
523#endif
524
525 /*
526 * Final native initialization.
527 */
528 rc = rtR3InitNativeFinal(fFlags);
529 AssertMsgRCReturn(rc, ("rtR3InitNativeFinal failed with %Rrc\n", rc), rc);
530
531 return VINF_SUCCESS;
532}
533
534
535/**
536 * Internal initialization worker.
537 *
538 * @returns IPRT status code.
539 * @param fFlags Flags, see RTR3INIT_XXX.
540 * @param cArgs Pointer to the argument count.
541 * @param ppapszArgs Pointer to the argument vector pointer. NULL
542 * allowed if @a cArgs is 0.
543 * @param pszProgramPath The program path. Pass NULL if we're to figure it
544 * out ourselves.
545 */
546static int rtR3Init(uint32_t fFlags, int cArgs, char ***ppapszArgs, const char *pszProgramPath)
547{
548 /* no entry log flow, because prefixes and thread may freak out. */
549 Assert(!(fFlags & ~( RTR3INIT_FLAGS_DLL
550 | RTR3INIT_FLAGS_SUPLIB
551 | RTR3INIT_FLAGS_UNOBTRUSIVE
552 | RTR3INIT_FLAGS_UTF8_ARGV
553 | RTR3INIT_FLAGS_STANDALONE_APP)));
554 Assert(!(fFlags & RTR3INIT_FLAGS_DLL) || cArgs == 0);
555
556 /*
557 * Do reference counting, only initialize the first time around.
558 *
559 * We are ASSUMING that nobody will be able to race RTR3Init* calls when the
560 * first one, the real init, is running (second assertion).
561 */
562 int32_t cUsers = ASMAtomicIncS32(&g_cUsers);
563 if (cUsers != 1)
564 {
565 AssertMsg(cUsers > 1, ("%d\n", cUsers));
566 Assert(!g_fInitializing);
567#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
568 if (fFlags & RTR3INIT_FLAGS_SUPLIB)
569 {
570 SUPR3Init(NULL);
571 g_fInitFlags |= RTR3INIT_FLAGS_SUPLIB;
572 }
573#endif
574 g_fInitFlags |= fFlags & RTR3INIT_FLAGS_UTF8_ARGV;
575
576 if ( !(fFlags & RTR3INIT_FLAGS_UNOBTRUSIVE)
577 && (g_fInitFlags & RTR3INIT_FLAGS_UNOBTRUSIVE))
578 {
579 g_fInitFlags &= ~RTR3INIT_FLAGS_UNOBTRUSIVE;
580 g_fInitFlags |= fFlags & RTR3INIT_FLAGS_STANDALONE_APP;
581 rtR3InitNativeObtrusive(g_fInitFlags | fFlags);
582 rtThreadReInitObtrusive();
583 }
584 else
585 Assert(!(fFlags & RTR3INIT_FLAGS_STANDALONE_APP) || (g_fInitFlags & RTR3INIT_FLAGS_STANDALONE_APP));
586
587 int rc = VINF_SUCCESS;
588 if (pszProgramPath)
589 rc = rtR3InitProgramPath(pszProgramPath);
590 if (RT_SUCCESS(rc))
591 rc = rtR3InitArgv(fFlags, cArgs, ppapszArgs);
592 return rc;
593 }
594 ASMAtomicWriteBool(&g_fInitializing, true);
595
596 /*
597 * Do the initialization.
598 */
599 int rc = rtR3InitBody(fFlags, cArgs, ppapszArgs, pszProgramPath);
600 if (RT_FAILURE(rc))
601 {
602 /* failure */
603 ASMAtomicWriteBool(&g_fInitializing, false);
604 ASMAtomicDecS32(&g_cUsers);
605 return rc;
606 }
607
608 /* success */
609 LogFlow(("rtR3Init: returns VINF_SUCCESS\n"));
610 ASMAtomicWriteBool(&g_fInitializing, false);
611 return VINF_SUCCESS;
612}
613
614
615RTR3DECL(int) RTR3InitExe(int cArgs, char ***ppapszArgs, uint32_t fFlags)
616{
617 Assert(!(fFlags & RTR3INIT_FLAGS_DLL));
618 return rtR3Init(fFlags, cArgs, ppapszArgs, NULL);
619}
620
621
622RTR3DECL(int) RTR3InitExeNoArguments(uint32_t fFlags)
623{
624 Assert(!(fFlags & RTR3INIT_FLAGS_DLL));
625 return rtR3Init(fFlags, 0, NULL, NULL);
626}
627
628
629RTR3DECL(int) RTR3InitDll(uint32_t fFlags)
630{
631 Assert(!(fFlags & RTR3INIT_FLAGS_DLL));
632 return rtR3Init(fFlags | RTR3INIT_FLAGS_DLL, 0, NULL, NULL);
633}
634
635
636RTR3DECL(int) RTR3InitEx(uint32_t iVersion, uint32_t fFlags, int cArgs, char ***ppapszArgs, const char *pszProgramPath)
637{
638 AssertReturn(iVersion == RTR3INIT_VER_CUR, VERR_NOT_SUPPORTED);
639 return rtR3Init(fFlags, cArgs, ppapszArgs, pszProgramPath);
640}
641
642
643RTR3DECL(bool) RTR3InitIsInitialized(void)
644{
645 return g_cUsers >= 1 && !g_fInitializing;
646}
647
648
649RTR3DECL(bool) RTR3InitIsUnobtrusive(void)
650{
651 return RT_BOOL(g_fInitFlags & RTR3INIT_FLAGS_UNOBTRUSIVE);
652}
653
654
655#if 0 /** @todo implement RTR3Term. */
656RTR3DECL(void) RTR3Term(void)
657{
658}
659#endif
660
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette