vbox: use with_libc

This commit is contained in:
Alexander Boettcher 2017-02-15 14:48:01 +01:00 committed by Christian Helmuth
parent 4eb04119a5
commit 9ba24c0722
2 changed files with 27 additions and 24 deletions

View File

@ -237,19 +237,20 @@ void Libc::Component::construct(Libc::Env &env)
/* enable stdout/stderr for VBox Log infrastructure */
init_libc_vbox_logger();
static char argv0[] = { '_', 'm', 'a', 'i', 'n', 0};
static char *argv[1] = { argv0 };
char **dummy_argv = argv;
Libc::with_libc([&] () {
static char argv0[] = { '_', 'm', 'a', 'i', 'n', 0};
static char *argv[1] = { argv0 };
char **dummy_argv = argv;
int rc = RTR3InitExe(1, &dummy_argv, 0);
if (RT_FAILURE(rc))
throw -1;
HRESULT hrc = setupmachine(env);
if (FAILED(hrc)) {
Genode::error("startup of VMM failed - reason ", hrc, " - exiting ...");
throw -2;
}
int rc = RTR3InitExe(1, &dummy_argv, 0);
if (RT_FAILURE(rc))
throw -1;
HRESULT hrc = setupmachine(env);
if (FAILED(hrc)) {
Genode::error("startup of VMM failed - reason ", hrc, " - exiting ...");
throw -2;
}
});
Genode::error("VMM exiting ...");
}

View File

@ -268,20 +268,22 @@ void Libc::Component::construct(Libc::Env &env)
/* enable stdout/stderr for VBox Log infrastructure */
init_libc_vbox_logger();
static char argv0[] = { '_', 'm', 'a', 'i', 'n', 0};
static char *argv[1] = { argv0 };
char **dummy_argv = argv;
Libc::with_libc([&] () {
static char argv0[] = { '_', 'm', 'a', 'i', 'n', 0};
static char *argv[1] = { argv0 };
char **dummy_argv = argv;
int rc = RTR3InitExe(1, &dummy_argv, 0);
if (RT_FAILURE(rc))
throw -1;
int rc = RTR3InitExe(1, &dummy_argv, 0);
if (RT_FAILURE(rc))
throw -1;
HRESULT hrc = setupmachine(env);
if (FAILED(hrc)) {
Genode::error("startup of VMM failed - reason ", hrc, " '",
RTErrCOMGet(hrc)->pszMsgFull, "' - exiting ...");
throw -2;
}
HRESULT hrc = setupmachine(env);
if (FAILED(hrc)) {
Genode::error("startup of VMM failed - reason ", hrc, " '",
RTErrCOMGet(hrc)->pszMsgFull, "' - exiting ...");
throw -2;
}
});
Genode::error("VMM exiting ...");
}