On Linux, the accept() and accept4() system calls checks for EMFILE
before checking for EAGAIN. Refine our EMFILE error handling tactic
to deal with that. Here is what used to happen:
1. The event loop calls accept() and sees EMFILE.
2. Libuv switches to EMFILE error handling mode. It closes a stashed
file descriptor and calls accept() again.
3. The accept() system call fails with EAGAIN.
4. Libuv reopens the stashed file descriptor (reaching RLIMIT_NOFILE
again) and returns control to the regular event loop.
5. The regular event loop calls accept(), sees EMFILE and jumps to
step 2 again. Effectively an infinite loop.
Avoid that by not calling accept() again when we've seen EAGAIN.
Fixesjoyent/node#5389.
After latest twiddling, `stream->io_watcher.fd` doesn't contain a real
stream's file descriptior anymore. The one from `select_state` should be
used instead.
Zero-initialize `select_state->event` field.
RSS is a reflection of the number of pages that a process has mapped.
glibc implements fopen() in terms of mmap() which means that trying
to read the number of mapped pages changes it. Switch to open().
Fix the following two warnings:
src/unix/core.c:74:1: warning: ISO C90 forbids array
'static_assert_failed' whose size can't be evaluated [-Wvla]
src/unix/core.c:76:1: warning: ISO C90 forbids array
'static_assert_failed' whose size can't be evaluated [-Wvla]
Add a compiler check because turning on the option unconditionally
breaks the build when CC=gcc.
This should also fix the build on versions of OS X that predate Apple's
switch to clang (10.6 and older.)
Fixes a couple of error handling issues:
* Don't free an uninitialized pointer when allocating memory for
`cpu_infos` fails.
* Don't return a bogus error value when NtQuerySystemInformation fails.
That function returns an NTSTATUS code instead of setting the last
error.
* Don't clobber out parameters when an error happens.
Include uv.h so the compiler sees the right visibility attribute for
uv_version() and uv_version_string().
GYP builds compile with -fvisibility=hidden. Before this commit, the
symbols were not visible in libuv.so.
Fixesjoyent/node#5213.
Fixes the following warning:
include/uv.h:236:30: warning: type qualifiers ignored on function
return type [-Wignored-qualifiers]
UV_EXTERN const unsigned int uv_version(void);
This is the first officially versioned release of libuv. Starting now
libuv will make releases independently of Node.js.
Changes since Node.js v0.10.0:
* test: add tap output for windows (Timothy J. Fontaine)
* unix: fix uv_tcp_simultaneous_accepts() logic (Ben Noordhuis)
* include: bump UV_VERSION_MINOR (Ben Noordhuis)
* unix: improve uv_guess_handle() implementation (Ben Noordhuis)
* stream: run try_select only for pipes and ttys (Fedor Indutny)
Changes since Node.js v0.10.1:
* build: rename OS to PLATFORM (Ben Noordhuis)
* unix: make uv_timer_init() initialize repeat (Brian Mazza)
* unix: make timers handle large timeouts (Ben Noordhuis)
* build: add OBJC makefile var (Ben Noordhuis)
* Add `uv_version()` and `uv_version_string()` APIs (Bert Belder)
This commit fixes two closely related integer overflow bugs:
* Timers with a timeout > INT_MAX cause uv__next_timeout() to return
a negative value.
* Timers with very large timeouts (close or equal to ULLONG_MAX) run on
the next tick.
In both cases, clamp the values to prevent the overflow from happening.
Fixesjoyent/node#5101.
Rename the OS make variable to PLATFORM, it conflicts with the OS env
var. That is, running `make` when the OS env var is set, may cause
spurious build breakage.
Fixes#737.