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
unix: make uv__work_cancel() static
unix: make uv__read_start_common() static
unix: fix include in cygwin.c
unix: fix up #if defined checks

`#if FOO` (where FOO is undefined) is a legal construct in C89 and C99
but gcc, clang and sparse complain loudly about it at higher warning
levels.

Squelch those warnings. Makes the code more consistent as well.
unix, windows: ANSI-fy uv_tty_reset_mode() prototype
linux: fix race in uv_resident_set_memory()

uv_resident_set_memory() used a global buffer to read data into, which
is a decidedly unsafe thing to do in a multi-threaded environment.
test, bench: ANSI-fy function prototypes

Replace `void f()` with `void f(void)`; the former means "a function
that takes any number of arguments, including none" while the latter
is what is actually intended: a function taking no arguments.

The first form also isn't strictly conforming ANSI/ISO C.
test, bench: make functions/variables static

Make functions and variables that are local to the compilation unit
static. Remove what turns out to be unused.
test: remove unused function declaration
test: simplify tcp_ref2b

Said test doesn't need its own close callback, it can piggyback on the
common close callback.
test: fix #if defined checks

Same as edd1007 but this time for the tests.
unix: fix GNU-ism introduced in edd1007

Don't use features.h, it's only available on GNU/glibc systems.
unix: improve uv_guess_handle() implementation

uv_guess_handle is currently squelching both fifo and all
sockets on to the UV_NAMED_PIPE type. Rather than treating
all sockets as UV_NAMED_PIPE, use getsockopt() and
getsockaddr() to determine if the socket is an AF_UNIX
stream (in which case return UV_NAMED_PIPE), or an AF_INET
stream (in which case return UV_TCP), or an AF_INET datagram
socket (in which case return UV_UDP).

Additionally, currently all other file descriptor types are
squelched to the UV_FILE type. Instead, only file descriptors
that are marked as regular files are treated as UV_FILE. All
other types (such as directories, character and block devices)
are now treated as UV_UNKNOWN_HANDLE.