build: make gyp_uv understand '-f ninja'
unix: fix EMFILE busy loop

Don't spin in epoll_wait() / kevent() / port_getn() / etc. when we can't
accept() a new connection due to having reached the file descriptor limit.
Pass the error to the connection_cb and let the libuv user deal with it.
unix: code cleanup, rename variable
unix: put child process stdio fds in blocking mode

Remove the O_NONBLOCK flag from file descriptors 0-2, most applications don't
expect EAGAIN errors when dealing with stdio.
win/tty: reset background brightness when color is set to default
linux: improve /proc/cpuinfo parser

Make uv_cpu_info() understand the ARM and MIPS versions of /proc/cpuinfo,
it only knew how to deal with the x86 version

This commit also fixes a buglet where uv_cpu_info() reported the maximum CPU
frequency instead of the actual CPU frequency. That is, before this commit
`out/Debug/run-tests platform_output | grep speed | sort | uniq -c` on my
system always reported:

      8   speed: 3400

Now it reports (for example):

      2   speed: 3400
      6   speed: 1600

In other words, two CPUs are running at full speed while the others have been
scaled back because they're mostly idle.

This is a back-port of commit 54bfb66 from the master branch.

Fixes #526.
unix: map EDQUOT to UV_ENOSPC
windows: don't blow up when an invalid FD is used
windows: fix application crashed popup in debug version

This is a backport of 2 patches by Ting-Yu Lin and Hiroaki Nakamura.
windows: fix handle leak in uv_fs_utime
win: fix compilation with MSVCRT < 8.0
unix: avoid iterating over all async handles
unix: fix compiler warning in async.c

Include missing <string.h> header. Fixes the following compiler warning:

  src/unix/async.c:182:7: warning: implicit declaration of
  function ‘memmove’ [-Wimplicit-function-declaration]
linux: use /proc/cpuinfo for CPU frequency

Obtain the CPU frequency from /proc/cpuinfo because there may not be any
cpufreq info available in /sys. This also means that the reported CPU speed
from now on is the *maximum* speed, not the *actual* speed the CPU runs at.

This change only applies to x86 because ARM and MIPS don't report that
information in /proc/cpuinfo.

Fixes #588.
linux: update comm field in uv_set_process_title()

Makes the new process name visible in both `ps` and `ps a`, with the caveat
that `ps` will only print the first 16 characters.

Before this commit, `ps` kept reporting the old process name.
win: support compilation with Visual Studio 2008
Revert "unix: avoid iterating over all async handles"

This reverts commit 209abbab27abdc63200cbd707f72fed4245ab4d0.

Fixes the following SIGSEGV:

  (gdb) f 1
  #1  0x00007fc084683aec in uv__async_io (loop=0x7fc0848e0b40,
  handle=0x7fc0848e0c78, events=1) at src/unix/async.c:175
  175             ASYNC_CB(h)
  (gdb) list
  170
  171         /* If we need to sweep all handles anyway - skip this loop */
  172         if (!loop->async_sweep_needed) {
  173           for (i = 0; i < end; i += sizeof(h)) {
  174             h = *((uv_async_t**) (buf + i));
  175             ASYNC_CB(h)
  176           }
  177         }
  178
  179         bytes -= end;
  (gdb) print *h
  $1 = {close_cb = 0x184e1b0, data = 0x18d9520, loop = 0x7fc0848e0b40,
  type = 49, handle_queue = {prev = 0x18dae10, next = 0x7860c0}, flags = 32,
  next_closing = 0x1863b40, pending = 0, async_cb = 0x31,
  queue = {prev = 0x18dae50, next = 0x7860c0}}
  (gdb)

It looks like the async handle gets closed or otherwise becomes invalid before
the sweep is executed.

Fixes #603.
unix: reopen tty as /dev/tty

Reopen the file descriptor when it refers to a tty. This lets us put the tty in
non-blocking mode without affecting other processes that share it with us.

Fixes #601.
benchmark: timed_udp_pummel should not write to closed udp handle

This fixes intermittent assertion failures when running the benchmark.
benchmark: async_pummel should not call uv_async_send on closed handle

This fixes an assertion that triggered in debug builds on Windows.