OLD | NEW |
1 diff --git a/configure b/configure | 1 diff --git a/configure b/configure |
2 --- a/configure | 2 --- a/configure |
3 +++ b/configure | 3 +++ b/configure |
4 @@ -13123,7 +13123,9 @@ else | 4 @@ -13123,7 +13136,9 @@ else |
5 $as_echo "yes" >&6; } | 5 $as_echo "yes" >&6; } |
6 | 6 |
7 fi | 7 fi |
8 -NEEDED="pthread-stubs xau >= 0.99.2" | 8 -NEEDED="pthread-stubs xau >= 0.99.2" |
9 +# Dropped pthread-stubs since for nacl we can always build against pthreads. | 9 +# Dropped pthread-stubs since for nacl we can always build against pthreads. |
10 +# This avoids an unused package. | 10 +# This avoids an unused package. |
11 +NEEDED="xau >= 0.99.2" | 11 +NEEDED="xau >= 0.99.2" |
12 | 12 |
13 pkg_failed=no | 13 pkg_failed=no |
14 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NEEDED" >&5 | 14 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NEEDED" >&5 |
(...skipping 20 matching lines...) Expand all Loading... |
35 + va_end(ap); | 35 + va_end(ap); |
36 + return rtn; | 36 + return rtn; |
37 +} | 37 +} |
38 +#define fcntl nacl_fcntl | 38 +#define fcntl nacl_fcntl |
39 +#endif | 39 +#endif |
40 + | 40 + |
41 + | 41 + |
42 static int set_fd_flags(const int fd) | 42 static int set_fd_flags(const int fd) |
43 { | 43 { |
44 /* Win32 doesn't have file descriptors and the fcntl function. This block sets
the socket in non-blocking mode */ | 44 /* Win32 doesn't have file descriptors and the fcntl function. This block sets
the socket in non-blocking mode */ |
45 @@ -179,7 +199,8 @@ static int write_vec(xcb_connection_t *c, struct iovec **vec
tor, int *count) | |
46 int n; | |
47 assert(!c->out.queue_len); | |
48 | |
49 -#ifdef _WIN32 | |
50 + /* Using writev emulation for nacl newlib. */ | |
51 +#if defined(_WIN32) || (defined(__native_client__) && defined(_NEWLIB_VERSION)) | |
52 int i = 0; | |
53 int ret = 0,err = 0; | |
54 struct iovec *vec; | |
55 @@ -190,11 +211,26 @@ static int write_vec(xcb_connection_t *c, struct iovec **v
ector, int *count) | |
56 vec = *vector; | |
57 while(i < *count) | |
58 { | |
59 - ret = send(c->fd,vec->iov_base,vec->iov_len,0); | |
60 + /* | |
61 + * TODO(bradnelson): Drop if nacl_io supports zero length sends. | |
62 + * https://code.google.com/p/naclports/issues/detail?id=228 | |
63 + */ | |
64 + if (vec->iov_len != 0) { | |
65 + ret = send(c->fd,vec->iov_base,vec->iov_len,0); | |
66 + } else { | |
67 + ret = 0; | |
68 + } | |
69 + /* Generalize to posix so this can be used with nacl newlib. */ | |
70 +#if defined(__native_client__) && defined(_NEWLIB_VERSION) | |
71 + if(ret < 0) | |
72 + { | |
73 + if(errno == EWOULDBLOCK) | |
74 +#else | |
75 if(ret == SOCKET_ERROR) | |
76 { | |
77 err = WSAGetLastError(); | |
78 if(err == WSAEWOULDBLOCK) | |
79 +#endif | |
80 { | |
81 return 1; | |
82 } | |
OLD | NEW |