emulator: removed unnecessary code
authorgiwoong.kim <giwoong.kim@samsung.com>
Thu, 11 Apr 2013 03:14:00 +0000 (12:14 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Thu, 11 Apr 2013 12:11:00 +0000 (21:11 +0900)
removed unnecessary code & etc

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/emulator.c
tizen/src/maru_sdl.c
tizen/src/osutil-darwin.c
tizen/src/osutil-linux.c
tizen/src/osutil-win32.c
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java
tizen/src/skin/maruskin_operation.c

index c7abf6d..c44d999 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Emulator
  *
- * Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact:
  * SeokYeon Hwang <syeon.hwang@samsung.com>
@@ -95,6 +95,11 @@ static char **_skin_argv;
 static int _qemu_argc;
 static char **_qemu_argv;
 
+#if defined(CONFIG_LINUX)
+#include <sys/shm.h>
+extern int g_shmid;
+#endif
+
 #ifdef CONFIG_DARWIN
 int thread_running = 1; /* Check if we need exit main */
 #endif
@@ -110,6 +115,14 @@ void exit_emulator(void)
     shutdown_skin_server();
     shutdown_guest_server();
 
+#if defined(CONFIG_LINUX)
+    /* clean up the vm lock memory by munkyu */
+    if (shmctl(g_shmid, IPC_RMID, 0) == -1) {
+        ERR("shmctl failed\n");
+        perror("emulator.c: ");
+    }
+#endif
+
     maru_display_fini();
 }
 
index 62ad27b..9fbec5c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SDL_WINDOWID hack
  *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact:
  * GiWoong Kim <giwoong.kim@samsung.com>
@@ -39,9 +39,6 @@
 #include "hw/maru_pm.h"
 #include "hw/maru_brightness.h"
 #include "debug_ch.h"
-#if defined(CONFIG_LINUX)
-#include <sys/shm.h>
-#endif
 /* #include "SDL_opengl.h" */
 
 MULTI_DEBUG_CHANNEL(tizen, maru_sdl);
@@ -60,8 +57,6 @@ static int current_screen_height;
 
 static int sdl_initialized;
 static int sdl_alteration;
-extern int g_shmid;
-extern char *g_shared_memory;
 
 static int sdl_skip_update;
 
@@ -579,13 +574,6 @@ void maruskin_sdl_quit(void)
     pthread_cond_destroy(&sdl_cond);
 #endif
     pthread_mutex_destroy(&sdl_mutex);
-
-#if defined(CONFIG_LINUX)
-    if (shmctl(g_shmid, IPC_RMID, 0) == -1) {
-        ERR("shmctl failed\n");
-        perror("maru_sdl.c: ");
-    }
-#endif
 }
 
 
index 8948496..3298b55 100644 (file)
@@ -84,29 +84,7 @@ void check_vm_lock_os(void)
 
 void make_vm_lock_os(void)
 {
-    int shmid;
-    char *shared_memory;
-
-    shmid = shmget((key_t)SHMKEY, MAXLEN, 0666|IPC_CREAT);
-    if (shmid == -1) {
-        ERR("shmget failed\n");
-        perror("osutil-darwin: ");
-        return;
-    }
-
-    shared_memory = shmat(shmid, (char *)0x00, 0);
-    if (shared_memory == (void *)-1) {
-        ERR("shmat failed\n");
-        perror("osutil-darwin: ");
-        return;
-    }
-    sprintf(shared_memory, "%d", tizen_base_port + 2);
-    INFO("shared memory key: %d, value: %s\n", SHMKEY, (char *)shared_memory);
-    
-    if (shmdt(shared_memory) == -1) {
-        ERR("shmdt failed\n");
-        perror("osutil-darwin: ");
-    }
+    /* TODO: */
 }
 
 void set_bin_path_os(gchar * exec_argv)
index 0de15e5..f294449 100644 (file)
@@ -102,21 +102,28 @@ void check_vm_lock_os(void)
 
 void make_vm_lock_os(void)
 {
-
     g_shmid = shmget((key_t)tizen_base_port, MAXLEN, 0666|IPC_CREAT);
     if (g_shmid == -1) {
         ERR("shmget failed\n");
+        perror("osutil-linux: ");
         return;
     }
 
     g_shared_memory = shmat(g_shmid, (char *)0x00, 0);
     if (g_shared_memory == (void *)-1) {
         ERR("shmat failed\n");
+        perror("osutil-linux: ");
         return;
     }
+
     g_sprintf(g_shared_memory, "%s", tizen_target_img_path);
     INFO("shared memory key: %d value: %s\n",
         tizen_base_port, (char *)g_shared_memory);
+
+    if (shmdt(g_shared_memory) == -1) {
+        ERR("shmdt failed\n");
+        perror("osutil-linux: ");
+    }
 }
 
 void set_bin_path_os(gchar * exec_argv)
index 3dbde81..ad5ef10 100644 (file)
@@ -60,6 +60,7 @@ void check_vm_lock_os(void)
     char *base_port = NULL;
     char *pBuf;
     HANDLE hMapFile;
+
     for (port = 26100; port < 26200; port += 10) {
         base_port = g_strdup_printf("%d", port);
         hMapFile = OpenFileMapping(FILE_MAP_READ, TRUE, base_port);
index 6cd1bde..510be6e 100644 (file)
@@ -85,6 +85,7 @@ public class EmulatorShmSkin extends EmulatorSkin {
                        this.imageData = new ImageData(lcdWidth, lcdHeight, COLOR_DEPTH, paletteData);
                        this.framebuffer = new Image(Display.getDefault(), imageData);
 
+                       setDaemon(true);
                        setWaitIntervalTime(30);
 
                        this.runnable = new Runnable() {
index b6ade33..476c063 100644 (file)
@@ -35,6 +35,7 @@
 #include <pthread.h>
 #include "maruskin_operation.h"
 #include "hw/maru_brightness.h"
+#include "hw/maru_virtio_hwkey.h"
 #include "maru_display.h"
 #include "emulator.h"
 #include "debug_ch.h"
 #include "target-i386/hax-i386.h"
 #endif
 
-#if defined(CONFIG_USE_SHM) && defined(TARGET_I386)
-#include <sys/shm.h>
-int g_shmid;
-#endif
-
 MULTI_DEBUG_CHANNEL(qemu, skin_operation);
 
 
@@ -577,13 +573,6 @@ static void* run_timed_shutdown_thread(void* args)
 
     INFO("Shutdown qemu !!!\n");
 
-#if defined(CONFIG_USE_SHM) && defined(TARGET_I386)
-    if (shmctl(g_shmid, IPC_RMID, 0) == -1) {
-        ERR("shmctl failed\n");
-        perror("maruskin_operation.c:g_shmid: ");
-    }
-#endif
-
     qemu_system_shutdown_request();
 
     return NULL;