summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/sunos.c
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2012-08-07 01:25:06 +0200
committerBert Belder <bertbelder@gmail.com>2012-08-07 01:57:56 +0200
commite0a603a4993e995080a8926fcddbbde752a2136e (patch)
tree34a57a6d3217c06550da581635dea57799fba176 /deps/uv/src/unix/sunos.c
parent9e55ba7d6bbfeaa867e0f151dd27bc0ba034cad7 (diff)
downloadandroid-node-v8-e0a603a4993e995080a8926fcddbbde752a2136e.tar.gz
android-node-v8-e0a603a4993e995080a8926fcddbbde752a2136e.tar.bz2
android-node-v8-e0a603a4993e995080a8926fcddbbde752a2136e.zip
uv: upgrade to 3a8bb3b
Diffstat (limited to 'deps/uv/src/unix/sunos.c')
-rw-r--r--deps/uv/src/unix/sunos.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/deps/uv/src/unix/sunos.c b/deps/uv/src/unix/sunos.c
index a33ec9d98b..8c626a3a7a 100644
--- a/deps/uv/src/unix/sunos.c
+++ b/deps/uv/src/unix/sunos.c
@@ -127,7 +127,7 @@ static void uv__fs_event_rearm(uv_fs_event_t *handle) {
static void uv__fs_event_read(uv_loop_t* loop, uv__io_t* w, int revents) {
- uv_fs_event_t *handle;
+ uv_fs_event_t *handle = NULL;
timespec_t timeout;
port_event_t pe;
int events;
@@ -137,14 +137,23 @@ static void uv__fs_event_read(uv_loop_t* loop, uv__io_t* w, int revents) {
(void) revents;
do {
- /* TODO use port_getn() */
+ uint_t n = 1;
+
+ /*
+ * Note that our use of port_getn() here (and not port_get()) is deliberate:
+ * there is a bug in event ports (Sun bug 6456558) whereby a zeroed timeout
+ * causes port_get() to return success instead of ETIME when there aren't
+ * actually any events (!); by using port_getn() in lieu of port_get(),
+ * we can at least workaround the bug by checking for zero returned events
+ * and treating it as we would ETIME.
+ */
do {
memset(&timeout, 0, sizeof timeout);
- r = port_get(loop->fs_fd, &pe, &timeout);
+ r = port_getn(loop->fs_fd, &pe, 1, &n, &timeout);
}
while (r == -1 && errno == EINTR);
- if (r == -1 && errno == ETIME)
+ if ((r == -1 && errno == ETIME) || n == 0)
break;
handle = (uv_fs_event_t *)pe.portev_user;
@@ -161,7 +170,7 @@ static void uv__fs_event_read(uv_loop_t* loop, uv__io_t* w, int revents) {
}
while (handle->fd != PORT_DELETED);
- if (handle->fd != PORT_DELETED)
+ if (handle != NULL && handle->fd != PORT_DELETED)
uv__fs_event_rearm(handle);
}