test: make fmt() not leak memory
bench: add 'million async handles' benchmark
prepare/idle/check: don't allow NULL callback
unix: don't run loop when all handles are unref'd
build: export _DARWIN_C_SOURCE to dependents

Exporting just _POSIX_C_SOURCE=200112 hides SysV / BSD definitions like
S_IREAD and S_IWRITE. Exporting _DARWIN_C_SOURCE fixes that.

Issue reported by Travis Tilley.
include: update uv_signal_t doc comments

Fixes #668.
sunos: fix !defined(PORT_SOURCE_FILE) build
unix: reset errno when using sendfile emulation

A common way to check if a uv_fs_t request failed is to check that
req->errorno != 0.

With uv_fs_sendfile(), when the sendfile() syscall fails, req->errorno is set
to (for example) ENOTSOCK, even when the emulation code path succeeds.

Zero errno before the call to uv__fs_sendfile_emul() to prevent that from
happening.
unix: ensure done_cb gets called after uv_cancel()

Wake up the event loop with uv_async_send() when a request is cancelled.
Ensures the done_cb is run on the next tick of the event loop.

Not sending a wakeup signal results in the done_cb not getting called until
another request completes, which may be a long time coming when it's the only
request in the queue or when other requests are executing long-running jobs.

Fixes #669.
include: add note about SIGRT0 and SIGRT1 on linux
unix: remove bogus uv__write() comment
unix: remove uv_write_queue_head()
unix: remove stale closing check in uv__write()

Introduced in 0db3274f but no longer necessary; uv__write() no longer
runs when the handle has been closed. Write callbacks receive a special
status code that informs them that the handle has been closed.
stream: fix infinite select() polling on osx

Interruption FD buffer should be emptied after write, otherwise select()
loop will poll indefinitely.
unix: use uv__hrtime() internally

This commit renames the various uv_hrtime() implementations to uv__hrtime().

Libuv uses the high-res timer internally in performance-critical code paths.
Calling the non-public version avoids going through the PLT when libuv is
compiled as a shared object.

The exported uv_hrtime() now has a single definition in src/unix/core.c that
calls uv__hrtime().

A future optimization is to lift the uv__hrtime() declarations into header
files so they can be inlined at the call sites. Then again, linking with -flto
should accomplish the same thing.
unix: update loop->time after poll

Fixes a bug where timers expire prematurely when the following
conditions hold:

  a) libuv first spends some time blocked in the platform poll function
  b) a callback then calls uv_timer_start()

Cause: uv_timer_start() uses an out-of-date loop->time in its
'when should the timer callback run?' calculations.

Solution: Update loop->time before invoking any callbacks.

Fixes #678.
test: remove consumer_producer test

It fails intermittently on Travis for no other reason than that Travis
is occasionally slow. Reduce the number of false positives, remove the
test.
unix: add checksparse.sh script
unix: remove unused function uv__strlcpy()
unix: fix up function prototypes in signal.c