aboutsummaryrefslogtreecommitdiff
path: root/deps/uv/src/unix
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2014-01-27 21:30:51 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2014-01-27 21:30:51 +0400
commit64d33a751935bb0fa9fad8f6525dcd378b5fe3da (patch)
treed2c7d5106014ec7c7aeafadfbee5ef50735e8e53 /deps/uv/src/unix
parentcc4b6e6e582e868cba9f84195f62a51721f8cbad (diff)
downloadandroid-node-v8-64d33a751935bb0fa9fad8f6525dcd378b5fe3da.tar.gz
android-node-v8-64d33a751935bb0fa9fad8f6525dcd378b5fe3da.tar.bz2
android-node-v8-64d33a751935bb0fa9fad8f6525dcd378b5fe3da.zip
deps: update uv to 0.11.18
Diffstat (limited to 'deps/uv/src/unix')
-rw-r--r--deps/uv/src/unix/linux-core.c7
-rw-r--r--deps/uv/src/unix/openbsd.c2
-rw-r--r--deps/uv/src/unix/process.c43
-rw-r--r--deps/uv/src/unix/tcp.c16
4 files changed, 46 insertions, 22 deletions
diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c
index 78b234364e..4f11d88eed 100644
--- a/deps/uv/src/unix/linux-core.c
+++ b/deps/uv/src/unix/linux-core.c
@@ -635,9 +635,11 @@ static int read_times(unsigned int numcpus, uv_cpu_info_t* ci) {
/* skip "cpu<num> " marker */
{
- unsigned int n = num;
+ unsigned int n;
+ int r = sscanf(buf, "cpu%u ", &n);
+ assert(r == 1);
+ (void) r; // silence build warning
for (len = sizeof("cpu0"); n /= 10; len++);
- assert(sscanf(buf, "cpu%u ", &n) == 1 && n == num);
}
/* Line contains user, nice, system, idle, iowait, irq, softirq, steal,
@@ -664,6 +666,7 @@ static int read_times(unsigned int numcpus, uv_cpu_info_t* ci) {
ci[num++].cpu_times = ts;
}
fclose(fp);
+ assert(num == numcpus);
return 0;
}
diff --git a/deps/uv/src/unix/openbsd.c b/deps/uv/src/unix/openbsd.c
index 0ff9ad6431..f052d80c57 100644
--- a/deps/uv/src/unix/openbsd.c
+++ b/deps/uv/src/unix/openbsd.c
@@ -228,7 +228,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
uint64_t info[CPUSTATES];
char model[512];
int numcpus = 1;
- static int which[] = {CTL_HW,HW_MODEL,0};
+ int which[] = {CTL_HW,HW_MODEL,0};
size_t size;
int i;
uv_cpu_info_t* cpu_info;
diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c
index 6854ac1190..6f96b754d8 100644
--- a/deps/uv/src/unix/process.c
+++ b/deps/uv/src/unix/process.c
@@ -287,34 +287,41 @@ static void uv__process_child_init(const uv_process_options_t* options,
close_fd = pipes[fd][0];
use_fd = pipes[fd][1];
- if (use_fd >= 0) {
- if (close_fd != -1)
- uv__close(close_fd);
- }
- else if (fd >= 3)
- continue;
- else {
- /* redirect stdin, stdout and stderr to /dev/null even if UV_IGNORE is
- * set
- */
- use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR);
-
- if (use_fd == -1) {
+ if (use_fd < 0) {
+ if (fd >= 3)
+ continue;
+ else {
+ /* redirect stdin, stdout and stderr to /dev/null even if UV_IGNORE is
+ * set
+ */
+ use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR);
+ close_fd = use_fd;
+
+ if (use_fd == -1) {
uv__write_int(error_fd, -errno);
- perror("failed to open stdio");
- _exit(127);
+ perror("failed to open stdio");
+ _exit(127);
+ }
}
}
if (fd == use_fd)
uv__cloexec(use_fd, 0);
- else {
+ else
dup2(use_fd, fd);
- uv__close(use_fd);
- }
if (fd <= 2)
uv__nonblock(fd, 0);
+
+ if (close_fd != -1)
+ uv__close(close_fd);
+ }
+
+ for (fd = 0; fd < stdio_count; fd++) {
+ use_fd = pipes[fd][1];
+
+ if (use_fd >= 0 && fd != use_fd)
+ close(use_fd);
}
if (options->cwd != NULL && chdir(options->cwd)) {
diff --git a/deps/uv/src/unix/tcp.c b/deps/uv/src/unix/tcp.c
index e5f226c1f5..2c36dc3ffc 100644
--- a/deps/uv/src/unix/tcp.c
+++ b/deps/uv/src/unix/tcp.c
@@ -58,7 +58,8 @@ static int maybe_new_socket(uv_tcp_t* handle, int domain, int flags) {
int uv__tcp_bind(uv_tcp_t* tcp,
const struct sockaddr* addr,
- unsigned int addrlen) {
+ unsigned int addrlen,
+ unsigned int flags) {
int err;
int on;
@@ -72,6 +73,19 @@ int uv__tcp_bind(uv_tcp_t* tcp,
if (setsockopt(tcp->io_watcher.fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)))
return -errno;
+#ifdef IPV6_V6ONLY
+ if (addr->sa_family == AF_INET6) {
+ on = (flags & UV_TCP_IPV6ONLY) != 0;
+ if (setsockopt(tcp->io_watcher.fd,
+ IPPROTO_IPV6,
+ IPV6_V6ONLY,
+ &on,
+ sizeof on) == -1) {
+ return -errno;
+ }
+ }
+#endif
+
errno = 0;
if (bind(tcp->io_watcher.fd, addr, addrlen) && errno != EADDRINUSE)
return -errno;