diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2011-02-07 14:14:14 -0800 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2011-02-07 14:49:09 -0800 |
commit | 17ecca637df2f573edc3ecb8246c0e38a5b32465 (patch) | |
tree | bc05a46566ad888b4659b048851b1e32a9fb5b92 /android | |
parent | 9af6946145bea73b16f1a128838048b917474f27 (diff) | |
download | external_qemu-17ecca637df2f573edc3ecb8246c0e38a5b32465.zip external_qemu-17ecca637df2f573edc3ecb8246c0e38a5b32465.tar.gz external_qemu-17ecca637df2f573edc3ecb8246c0e38a5b32465.tar.bz2 |
Fix emulator core and UI on Windows
There are two parts in this CL:
1. Fixing the Windows build (missing set_fd_handler)
2. Replacing read/write with socket_recv/socket_send.
Change-Id: I5fa599774260257d481b738a892e1124135fc319
Diffstat (limited to 'android')
-rw-r--r-- | android/async-utils.c | 8 | ||||
-rw-r--r-- | android/main-ui.c | 4 | ||||
-rw-r--r-- | android/protocol/fb-updates-impl.c | 4 | ||||
-rw-r--r-- | android/protocol/ui-commands-impl.c | 5 | ||||
-rw-r--r-- | android/sync-utils.c | 5 |
5 files changed, 16 insertions, 10 deletions
diff --git a/android/async-utils.c b/android/async-utils.c index 678b0b4..a66e32f 100644 --- a/android/async-utils.c +++ b/android/async-utils.c @@ -40,7 +40,7 @@ asyncReader_read(AsyncReader* ar, } do { - ret = read(io->fd, ar->buffer + ar->pos, ar->buffsize - ar->pos); + ret = socket_recv(io->fd, ar->buffer + ar->pos, ar->buffsize - ar->pos); if (ret == 0) { /* disconnection ! */ errno = ECONNRESET; @@ -87,7 +87,7 @@ asyncWriter_write(AsyncWriter* aw, } do { - ret = write(io->fd, aw->buffer + aw->pos, aw->buffsize - aw->pos); + ret = socket_send(io->fd, aw->buffer + aw->pos, aw->buffsize - aw->pos); if (ret == 0) { /* disconnection ! */ errno = ECONNRESET; @@ -136,7 +136,7 @@ asyncLineReader_read(AsyncLineReader* alr, do { char ch; - ret = read(io->fd, &ch, 1); + ret = socket_recv(io->fd, &ch, 1); if (ret == 0) { /* disconnection ! */ errno = ECONNRESET; @@ -247,7 +247,7 @@ asyncConnector_run(AsyncConnector* ac, LoopIo* io) /* We need to read the socket error to determine if * the connection was really succesful or not. This * is optional, because in case of error a future - * read() or write() will fail anyway, but this + * socket_recv() or socket_send() will fail anyway, but this * allows us to get a better error value as soon as * possible. */ diff --git a/android/main-ui.c b/android/main-ui.c index daf71cb..9e511c7 100644 --- a/android/main-ui.c +++ b/android/main-ui.c @@ -502,6 +502,10 @@ int main(int argc, char **argv) exit(1); } +#ifdef _WIN32 + socket_init(); +#endif + // Lets see if user just wants to list core process. if (opts->list_cores) { fprintf(stdout, "Enumerating running core processes.\n"); diff --git a/android/protocol/fb-updates-impl.c b/android/protocol/fb-updates-impl.c index fa4b304..dde79c1 100644 --- a/android/protocol/fb-updates-impl.c +++ b/android/protocol/fb-updates-impl.c @@ -113,8 +113,8 @@ _fbUpdatesImpl_io_callback(void* opaque, int fd, unsigned events) // Read updates while they are immediately available. for (;;) { // Read next chunk of data. - ret = read(fbi->sock, fbi->reader_buffer + fbi->reader_offset, - fbi->reader_bytes - fbi->reader_offset); + ret = socket_recv(fbi->sock, fbi->reader_buffer + fbi->reader_offset, + fbi->reader_bytes - fbi->reader_offset); if (ret == 0) { /* disconnection ! */ fbUpdatesImpl_destroy(); diff --git a/android/protocol/ui-commands-impl.c b/android/protocol/ui-commands-impl.c index e933d57..2ceeca1 100644 --- a/android/protocol/ui-commands-impl.c +++ b/android/protocol/ui-commands-impl.c @@ -124,8 +124,9 @@ _uiCmdImpl_io_callback(void* opaque, int fd, unsigned events) // Read requests while they are immediately available. for (;;) { // Read next chunk of data. - status = read(uicmd->sock, uicmd->reader_buffer + uicmd->reader_offset, - uicmd->reader_bytes - uicmd->reader_offset); + status = socket_recv(uicmd->sock, + uicmd->reader_buffer + uicmd->reader_offset, + uicmd->reader_bytes - uicmd->reader_offset); if (status == 0) { /* Disconnection, meaning that the core process got terminated. */ fprintf(stderr, "core-ui-control service got disconnected\n"); diff --git a/android/sync-utils.c b/android/sync-utils.c index 6d3cea6..617ba8b 100644 --- a/android/sync-utils.c +++ b/android/sync-utils.c @@ -74,6 +74,7 @@ syncsocket_connect(int fd, SockAddress* sockaddr, int timeout) connect_status = iolooper_wait(looper, timeout); if (connect_status > 0) { iolooper_del_write(looper, fd); + break; } else { iolooper_free(looper); return NULL; @@ -184,7 +185,7 @@ syncsocket_read_absolute(SyncSocket* ssocket, return -1; } do { - ret = read(ssocket->fd, buf, size); + ret = socket_recv(ssocket->fd, buf, size); } while( ret < 0 && errno == EINTR); } else if (ret == 0) { // Timed out @@ -229,7 +230,7 @@ syncsocket_write_absolute(SyncSocket* ssocket, } do { - ret = write(ssocket->fd, (const char*)buf + written, size - written); + ret = socket_send(ssocket->fd, (const char*)buf + written, size - written); } while( ret < 0 && errno == EINTR); if (ret > 0) { |