summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/linux-core.c
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2014-02-26 18:08:30 -0800
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-02-26 18:08:30 -0800
commitcd08c8a0e5e99ed4933b87fc5e188afcd4299f73 (patch)
treec05e93d47f89df1f7a782ee9c70bb2c97d557cd4 /deps/uv/src/unix/linux-core.c
parentf3189ace6b5e31a874df421ac2f74da0e77cb14d (diff)
downloadandroid-node-v8-cd08c8a0e5e99ed4933b87fc5e188afcd4299f73.tar.gz
android-node-v8-cd08c8a0e5e99ed4933b87fc5e188afcd4299f73.tar.bz2
android-node-v8-cd08c8a0e5e99ed4933b87fc5e188afcd4299f73.zip
uv: Upgrade to v0.11.21
Diffstat (limited to 'deps/uv/src/unix/linux-core.c')
-rw-r--r--deps/uv/src/unix/linux-core.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c
index 4f11d88eed..97a5126f6a 100644
--- a/deps/uv/src/unix/linux-core.c
+++ b/deps/uv/src/unix/linux-core.c
@@ -107,6 +107,7 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
struct uv__epoll_event* events;
+ struct uv__epoll_event dummy;
uintptr_t i;
uintptr_t nfds;
@@ -114,13 +115,20 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
events = (struct uv__epoll_event*) loop->watchers[loop->nwatchers];
nfds = (uintptr_t) loop->watchers[loop->nwatchers + 1];
- if (events == NULL)
- return;
-
- /* Invalidate events with same file descriptor */
- for (i = 0; i < nfds; i++)
- if ((int) events[i].data == fd)
- events[i].data = -1;
+ if (events != NULL)
+ /* Invalidate events with same file descriptor */
+ for (i = 0; i < nfds; i++)
+ if ((int) events[i].data == fd)
+ events[i].data = -1;
+
+ /* Remove the file descriptor from the epoll.
+ * This avoids a problem where the same file description remains open
+ * in another process, causing repeated junk epoll events.
+ *
+ * We pass in a dummy epoll_event, to work around a bug in old kernels.
+ */
+ if (loop->backend_fd >= 0)
+ uv__epoll_ctl(loop->backend_fd, UV__EPOLL_CTL_DEL, fd, &dummy);
}
@@ -638,7 +646,7 @@ static int read_times(unsigned int numcpus, uv_cpu_info_t* ci) {
unsigned int n;
int r = sscanf(buf, "cpu%u ", &n);
assert(r == 1);
- (void) r; // silence build warning
+ (void) r; /* silence build warning */
for (len = sizeof("cpu0"); n /= 10; len++);
}