#ifdef CONFIG_SDL
#include <SDL.h>
#endif
-#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN)
-#include <sys/ipc.h>
-#include <sys/shm.h>
-extern int g_shmid;
-#endif
#ifdef CONFIG_DARWIN
#include "ns_event.h"
qemu_add_exit_notifier(notify);
}
-void exit_emulator(void)
-{
- INFO("exit emulator!\n");
-
-#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN)
- if (shmctl(g_shmid, IPC_RMID, 0) == -1) {
- ERR("shmctl failed\n");
- perror("emulator.c: ");
- }
-#endif
-}
-
static void construct_main_window(int skin_argc, char *skin_argv[],
int qemu_argc, char *qemu_argv[])
{
make_vm_lock_os();
}
+static void remove_vm_lock(void)
+{
+ remove_vm_lock_os();
+}
+
+static void emulator_notify_exit(Notifier *notifier, void *data)
+{
+ remove_vm_lock();
+
+ int i;
+ for (i = 0; i < _qemu_argc; ++i) {
+ g_free(_qemu_argv[i]);
+ }
+ for (i = 0; i < _skin_argc; ++i) {
+ g_free(_skin_argv[i]);
+ }
+ reset_variables();
+
+ INFO("Exit emulator...\n");
+}
+
+static Notifier emulator_exit = { .notify = emulator_notify_exit };
+
static void print_system_info(void)
{
#define DIV 1024
print_system_info_os();
}
+static void print_options_info(void)
+{
+ int i;
+
+ fprintf(stdout, "qemu args: =========================================\n");
+ for (i = 0; i < _qemu_argc; ++i) {
+ fprintf(stdout, "%s ", _qemu_argv[i]);
+ }
+ fprintf(stdout, "\n====================================================\n");
+
+ fprintf(stdout, "skin args: =========================================\n");
+ for (i = 0; i < _skin_argc; ++i) {
+ fprintf(stdout, "%s ", _skin_argv[i]);
+ }
+ fprintf(stdout, "\n====================================================\n");
+}
+
#define PROXY_BUFFER_LEN 128
#define DEFAULT_QEMU_DNS_IP "10.0.2.3"
static void prepare_basic_features(gchar * const kernel_cmdline)
}
- INFO("Emulator start !!!\n");
+ INFO("Start emulator...\n");
atexit(maru_atexit);
+ emulator_add_exit_notifier(&emulator_exit);
print_system_info();
- INFO("Prepare running...\n");
- INFO("tizen_target_img_path: %s\n", tizen_target_img_path);
-
- int i;
-
- fprintf(stdout, "qemu args: =========================================\n");
- for (i = 0; i < _qemu_argc; ++i) {
- fprintf(stdout, "%s ", _qemu_argv[i]);
- }
- fprintf(stdout, "\nqemu args: =========================================\n");
+ print_options_info();
- fprintf(stdout, "skin args: =========================================\n");
- for (i = 0; i < _skin_argc; ++i) {
- fprintf(stdout, "%s ", _skin_argv[i]);
- }
- fprintf(stdout, "\nskin args: =========================================\n");
-
- INFO("socket initialize\n");
+ INFO("socket initialize...\n");
socket_init();
- INFO("qemu main start!\n");
+ INFO("qemu main start...\n");
qemu_main(_qemu_argc, _qemu_argv, envp);
- for (i = 0; i < _qemu_argc; ++i) {
- g_free(_qemu_argv[i]);
- }
- for (i = 0; i < _skin_argc; ++i) {
- g_free(_skin_argv[i]);
- }
- reset_variables();
-
- exit_emulator();
-
return 0;
}
strcat(log_path, LOGFILE);
}
+static void remove_vm_lock(void)
+{
+ remove_vm_lock_os();
+}
+
+static void emulator_notify_exit(Notifier *notifier, void *data)
+{
+ remove_vm_lock();
+
+ INFO("Exit emulator...\n");
+}
+
+static Notifier emulator_exit = { .notify = emulator_notify_exit };
+
static void redir_output(void)
{
FILE *fp;
INFO("Emulator start !!!\n");
atexit(maru_atexit);
+ emulator_add_exit_notifier(&emulator_exit);
extract_skin_info(_skin_argc, _skin_argv);
INFO("qemu main start!\n");
qemu_main(_qemu_argc, _qemu_argv, envp);
- exit_emulator();
-
return 0;
}
-/*
+/*
* Emulator
*
* Copyright (C) 2011, 2012 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact:
+ * Contact:
* SeokYeon Hwang <syeon.hwang@samsung.com>
* MunKyu Im <munkyu.im@samsung.com>
* GiWoong Kim <giwoong.kim@samsung.com>
#define GCONFTOOL 0
#define GSETTINGS 1
-extern const char *pac_tempfile;
+extern const char *pac_tempfile;
void check_vm_lock_os(void);
void make_vm_lock_os(void);
-void make_vm_unlock_os(void);
+void remove_vm_lock_os(void);
void set_bin_path_os(gchar *);