Commits on Jan 10, 2013
  1. unix: omit second fcntl() call if possible

    Omit the fcntl() syscall when the O_NONBLOCK or FD_CLOEXEC is already
    set/clear because it's a no-op in that case.
    bnoordhuis committed Jan 10, 2013
Commits on Jan 9, 2013
Commits on Jan 8, 2013
  1. 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.
    bennoleslie committed with bnoordhuis Dec 9, 2012
Commits on Jan 7, 2013
  1. unix: fix GNU-ism introduced in edd1007

    Don't use features.h, it's only available on GNU/glibc systems.
    bnoordhuis committed Jan 7, 2013
Commits on Jan 6, 2013
  1. test: fix #if defined checks

    Same as edd1007 but this time for the tests.
    bnoordhuis committed Jan 6, 2013
  2. test: simplify tcp_ref2b

    Said test doesn't need its own close callback, it can piggyback on the
    common close callback.
    bnoordhuis committed Jan 6, 2013
  3. 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.
    bnoordhuis committed Jan 6, 2013
  4. 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.
    bnoordhuis committed Jan 6, 2013
  5. 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.
    bnoordhuis committed Jan 6, 2013
  6. 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
    Squelch those warnings. Makes the code more consistent as well.
    bnoordhuis committed Jan 6, 2013
  7. 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
    bnoordhuis committed Jan 6, 2013
  8. 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.
    bnoordhuis committed Jan 6, 2013
  9. 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.
    bnoordhuis committed Jan 6, 2013
Commits on Jan 4, 2013
  1. stream: fix infinite select() polling on osx

    Interruption FD buffer should be emptied after write, otherwise select()
    loop will poll indefinitely.
    indutny committed Jan 2, 2013
Commits on Jan 2, 2013
  1. unix: remove stale closing check in uv__write()

    Introduced in 0db3274 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.
    bnoordhuis committed Jan 2, 2013
Commits on Dec 28, 2012
  1. 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.
    bnoordhuis committed Dec 28, 2012
  2. 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
    saghul committed with bnoordhuis Dec 27, 2012
Commits on Dec 25, 2012
  1. include: update uv_signal_t doc comments

    Fixes #668.
    bnoordhuis committed Dec 25, 2012
Commits on Dec 24, 2012
  1. 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.
    bnoordhuis committed Dec 24, 2012