aboutsummaryrefslogtreecommitdiffstats
path: root/android/hw-pipe-net.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-06-21 10:01:01 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-06-21 10:03:09 +0200
commit82e6277377df841b6493d2ac5a30f2ab767fb156 (patch)
tree9d33cbdc14577aa83e8f151ad8315115b90a8997 /android/hw-pipe-net.c
parent883f5bc37badb1bbd0d61823993911679feb1826 (diff)
downloadexternal_qemu-82e6277377df841b6493d2ac5a30f2ab767fb156.zip
external_qemu-82e6277377df841b6493d2ac5a30f2ab767fb156.tar.gz
external_qemu-82e6277377df841b6493d2ac5a30f2ab767fb156.tar.bz2
qemu pipes: fix Windows network pipes.
Never use read() or write() when using sockets on Windows, use recv() / send() instead. + Remove compiler warning on Windows. Change-Id: I53de04ceb3bad20dfebcbd8279506db87388a578
Diffstat (limited to 'android/hw-pipe-net.c')
-rw-r--r--android/hw-pipe-net.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/android/hw-pipe-net.c b/android/hw-pipe-net.c
index d83d8b1..86a6182 100644
--- a/android/hw-pipe-net.c
+++ b/android/hw-pipe-net.c
@@ -251,7 +251,7 @@ netPipe_sendBuffers( void* opaque, const GoldfishPipeBuffer* buffers, int numBuf
buff = buffers;
while (count > 0) {
int avail = buff->size - buffStart;
- int len = write(pipe->io->fd, buff->data + buffStart, avail);
+ int len = socket_send(pipe->io->fd, buff->data + buffStart, avail);
/* the write succeeded */
if (len > 0) {
@@ -272,10 +272,6 @@ netPipe_sendBuffers( void* opaque, const GoldfishPipeBuffer* buffers, int numBuf
break;
}
- /* loop on EINTR */
- if (errno == EINTR)
- continue;
-
/* if we already wrote some stuff, simply return */
if (ret > 0) {
break;
@@ -309,7 +305,7 @@ netPipe_recvBuffers( void* opaque, GoldfishPipeBuffer* buffers, int numBuffers
buff = buffers;
while (count > 0) {
int avail = buff->size - buffStart;
- int len = read(pipe->io->fd, buff->data + buffStart, avail);
+ int len = socket_recv(pipe->io->fd, buff->data + buffStart, avail);
/* the read succeeded */
if (len > 0) {
@@ -330,10 +326,6 @@ netPipe_recvBuffers( void* opaque, GoldfishPipeBuffer* buffers, int numBuffers
break;
}
- /* loop on EINTR */
- if (errno == EINTR)
- continue;
-
/* if we already read some stuff, simply return */
if (ret > 0) {
break;
@@ -436,6 +428,7 @@ netPipe_initTcp( void* hwpipe, void* _looper, const char* args )
return ret;
}
+#ifndef _WIN32
void*
netPipe_initUnix( void* hwpipe, void* _looper, const char* args )
{
@@ -459,7 +452,7 @@ netPipe_initUnix( void* hwpipe, void* _looper, const char* args )
sock_address_done(&address);
return ret;
}
-
+#endif
/**********************************************************************
**********************************************************************
@@ -477,6 +470,7 @@ static const GoldfishPipeFuncs netPipeTcp_funcs = {
netPipe_wakeOn,
};
+#ifndef _WIN32
static const GoldfishPipeFuncs netPipeUnix_funcs = {
netPipe_initUnix,
netPipe_closeFromGuest,
@@ -485,7 +479,7 @@ static const GoldfishPipeFuncs netPipeUnix_funcs = {
netPipe_poll,
netPipe_wakeOn,
};
-
+#endif
#define DEFAULT_OPENGLES_PORT 22468
@@ -515,6 +509,8 @@ android_net_pipes_init(void)
Looper* looper = looper_newCore();
goldfish_pipe_add_type( "tcp", looper, &netPipeTcp_funcs );
+#ifndef _WIN32
goldfish_pipe_add_type( "unix", looper, &netPipeUnix_funcs );
+#endif
goldfish_pipe_add_type( "opengles", looper, &openglesPipe_funcs );
}