ecp: fix ioctl and windows socket initialized time for windows
authormunkyu.im <munkyu.im@samsung.com>
Tue, 30 Jul 2013 05:34:30 +0000 (14:34 +0900)
committermunkyu.im <munkyu.im@samsung.com>
Tue, 30 Jul 2013 05:34:30 +0000 (14:34 +0900)
Signed-off-by: munkyu.im <munkyu.im@samsung.com>
tizen/src/ecs.c
tizen/src/emulator.c

index 2527f64f8be5b73ec3cd5ae32a9d114a30c98ec7..da291e9bbc089c0a1e8d7bcfd9f205affedbabe9 100644 (file)
@@ -1003,11 +1003,23 @@ static void ecs_read(ECS_Client *cli) {
 
        int read = 0;
        int to_read_bytes = 0;
-       if (ioctl(cli->client_fd, FIONREAD, &to_read_bytes) < 0)
-       {
-               LOG("ioctl failed");
-               return;
-       }
+
+#ifndef __WIN32
+    if (ioctl(cli->client_fd, FIONREAD, &to_read_bytes) < 0)
+    {
+        LOG("ioctl failed");
+        return;
+    }
+       
+#else
+    unsigned long to_read_bytes_long = 0;
+    if (ioctlsocket(cli->client_fd, FIONREAD, &to_read_bytes_long) < 0)
+    {
+        LOG("ioctl failed");
+         return;
+    }
+     to_read_bytes = (int)to_read_bytes_long;
+#endif
 
        LOG("ioctl FIONREAD: %d\n", to_read_bytes);
        if (to_read_bytes == 0)
index 7e3905d7767e7c4adf93bce333cab503a2af7d20..5ca93e61581469ca6d36bfaaa982afdd9a54baa8 100644 (file)
@@ -365,7 +365,6 @@ static void prepare_basic_features(void)
     g_strlcpy(dns, DEFAULT_QEMU_DNS_IP, strlen(DEFAULT_QEMU_DNS_IP) + 1);
 
     check_vm_lock();
-    socket_init();
     make_vm_lock();
 
     sdb_setup(); /* determine the base port for emulator */
@@ -545,6 +544,9 @@ static int emulator_main(int argc, char *argv[])
     }
     fprintf(stdout, "\nskin args: =========================================\n");
 
+    INFO("socket initialize\n");
+    socket_init();
+
     INFO("qemu main start!\n");
     qemu_main(_qemu_argc, _qemu_argv, NULL);