summaryrefslogtreecommitdiff
path: root/deps/uv
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-06-04 12:11:03 -0700
committerisaacs <i@izs.me>2013-06-04 12:11:03 -0700
commit96c30df10cdfa4d53083ae64ca9e11f9d1311988 (patch)
tree78603e93b16379162120f09ab9908436ab171f3a /deps/uv
parent414a909d01495eed2f6a411965c8984758322664 (diff)
downloadandroid-node-v8-96c30df10cdfa4d53083ae64ca9e11f9d1311988.tar.gz
android-node-v8-96c30df10cdfa4d53083ae64ca9e11f9d1311988.tar.bz2
android-node-v8-96c30df10cdfa4d53083ae64ca9e11f9d1311988.zip
uv: Upgrade to 0.10.10
Diffstat (limited to 'deps/uv')
-rw-r--r--deps/uv/AUTHORS1
-rw-r--r--deps/uv/ChangeLog19
-rw-r--r--deps/uv/include/uv.h23
-rw-r--r--deps/uv/src/unix/core.c5
-rw-r--r--deps/uv/src/unix/fs.c5
-rw-r--r--deps/uv/src/unix/linux-core.c111
-rw-r--r--deps/uv/src/uv-common.c5
-rw-r--r--deps/uv/src/version.c2
-rw-r--r--deps/uv/src/win/timer.c5
-rw-r--r--deps/uv/test/test-osx-select.c2
10 files changed, 113 insertions, 65 deletions
diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS
index 6f9b605f14..2172b03afe 100644
--- a/deps/uv/AUTHORS
+++ b/deps/uv/AUTHORS
@@ -83,3 +83,4 @@ Nils Maier <maierman@web.de>
Nicholas Vavilov <vvnicholas@gmail.com>
Miroslav Bajtoš <miro.bajtos@gmail.com>
Elliot Saba <staticfloat@gmail.com>
+Wynn Wilkes <wynnw@movenetworks.com>
diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog
index 1451180c8c..058b70a07e 100644
--- a/deps/uv/ChangeLog
+++ b/deps/uv/ChangeLog
@@ -1,4 +1,21 @@
-2013.05.29, Version 0.10.9 (Stable)
+2013.06.05, Version 0.10.10 (Stable)
+
+Changes since version 0.10.9:
+
+* include: document uv_update_time() and uv_now() (Ben Noordhuis)
+
+* linux: fix cpu model parsing on newer arm kernels (Ben Noordhuis)
+
+* linux: fix memory leak in uv_cpu_info() error path (Ben Noordhuis)
+
+* linux: don't ignore OOM errors in uv_cpu_info() (Ben Noordhuis)
+
+* unix, windows: move uv_now() to uv-common.c (Ben Noordhuis)
+
+* darwin: make uv_fs_sendfile() respect length param (Wynn Wilkes)
+
+
+2013.05.29, Version 0.10.9 (Stable), a195f9ace23d92345baf57582678bfc3017e6632
Changes since version 0.10.8:
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index dd83613122..c3c68cbb5f 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -287,7 +287,28 @@ UV_EXTERN void uv_stop(uv_loop_t*);
UV_EXTERN void uv_ref(uv_handle_t*);
UV_EXTERN void uv_unref(uv_handle_t*);
+/*
+ * Update the event loop's concept of "now". Libuv caches the current time
+ * at the start of the event loop tick in order to reduce the number of
+ * time-related system calls.
+ *
+ * You won't normally need to call this function unless you have callbacks
+ * that block the event loop for longer periods of time, where "longer" is
+ * somewhat subjective but probably on the order of a millisecond or more.
+ */
UV_EXTERN void uv_update_time(uv_loop_t*);
+
+/*
+ * Return the current timestamp in milliseconds. The timestamp is cached at
+ * the start of the event loop tick, see |uv_update_time()| for details and
+ * rationale.
+ *
+ * The timestamp increases monotonically from some arbitrary point in time.
+ * Don't make assumptions about the starting point, you will only get
+ * disappointed.
+ *
+ * Use uv_hrtime() if you need sub-milliseond granularity.
+ */
UV_EXTERN uint64_t uv_now(uv_loop_t*);
/*
@@ -1819,8 +1840,6 @@ UV_EXTERN extern uint64_t uv_hrtime(void);
* Note that this function works on a best-effort basis: there is no guarantee
* that libuv can discover all file descriptors that were inherited. In general
* it does a better job on Windows than it does on unix.
- *
- * TODO(bb): insert snarky remark to annoy bnoordhuis and the folks at joyent.
*/
UV_EXTERN void uv_disable_stdio_inheritance(void);
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
index 61d7249301..e8e5f9e62f 100644
--- a/deps/uv/src/unix/core.c
+++ b/deps/uv/src/unix/core.c
@@ -340,11 +340,6 @@ void uv_update_time(uv_loop_t* loop) {
}
-uint64_t uv_now(uv_loop_t* loop) {
- return loop->time;
-}
-
-
int uv_is_active(const uv_handle_t* handle) {
return uv__is_active(handle);
}
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
index 53f46ce7c7..2f58a563b3 100644
--- a/deps/uv/src/unix/fs.c
+++ b/deps/uv/src/unix/fs.c
@@ -436,11 +436,14 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
* non-blocking mode and not all data could be written. If a non-zero
* number of bytes have been sent, we don't consider it an error.
*/
- len = 0;
#if defined(__FreeBSD__)
+ len = 0;
r = sendfile(in_fd, out_fd, req->off, req->len, NULL, &len, 0);
#else
+ /* The darwin sendfile takes len as an input for the length to send,
+ * so make sure to initialize it with the caller's value. */
+ len = req->len;
r = sendfile(in_fd, out_fd, req->off, &len, NULL, 0);
#endif
diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c
index 35374b17dc..13765ae3e3 100644
--- a/deps/uv/src/unix/linux-core.c
+++ b/deps/uv/src/unix/linux-core.c
@@ -382,12 +382,12 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
return uv__new_sys_error(ENOMEM);
if (read_models(numcpus, ci)) {
- SAVE_ERRNO(free(ci));
+ SAVE_ERRNO(uv_free_cpu_info(ci, numcpus));
return uv__new_sys_error(errno);
}
if (read_times(numcpus, ci)) {
- SAVE_ERRNO(free(ci));
+ SAVE_ERRNO(uv_free_cpu_info(ci, numcpus));
return uv__new_sys_error(errno);
}
@@ -414,76 +414,89 @@ static void read_speeds(unsigned int numcpus, uv_cpu_info_t* ci) {
/* Also reads the CPU frequency on x86. The other architectures only have
* a BogoMIPS field, which may not be very accurate.
+ *
+ * Note: Simply returns on error, uv_cpu_info() takes care of the cleanup.
*/
static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
-#if defined(__i386__) || defined(__x86_64__)
static const char model_marker[] = "model name\t: ";
static const char speed_marker[] = "cpu MHz\t\t: ";
-#elif defined(__arm__)
- static const char model_marker[] = "Processor\t: ";
- static const char speed_marker[] = "";
-#elif defined(__mips__)
- static const char model_marker[] = "cpu model\t\t: ";
- static const char speed_marker[] = "";
-#else
-# warning uv_cpu_info() is not supported on this architecture.
- static const char model_marker[] = "";
- static const char speed_marker[] = "";
-#endif
- static const char bogus_model[] = "unknown";
+ const char* inferred_model;
unsigned int model_idx;
unsigned int speed_idx;
char buf[1024];
char* model;
FILE* fp;
- char* inferred_model;
- fp = fopen("/proc/cpuinfo", "r");
- if (fp == NULL)
- return -1;
+ /* Most are unused on non-ARM and non-x86 architectures. */
+ (void) &model_marker;
+ (void) &speed_marker;
+ (void) &speed_idx;
+ (void) &model;
+ (void) &buf;
+ (void) &fp;
model_idx = 0;
speed_idx = 0;
+#if defined(__arm__) || defined(__i386__) || defined(__x86_64__)
+ fp = fopen("/proc/cpuinfo", "r");
+ if (fp == NULL)
+ return -1;
+
while (fgets(buf, sizeof(buf), fp)) {
- if (model_marker[0] != '\0' &&
- model_idx < numcpus &&
- strncmp(buf, model_marker, sizeof(model_marker) - 1) == 0)
- {
- model = buf + sizeof(model_marker) - 1;
- model = strndup(model, strlen(model) - 1); /* strip newline */
- ci[model_idx++].model = model;
- continue;
+ if (model_idx < numcpus) {
+ if (strncmp(buf, model_marker, sizeof(model_marker) - 1) == 0) {
+ model = buf + sizeof(model_marker) - 1;
+ model = strndup(model, strlen(model) - 1); /* Strip newline. */
+ if (model == NULL) {
+ fclose(fp);
+ return -1;
+ }
+ ci[model_idx++].model = model;
+ continue;
+ }
}
-
- if (speed_marker[0] != '\0' &&
- speed_idx < numcpus &&
- strncmp(buf, speed_marker, sizeof(speed_marker) - 1) == 0)
- {
- ci[speed_idx++].speed = atoi(buf + sizeof(speed_marker) - 1);
- continue;
+#if defined(__arm__)
+ /* Fallback for pre-3.8 kernels. */
+ if (model_idx < numcpus) {
+ static const char model_marker[] = "Processor\t: ";
+ if (strncmp(buf, model_marker, sizeof(model_marker) - 1) == 0) {
+ model = buf + sizeof(model_marker) - 1;
+ model = strndup(model, strlen(model) - 1); /* Strip newline. */
+ if (model == NULL) {
+ fclose(fp);
+ return -1;
+ }
+ ci[model_idx++].model = model;
+ continue;
+ }
}
+#else /* !__arm____ */
+ if (speed_idx < numcpus) {
+ if (strncmp(buf, speed_marker, sizeof(speed_marker) - 1) == 0) {
+ ci[speed_idx++].speed = atoi(buf + sizeof(speed_marker) - 1);
+ continue;
+ }
+ }
+#endif /* __arm__ */
}
- fclose(fp);
- /* Now we want to make sure that all the models contain *something*:
- * it's not safe to leave them as null.
- */
- if (model_idx == 0) {
- /* No models at all: fake up the first one. */
- ci[0].model = strndup(bogus_model, sizeof(bogus_model) - 1);
- model_idx = 1;
- }
+ fclose(fp);
+#endif /* __arm__ || __i386__ || __x86_64__ */
- /* Not enough models, but we do have at least one. So we'll just
- * copy the rest down: it might be better to indicate somehow that
- * the remaining ones have been guessed.
+ /* Now we want to make sure that all the models contain *something* because
+ * it's not safe to leave them as null. Copy the last entry unless there
+ * isn't one, in that case we simply put "unknown" into everything.
*/
- inferred_model = ci[model_idx - 1].model;
+ inferred_model = "unknown";
+ if (model_idx > 0)
+ inferred_model = ci[model_idx - 1].model;
while (model_idx < numcpus) {
- ci[model_idx].model = strndup(inferred_model, strlen(inferred_model));
- model_idx++;
+ model = strndup(inferred_model, strlen(inferred_model));
+ if (model == NULL)
+ return -1;
+ ci[model_idx++].model = model;
}
return 0;
diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c
index 8c9d323af3..f0792f1175 100644
--- a/deps/uv/src/uv-common.c
+++ b/deps/uv/src/uv-common.c
@@ -429,3 +429,8 @@ void uv_unref(uv_handle_t* handle) {
void uv_stop(uv_loop_t* loop) {
loop->stop_flag = 1;
}
+
+
+uint64_t uv_now(uv_loop_t* loop) {
+ return loop->time;
+}
diff --git a/deps/uv/src/version.c b/deps/uv/src/version.c
index 9bf92fdd02..38cd35cc9b 100644
--- a/deps/uv/src/version.c
+++ b/deps/uv/src/version.c
@@ -34,7 +34,7 @@
#define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 10
-#define UV_VERSION_PATCH 9
+#define UV_VERSION_PATCH 10
#define UV_VERSION_IS_RELEASE 1
diff --git a/deps/uv/src/win/timer.c b/deps/uv/src/win/timer.c
index 7fd105713d..8dae741457 100644
--- a/deps/uv/src/win/timer.c
+++ b/deps/uv/src/win/timer.c
@@ -45,11 +45,6 @@ void uv_update_time(uv_loop_t* loop) {
}
-uint64_t uv_now(uv_loop_t* loop) {
- return loop->time;
-}
-
-
static int uv_timer_compare(uv_timer_t* a, uv_timer_t* b) {
if (a->due < b->due)
return -1;
diff --git a/deps/uv/test/test-osx-select.c b/deps/uv/test/test-osx-select.c
index 5c2cbd4d93..bf4c3952b7 100644
--- a/deps/uv/test/test-osx-select.c
+++ b/deps/uv/test/test-osx-select.c
@@ -62,7 +62,7 @@ TEST_IMPL(osx_select) {
uv_read_start((uv_stream_t*) &tty, alloc_cb, read_cb);
- // Emulate user-input
+ /* Emulate user-input */
str = "got some input\n"
"with a couple of lines\n"
"feel pretty happy\n";