summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/linux-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/src/unix/linux-core.c')
-rw-r--r--deps/uv/src/unix/linux-core.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c
index a2145b0f36..d77b13fd6f 100644
--- a/deps/uv/src/unix/linux-core.c
+++ b/deps/uv/src/unix/linux-core.c
@@ -33,7 +33,6 @@
#include <sys/prctl.h>
#include <sys/sysinfo.h>
#include <unistd.h>
-#include <signal.h>
#include <fcntl.h>
#include <time.h>
@@ -142,8 +141,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
struct uv__epoll_event e;
QUEUE* q;
uv__io_t* w;
- sigset_t* pset;
- sigset_t set;
+ uint64_t sigmask;
uint64_t base;
uint64_t diff;
int nevents;
@@ -194,24 +192,21 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
w->events = w->pevents;
}
- pset = NULL;
- if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
- pset = &set;
- sigemptyset(pset);
- sigaddset(pset, SIGPROF);
- }
+ sigmask = 0;
+ if (loop->flags & UV_LOOP_BLOCK_SIGPROF)
+ sigmask |= 1 << (SIGPROF - 1);
assert(timeout >= -1);
base = loop->time;
count = 48; /* Benchmarks suggest this gives the best throughput. */
for (;;) {
- if (no_epoll_wait || pset != NULL) {
+ if (no_epoll_wait || sigmask) {
nfds = uv__epoll_pwait(loop->backend_fd,
events,
ARRAY_SIZE(events),
timeout,
- pset);
+ sigmask);
} else {
nfds = uv__epoll_wait(loop->backend_fd,
events,
@@ -383,10 +378,13 @@ void uv_loadavg(double avg[3]) {
int uv_exepath(char* buffer, size_t* size) {
ssize_t n;
- if (buffer == NULL || size == NULL)
+ if (buffer == NULL || size == NULL || *size == 0)
return -EINVAL;
- n = readlink("/proc/self/exe", buffer, *size - 1);
+ n = *size - 1;
+ if (n > 0)
+ n = readlink("/proc/self/exe", buffer, n);
+
if (n == -1)
return -errno;