diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/oslib-posix.c | 25 | ||||
-rw-r--r-- | util/oslib-win32.c | 46 |
2 files changed, 8 insertions, 63 deletions
diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 6b69162498..997f24d21b 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -58,6 +58,7 @@ extern int daemon(int, int); #include "sysemu/sysemu.h" #include "trace.h" #include "qemu/sockets.h" +#include "qemu/error-report.h" #include <sys/mman.h> #include <libgen.h> #include <setjmp.h> @@ -92,28 +93,10 @@ int qemu_daemon(int nochdir, int noclose) void *qemu_oom_check(void *ptr) { -#ifdef CONFIG_MARU - const char _msg[] = "Failed to allocate memory in qemu."; - char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, }; - int len; -#endif - if (ptr == NULL) { - fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)); -#ifdef CONFIG_MARU - len = strlen(JAVA_EXEFILE_PATH) + strlen(JAVA_EXEOPTION) + - strlen(JAR_SKINFILE) + strlen(JAVA_SIMPLEMODE_OPTION) + - strlen(_msg) + 7; - if (len > JAVA_MAX_COMMAND_LENGTH) { - len = JAVA_MAX_COMMAND_LENGTH; - } - - snprintf(cmd, len, "%s %s %s %s=\"%s\"", - JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE, JAVA_SIMPLEMODE_OPTION, _msg); - if (system(cmd) == -1) { - fprintf(stderr, "failed to execute this command: %s\n", cmd); - } -#endif +// CONFIG_MARU MODIFICATION + //fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)); + error_report("Failed to allocate memory: %s", strerror(errno)); abort(); } return ptr; diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 520f2fac7e..de9fd7e288 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -37,6 +37,7 @@ #include "qemu/main-loop.h" #include "trace.h" #include "qemu/sockets.h" +#include "qemu/error-report.h" /* this must come after including "trace.h" */ #include <shlobj.h> @@ -151,49 +152,10 @@ bool get_java_path(char **java_path) void *qemu_oom_check(void *ptr) { -#ifdef CONFIG_MARU - const char _msg[] = "Failed to allocate memory in qemu."; - char cmd[JAVA_MAX_COMMAND_LENGTH] = { 0, }; - char *JAVA_EXEFILE_PATH = NULL; - int len, ret; -#endif - if (ptr == NULL) { - fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError()); -#ifdef CONFIG_MARU - JAVA_EXEFILE_PATH = malloc(JAVA_MAX_COMMAND_LENGTH); - if (!JAVA_EXEFILE_PATH) { - // TODO: print error message. - return ptr; - } - - memset(JAVA_EXEFILE_PATH, 0, JAVA_MAX_COMMAND_LENGTH); - if (is_wow64()) { - if (!get_java_path(&JAVA_EXEFILE_PATH)) { - strcpy(JAVA_EXEFILE_PATH, "java"); - } - } else { - strcpy(JAVA_EXEFILE_PATH, "java"); - } - len = strlen(JAVA_EXEFILE_PATH) + strlen(JAVA_EXEOPTION) + - strlen(JAR_SKINFILE) + strlen(JAVA_SIMPLEMODE_OPTION) + - strlen(_msg) + 7; - if (len > JAVA_MAX_COMMAND_LENGTH) { - len = JAVA_MAX_COMMAND_LENGTH; - } - - snprintf(cmd, len, "%s %s %s %s=\"%s\"", - JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE, - JAVA_SIMPLEMODE_OPTION, _msg); - ret = WinExec(cmd, SW_SHOW); - if (ret < 32) { - // TODO: error handling... - } - - /* for 64bit windows */ - free(JAVA_EXEFILE_PATH); - JAVA_EXEFILE_PATH=0; -#endif +// CONFIG_MARU MODIFICATION + //fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError()); + error_report("Failed to allocate memory: %lu", GetLastError()); abort(); } return ptr; |