Changes since version 0.11.3:
* windows: make uv_spawn not fail when the libuv embedding application
is run under external job control (Bert Belder)
* darwin: assume CFRunLoopStop() isn't thread-safe, fixing a race
condition when stopping the 'stdin select hack' thread (Fedor Indutny)
* win: fix UV_EALREADY not being reported correctly to the libuv user in
some cases (Bert Belder)
* darwin: make the uv__cf_loop_runner and uv__cf_loop_cb functions
static (Ben Noordhuis)
* darwin: task_info() cannot fail (Ben Noordhuis)
* unix: add error mapping for ENETDOWN (Ben Noordhuis)
* unix: implicitly signal write errors to the libuv user (Ben Noordhuis)
* unix: fix assertion error on signal pipe overflow (Bert Belder)
* unix: turn off POLLOUT after stream connect (Ben Noordhuis)
* unix: fix stream refcounting buglet (Ben Noordhuis)
* unix: remove assert statements that are no longer correct (Ben
Noordhuis)
* unix: appease warning about non-standard `inline` (Sean Silva)
* unix: add uv__is_closing() macro (Ben Noordhuis)
* unix: stop stream POLLOUT watcher on write error (Ben Noordhuis)
* include: document uv_update_time() and uv_now() (Ben Noordhuis)
* linux: fix cpu model parsing on newer arm kernels (Ben Noordhuis)
* linux: fix a memory leak in uv_cpu_info() error path (Ben Noordhuis)
* linux: don't ignore out-of-memory errors in uv_cpu_info() (Ben
Noordhuis)
* unix, windows: move uv_now() to uv-common.c (Ben Noordhuis)
* test: fix a compilation problem in test-osx-select.c that was caused
by the use of c-style comments (Bert Belder)
* darwin: use uv_fs_sendfile() use the sendfile api correctly (Wynn
Wilkes)
* windows: call idle handles on every loop iteration, something the unix
implementation already did (Bert Belder)
* test: update the idle-starvation test to verify that idle handles are
called in every loop iteration (Bert Belder)
* unix, windows: ensure that uv_run() in RUN_ONCE mode calls timers that
expire after blocking (Ben Noordhuis)
Before this commit, creating an event loop, starting a timer and
calling uv_run(UV_RUN_ONCE) blocked in uv_run() until the timer
expired - but didn't actually run the timer.
This mimicks what the unix implementation does: call idle handles on
every loop iteration. The guarantee that it runs on every loop iteration
makes it easier to predict and opens up more use cases.
Note that the name uv_idle is now a bit of a misnomer. There is
actually no guarantee that libuv completely processed all i/o
when an iteration ends. The windows implementation at least limits
the amount of callbacks processed in a single iteration to avoid some
handles getting a disproportionate amount of cpu attention.
The darwin sendfile implementation uses the &len parameter as input
and output. The code was sending 0 (not using the value of req->len)
so the behavior wasn't what the caller was expecting.
This makes sure to initialize len with req->len to ensure that the
caller can send portions of a file (not always everything to the
end of the file).
The node.js test suite sometimes hits the assert that was added in
commit 4146805 that checks if there are connect, write or shutdown
requests pending when the user calls uv_read_stop() while the stream
is primed for writing.
The libuv user (i.e. node.js) is supposed to close the stream on error.
Because uv__stream_close() calls uv_read_stop(), it's possible that the
POLLOUT watcher is still active.
Clang warns about using `inline`, which is not technically allowed in
C89 mode (libuv compiles with `-std=c89`). It's probably best to leave
it to the compiler to do the inlining anyway.
As of commit c53fe81, it's legal for write_queue_size > 0 when the
write_queue itself is empty. Sounds illogical but it means there are
error-state write requests in the write_completed_queue that will touch
up the write_queue_size on the next tick of the event loop.
Remove a few stray asserts that still checked for the old situation.
Fix a buglet where uv_read_stop() would mark the handle as stopped even
when there are in-progress write requests.
This bug is unlikely to have affected anyone, the only case where it
has a user-visible effect is when:
a) the handle has been stopped for reading but not writing, and
b) it's the last active handle in the event loop's pollset
If both conditions are met, it's possible for the event loop to
terminate prematurely.
This reapplies commit 80f2f82 which was temporarily reverted in fe7b154
because it was making a lot of node.js tests fail on OS X with the
following assertion:
Assertion failed: (!uv__is_active(handle)), function
uv__finish_close, file ../../deps/uv/src/unix/core.c, line 165.
Expecting that the handle is inactive when the state is UV_CLOSING
turns out to be a bad assumption: it's possible that the handle is
executing (for example) a shutdown request when uv__finish_close()
is called. That's okay, uv__stream_destroy() takes care of that.
The issue wasn't specific to OS X, it was just more visible on that
platform. (Slow) debug builds on Linux exhibited the same behavior.
This change is making 45 out of 527 node.js tests fail on OS X with the
following assertion:
Assertion failed: (!uv__is_active(handle)), function
uv__finish_close, file ../../deps/uv/src/unix/core.c, line 165.
It's likely a manifestation of a bug elsewhere but, because there's a
new node.js release going out tonight, I'm reverting it for now.
This reverts commit 80f2f826bf.
Conflicts:
src/unix/stream.c
Clear the POLLOUT flag after we're done connecting. Not doing so isn't
really harmful but it may cause the event loop to wake up more often
than it has to.
Fix a buglet where uv_read_stop() would mark the handle as stopped even
when there are in-progress write requests.
This bug is unlikely to have affected anyone, the only case where it
has a user-visible effect is when:
a) the handle has been stopped for reading but not writing, and
b) it's the last active handle in the event loop's pollset
If both conditions are met, it's possible for the event loop to
terminate prematurely.
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.
Changes since version 0.11.2:
* unix: clean up uv_accept() (Ben Noordhuis)
* unix: remove errno preserving code (Ben Noordhuis)
* darwin: fix ios build, don't require ApplicationServices (Ben
Noordhuis)
* windows: kill child processes when the parent dies (Bert Belder)
* build: set soname in shared library (Ben Noordhuis)
* build: make `make test` link against .a again (Ben Noordhuis)
* build: only set soname on shared object builds (Timothy J. Fontaine)
* build: convert predefined $PLATFORM to lower case (Elliot Saba)
* test: fix process_title failing on linux (Miroslav Bajtoš)
* test, sunos: disable process_title test (Miroslav Bajtoš)
* test: add error logging to tty unit test (Miroslav Bajtoš)
Remove the errno preserving code. Libuv only implemented it in a
haphazard way and there seems to be a general consensus that no one
really cares anyway. Therefore, remove it.
Changes since version 0.11.1:
* darwin: look up file path with F_GETPATH (Ben Noordhuis)
* unix, windows: add uv_has_ref() function (Saúl Ibarra Corretgé)
* build: avoid double / in paths for dtrace (Timothy J. Fontaine)
* unix: remove src/unix/cygwin.c (Ben Noordhuis)
* windows: deal with the fact that GetTickCount might lag (Bert Belder)
* unix: silence STATIC_ASSERT compiler warnings (Ben Noordhuis)
* linux: don't use fopen() in uv_resident_set_memory() (Ben Noordhuis)
Fix a potential use-after-free bug where the uv__io watcher struct is
referenced after being disabled by its callback function. The stress
is on 'potential' because in practice the watcher's memory is not
released until the next tick of the event loop.
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.