[Title] memory exception popup
authorgiwoong.kim <giwoong.kim@samsung.com>
Fri, 4 May 2012 10:35:20 +0000 (19:35 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Fri, 4 May 2012 10:35:20 +0000 (19:35 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

oslib-posix.c
oslib-win32.c
tizen/src/skin/maruskin_client.c

index ce755496b5baf3b7f334185db478f2871dbba249..cf5d18bde69ffa5708f3991b40c583f829dd2e07 100644 (file)
@@ -61,10 +61,39 @@ int qemu_daemon(int nochdir, int noclose)
     return daemon(nochdir, noclose);
 }
 
+#ifdef CONFIG_MARU
+//TODO: temp
+#define JAR_SKINFILE_PATH "emulator-skin.jar"
+#define JAVA_EXEFILE_PATH "java"
+#define JAVA_EXEOPTION "-jar"
+#define MAX_COMMAND 512
+
+static int start_simple_client(char* msg) {
+    int ret = 0;
+    char cmd[MAX_COMMAND] = {0};
+
+    sprintf(cmd, "%s %s %s %s=\"%s\"", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, "simple.msg", msg);
+
+#ifdef __WIN32
+    ret = WinExec(cmd, SW_SHOW);
+#else
+    ret = system(cmd);
+#endif
+
+    return 1;
+}
+#endif
+
 void *qemu_oom_check(void *ptr)
 {
     if (ptr == NULL) {
         fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno));
+
+#ifdef CONFIG_MARU
+        char _msg[] = "Failed to allocate memory in qemu";
+        start_simple_client(_msg);
+#endif
+
         abort();
     }
     return ptr;
index 5e3de7dc8a52cf1b6131d8764f97ec4e23a5c3c3..586d8028212a99c714df69af55da6c2339b130a1 100644 (file)
 #include "trace.h"
 #include "qemu_socket.h"
 
+#ifdef CONFIG_MARU
+//TODO: temp
+#define JAR_SKINFILE_PATH "emulator-skin.jar"
+#define JAVA_EXEFILE_PATH "java"
+#define JAVA_EXEOPTION "-jar"
+#define MAX_COMMAND 512
+
+static int start_simple_client(char* msg) {
+    int ret = 0;
+    char cmd[MAX_COMMAND] = {0};
+
+    sprintf(cmd, "%s %s %s %s=\"%s\"", JAVA_EXEFILE_PATH, JAVA_EXEOPTION, JAR_SKINFILE_PATH, "simple.msg", msg);
+
+#ifdef __WIN32
+    ret = WinExec(cmd, SW_SHOW);
+#else
+    ret = system(cmd);
+#endif
+
+    return 1;
+}
+#endif
+
 void *qemu_oom_check(void *ptr)
 {
     if (ptr == NULL) {
         fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());
+
+#ifdef CONFIG_MARU
+        char _msg[] = "Failed to allocate memory in qemu";
+        start_simple_client(_msg);
+#endif
+
         abort();
     }
     return ptr;
index 458c6542d3a829ea9ebbffb6b975dd9797473b2c..f1950316be955a87c744980f6a4c47b3b76b2331 100644 (file)
@@ -132,11 +132,14 @@ static void* run_skin_client(void* arg)
         }
 
         //retrieves the termination status of the specified process
-        GetExitCodeProcess(pi.hProcess, &dwRet);
+        if (GetExitCodeProcess(pi.hProcess, &dwRet) != 0) {
+            ERR("failed to GetExitCodeProcess, error %u\n", GetLastError());
+        }
         INFO("child return value : %d\n", dwRet);
 
         if (dwRet == -1) {
-            //TODO:
+            //child process is terminated with some problem.
+            //so qemu process will terminate, too. immediately.
             exit(1);
         }
 
@@ -161,7 +164,8 @@ static void* run_skin_client(void* arg)
         INFO("child return value : %d\n", ret);
 
         if (ret == 0xff) {
-            //TODO:
+            //child process is terminated with some problem.
+            //so qemu process will terminate, too. immediately.
             exit(1);
         }
     }