[Title]fix : add socket initializing
authormunkyu.im <munkyu.im@samsung.com>
Sun, 18 Mar 2012 15:16:48 +0000 (00:16 +0900)
committermunkyu.im <munkyu.im@samsung.com>
Sun, 18 Mar 2012 15:16:48 +0000 (00:16 +0900)
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

tizen/src/debug_ch.c
tizen/src/emulator.c
vl.c

index 43bd74d..2c24b06 100644 (file)
 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");
index b36f7e0..729e04a 100644 (file)
@@ -43,6 +43,7 @@
 #include "process.h"
 #include "option.h"
 #include "emul_state.h"
+#include "qemu_socket.h"
 
 #ifdef _WIN32
 #include <winsock2.h>
@@ -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 (file)
--- 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