From: giwoong.kim Date: Thu, 11 Apr 2013 03:14:00 +0000 (+0900) Subject: emulator: removed unnecessary code X-Git-Tag: TizenStudio_2.0_p2.3~883 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd9f9387e2624a984c4ae4ddd6b36d90902b230d;p=sdk%2Femulator%2Fqemu.git emulator: removed unnecessary code removed unnecessary code & etc Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index c7abf6d..c44d999 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -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 @@ -95,6 +95,11 @@ static char **_skin_argv; static int _qemu_argc; static char **_qemu_argv; +#if defined(CONFIG_LINUX) +#include +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(); } diff --git a/tizen/src/maru_sdl.c b/tizen/src/maru_sdl.c index 62ad27b..9fbec5c 100644 --- a/tizen/src/maru_sdl.c +++ b/tizen/src/maru_sdl.c @@ -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 @@ -39,9 +39,6 @@ #include "hw/maru_pm.h" #include "hw/maru_brightness.h" #include "debug_ch.h" -#if defined(CONFIG_LINUX) -#include -#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 } diff --git a/tizen/src/osutil-darwin.c b/tizen/src/osutil-darwin.c index 8948496..3298b55 100644 --- a/tizen/src/osutil-darwin.c +++ b/tizen/src/osutil-darwin.c @@ -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) diff --git a/tizen/src/osutil-linux.c b/tizen/src/osutil-linux.c index 0de15e5..f294449 100644 --- a/tizen/src/osutil-linux.c +++ b/tizen/src/osutil-linux.c @@ -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) diff --git a/tizen/src/osutil-win32.c b/tizen/src/osutil-win32.c index 3dbde81..ad5ef10 100644 --- a/tizen/src/osutil-win32.c +++ b/tizen/src/osutil-win32.c @@ -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); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java index 6cd1bde..510be6e 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShmSkin.java @@ -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() { diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index b6ade33..476c063 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -35,6 +35,7 @@ #include #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" @@ -55,11 +56,6 @@ #include "target-i386/hax-i386.h" #endif -#if defined(CONFIG_USE_SHM) && defined(TARGET_I386) -#include -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;