From 620c9830a2627a808b0ffc5d64602b2f5a94d0e5 Mon Sep 17 00:00:00 2001 From: "munkyu.im" Date: Mon, 19 Mar 2012 00:16:48 +0900 Subject: [PATCH] [Title]fix : add socket initializing [Type] [Module] [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- tizen/src/debug_ch.c | 17 ++++++----------- tizen/src/emulator.c | 24 +++++++++++++----------- vl.c | 2 -- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/tizen/src/debug_ch.c b/tizen/src/debug_ch.c index 43bd74d..2c24b06 100644 --- a/tizen/src/debug_ch.c +++ b/tizen/src/debug_ch.c @@ -40,12 +40,12 @@ extern STARTUP_OPTION startup_option; #endif -static char logfile[512] = {0,}; +static char logpath[512] = {0,}; static char debugchfile[256] = {0, }; void set_log_path(char *path) { - strcpy(logfile, path); + strcpy(logpath, path); } static inline int interlocked_xchg_add( int *dest, int incr ) @@ -303,13 +303,8 @@ static void debug_init(void) free(tmp); } -#if 0 - strcpy(logfile, get_virtual_target_abs_path(startup_option.vtm)); - strcat(logfile, "logs/emulator.log"); -#endif - - if(access(logfile, F_OK | R_OK) == 0) - remove(logfile); + if(access(logpath, F_OK | R_OK) == 0) + remove(logpath); } /* allocate some tmp string space */ @@ -353,7 +348,7 @@ static int dbg_vprintf( const char *format, va_list args ) sprintf(txt, "%s", tmp); // unlock - if ((fp = fopen(logfile, "a+")) == NULL) { + if ((fp = fopen(logpath, "a+")) == NULL) { fprintf(stdout, "Emulator can't open.\n" "Please check if " "this binary file is running on the right path.\n"); @@ -431,7 +426,7 @@ int dbg_log( enum _debug_class cls, struct _debug_channel *channel, ret += vsnprintf(buf + ret, sizeof(buf) - ret, format, valist ); va_end(valist); - if ((fp = fopen(logfile, "a+")) == NULL) { + if ((fp = fopen(logpath, "a+")) == NULL) { fprintf(stdout, "Emulator can't open.\n" "Please check if " "this binary file is running on the right path.\n"); diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index b36f7e0..729e04a 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -43,6 +43,7 @@ #include "process.h" #include "option.h" #include "emul_state.h" +#include "qemu_socket.h" #ifdef _WIN32 #include @@ -63,7 +64,7 @@ int tizen_base_port = 0; int _emulator_condition = 0; //TODO: static char tizen_target_path[MAXLEN] = {0, }; -static char logfile[MAXLEN] = { 0, }; +static char logpath[MAXLEN] = { 0, }; int get_emulator_condition(void) { @@ -154,29 +155,29 @@ void set_image_and_log_path(char* qemu_argv) else strcpy(tizen_target_path, g_path_get_dirname(path)); - strcpy(logfile, tizen_target_path); - strcat(logfile, LOGS_SUFFIX); + strcpy(logpath, tizen_target_path); + strcat(logpath, LOGS_SUFFIX); #ifdef _WIN32 - if(access(g_win32_locale_filename_from_utf8(logfile), R_OK) != 0) { - g_mkdir(g_win32_locale_filename_from_utf8(logfile), 0755); + if(access(g_win32_locale_filename_from_utf8(logpath), R_OK) != 0) { + g_mkdir(g_win32_locale_filename_from_utf8(logpath), 0755); } #else - if(access(logfile, R_OK) != 0) { - g_mkdir(logfile, 0755); + if(access(logpath, R_OK) != 0) { + g_mkdir(logpath, 0755); } #endif - strcat(logfile, LOGFILE); - set_log_path(logfile); + strcat(logpath, LOGFILE); + set_log_path(logpath); } void redir_output(void) { FILE *fp; - fp = freopen(logfile, "a+", stdout); + fp = freopen(logpath, "a+", stdout); if(fp ==NULL) fprintf(stderr, "log file open error\n"); - fp = freopen(logfile, "a+", stderr); + fp = freopen(logpath, "a+", stderr); if(fp ==NULL) fprintf(stderr, "log file open error\n"); @@ -228,6 +229,7 @@ int main(int argc, char* argv[]) char** qemu_argv = NULL; parse_options(argc, argv, &skin_argc, &skin_argv, &qemu_argc, &qemu_argv); + socket_init(); extract_info(qemu_argc, qemu_argv); INFO("Emulator start !!!\n"); diff --git a/vl.c b/vl.c index f9af8f9..82148f0 100644 --- a/vl.c +++ b/vl.c @@ -3282,8 +3282,6 @@ int main(int argc, char **argv, char **envp) if (default_vga) vga_interface_type = VGA_CIRRUS; - socket_init(); - if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0) exit(1); #ifdef CONFIG_VIRTFS -- 2.7.4