build: fix up WIN_SRCS
darwin: merge uv_cond_timedwait implementation

Merge the OS X specific implementation of uv_cond_timedwait() with the
generic one. The only difference is that it now uses mach_absolute_time
instead of gettimeofday.
Revert "darwin: merge uv_cond_timedwait implementation"

Using mach_absolute_time() for the pthread_cond_timedwait() timeout
breaks a number of tests on OS X 10.8.2.

This reverts commit 8311390f13177f3086ecdac875115d2d4cc2688b.
unix: remove scandir prototype workaround in fs.c

It's not necessary for newer OS X releases and I don't care enough
about OpenBSD to squelch the warning.
darwin: merge uv_cond_timedwait implementation

This is a revised version of commit 8311390.
win: Avoid using subversion to download gyp
darwin: make uv_cond_timedwait() clock skew safe

Use pthread_cond_timedwait_relative_np() so we're not prone to spurious
bugs caused by clock skew.
stream: use kevent() information before accept()

Limit number of syscalls by using backlog length information provided by
kevent().
unix,windows: fix timer order in case of same timeout

Compare start_id of timer handles when they have the same timeout.
start_id is allocated with loop->timer_counter in uv_timer_start.
unix, windows: make uv_fs_t.statbuf public

Make the statbuf field public. This means you no longer have to use
req->ptr - though that still works and will continue to work for the
foreseeable future.

Fixes #704.
linux: fix O_CLOEXEC/O_NONBLOCK defines
Adhere to the naming conventions in uv_timer_* functions.

In the src/*/timer.c code the first argument is called handle, not timer.
We should be consistent in the interface definition file.
Return the errorcode provided by uv_set_artificial_error.

This reduces the line count.
unix, windows: make uv_now() return uint64_t

Using int64_t doesn't make sense here because the return value is never
negative.
unix, windows: change timer intervals to uint64_t
unix, windows: make uv_timer_get_repeat() const correct
doc: document _LARGEFILE_SOURCE + _FILE_OFFSET_BITS
build: fix shared-after-static build

Executing `make libuv.so` after `make libuv.a` failed because the
libuv.a target compiled the files in src/ without -fPIC.

Make the libuv.so target depend on files with a different suffix to
keep them separated.
linux: fix abort() on epoll_ctl() race condition

Don't check the return value of epoll_ctl(EPOLL_CTL_DEL). When the
file descriptor is closed, we're potentially racing with another
thread and that means the errno is not a reliable indicator of
the actual error.

The other event mechanisms (kqueue, event ports) are not affected
because:

* kqueue returns either EBADF or ENOENT. Both are handled by libuv.
* event ports rearms all file descriptors on each call to port_getn().

Fixes joyent/node#4558.
unix: fail early on bad send_handle in uv_write2

Return UV_EBADF if send_handle doesn't have a valid fd.