An incorrect assert() statement was causing libuv to crash when writing
to an internal signal pipe would result in EAGAIN/EWOULDBLOCK.
This commit doesn't solve the underlying issue that the signal pipe can
overflow.
This should fixjoyent/node#5538
Fix an infinite loop in the example below when the stream encounters
an EPIPE/ECONNRESET/etc. error:
// keep writing until we start buffering
while (stream->write_queue_size == 0) {
uv_write_t* req = make_write_req();
uv_buf_t buf = uv_buf_init("PING", 4);
uv_write(req, stream, &buf, 1, write_cb);
}
uv_write() does not return an error code on write errors, the error is
only reported to the callback.
Before this commit, uv_write() left stream->write_queue_size untouched
on error, meaning the caller had no way to find out about that error
until the next tick of the event loop - which in the example above
leads to an infinite loop because that next tick is indefinitely
postponed.
This commit works around that at the cost of some added internal
complexity.
Fixesjoyent/node#5516.
Use signaling mechanism for loop termination, because CFRunLoopStop() is
most likely not a thread-safe function and invoking it from other thread
may sometimes result in a "dead-lock".
fix#799
* Fix a potential issue introduced with 415f4d3, namely that uv_spawn
can fail when the current process is under job control. This would
happen on Windows versions that don't support nested jobs (versions
prior to Windows 8 / Server 2012).
* Change the `uv__init_global_job_handle` function signature to match
what `uv_once` expects.
* Add a bunch of comments that clarify how we're using job control,
and how we're dealing with job control that might be established by
our parent process.
Disable unit test failing due to missing implementation
of uv_(set|get)_process_title for Sun OS (SmartOS).
Based on discussion with @tjfontaine, such implementation is difficult
if possible at all and it won't be done anytime soon. Thus there is
no point in keeping the failing test around.
Commit 3eb6eb3 links the .so with -Wl,-soname which breaks the
`make test` target: run-tests is linked against (for example)
libuv.so.0.11 while the actual file name is libuv.so.
That's relatively easy to fix by getting creative with rpaths but it's
even easier to fix by simply linking statically.
It also means I no longer have to remember to set LD_BIND_NOW when
profiling the benchmarks.
Shorten the test string from 40 to 38 characters because the title
length is limited to 39 characters.
Truncation of long titles was introduced intentionally by commit
a0c1d84 (see discussion in joyent/node#5006).
Added two new flags to identify tests that are intentionally ignored
(usually because we don't want to implement the tested functionality
on current platform) and test serving as TODO list (usually indicating
that the tested functionality should be implemented on current plaform
in the near future.)
Rename it to darwin-getproctitle.c, it doesn't need an Objective-C
compiler. Fix up -Wpedantic warnings about void to function pointer
casts and include <ApplicationServices/ApplicationServices.h> to get
the GetCurrentProcess() function prototype.
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.