Commit Graph

902 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
f8f59824c4 unix, win: add ability to create tcp/udp sockets early
Introduce two new APIs:

int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, int flags)
int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, int flags)

The lower 8 bits of the flags field are used for the socket domain.
AF_INET, AF_INET6 and AF_UNSPEC are supported. If AF_UNSPEC is specified
the socket is created lazily, just like uv_{tcp,udp}_init.

Some Windows notes:

getsockname fails with WSAEINVAL if the socket is not bound. This could
potentially be improved by detecting the socket family and filling
the sockaddr_in/6 struct manually.

bind returns WSAEFAULT if we try to bind a socket to the wrong family.
Unix returns EINVAL.

PR-URL: https://github.com/libuv/libuv/pull/400
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-19 09:37:19 +02:00
Bert Belder
b6bf6d2d1f win,stream: add slot to remember CRT fd
Certain types of streams may be opened from a CRT file descriptor (as
opposed to a Windows HANDLE). In order to close the file descriptor
later, libuv must store the file descriptor used to open the stream.

PR-URL: https://github.com/libuv/libuv/pull/396
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-06-14 16:22:17 -07:00
Saúl Ibarra Corretgé
30c8be07bb 2015.06.06, Version 1.6.1 (Stable)
Changes since version 1.6.0:

* unix: handle invalid _SC_GETPW_R_SIZE_MAX values (cjihrig)
2015-06-05 19:45:58 +02:00
Saúl Ibarra Corretgé
adfccad764 2015.06.04, Version 1.6.0 (Stable)
Changes since version 1.5.0:

* aix: fix setsockopt for multicast options (Michael)

* unix: don't block for io if any io handle is primed (Saúl Ibarra
  Corretgé)

* windows: MSVC 2015 has snprintf() (Rui Abreu Ferreira)

* windows: Add VS2015 support to vcbuild.bat (Jason Williams)

* doc: fix typo in tcp.rst (Igor Soarez)

* linux: work around epoll bug in kernels < 2.6.37 (Ben Noordhuis)

* unix,win: add uv_os_homedir() (cjihrig)

* stream: fix `select()` race condition (Fedor Indutny)

* unix: prevent infinite loop in uv__run_pending (Saúl Ibarra Corretgé)

* unix: make sure UDP send callbacks are asynchronous (Saúl Ibarra
  Corretgé)

* test: fix `platform_output` netmask printing. (Andrew Paprocki)

* aix: add ahafs autoconf detection and README notes (Andrew Paprocki)

* core: add ability to customize memory allocator (Saúl Ibarra Corretgé)
2015-06-03 21:32:57 +02:00
Saúl Ibarra Corretgé
bddd6a8489 core: add ability to customize memory allocator
This patch is composed by the work done in
https://github.com/libuv/libuv/pull/231 and
https://github.com/libuv/libuv/pull/287 plus some changes by yours
truly.

Thanks @beevik and @mattsta for their work on this!

PR-URL: https://github.com/libuv/libuv/pull/368
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-02 12:05:20 +02:00
cjihrig
a62c2d5928 unix,win: add uv_os_homedir()
PR-URL: https://github.com/libuv/libuv/pull/350
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-05-21 17:31:35 +02:00
Saúl Ibarra Corretgé
4e77f74c7b 2015.05.07, Version 1.5.0 (Stable)
Changes since version 1.4.2:

* doc: clarify that the thread pool primites are not thread safe
  (Andrius Bentkus)

* aix: always deregister closing fds from epoll (Michael)

* unix: fix glibc-2.20+ macro incompatibility (Massimiliano Torromeo)

* doc: add Sphinx plugin for generating links to man pages (Saúl Ibarra
  Corretgé)

* doc: link system and library calls to man pages (Saúl Ibarra Corretgé)

* doc: document uv_getnameinfo_t.{host|service} (Saúl Ibarra Corretgé)

* build: update the location of gyp (Stephen von Takach)

* win: name all anonymous structs and unions (TomCrypto)

* linux: work around epoll bug in kernels 3.10-3.19 (Ben Noordhuis)

* darwin: fix size calculation in select() fallback (Ole André Vadla
  Ravnås)

* solaris: fix setsockopt for multicast options (Julien Gilli)

* test: fix race condition in multithreaded test (Ben Noordhuis)

* doc: fix long lines in tty.rst (Ben Noordhuis)

* test: use UV_TTY_MODE_* values in tty test (Ben Noordhuis)

* unix: don't clobber errno in uv_tty_reset_mode() (Ben Noordhuis)

* unix: reject non-tty fds in uv_tty_init() (Ben Noordhuis)

* win: fix pipe blocking writes (Alexis Campailla)

* build: fix cross-compiling for iOS (Steven Kabbes)

* win: remove unnecessary malloc.h

* include: use `extern "c++"` for defining C++ code (Kazuho Oku)

* unix: reap child on execvp() failure (Ryan Phillips)

* windows: fix handle leak on EMFILE (Brian Green)

* test: fix tty_file, close handle if initialized (Saúl Ibarra Corretgé)

* doc: clarify what uv_*_open accepts (Saúl Ibarra Corretgé)

* doc: clarify that we don't maintain external doc resources (Saúl
  Ibarra Corretgé)

* build: add documentation for ninja support (Devchandra Meetei
  Leishangthem)

* doc: document uv_buf_t members (Corey Farrell)

* linux: fix epoll_pwait() fallback on arm64 (Ben Noordhuis)

* android: fix compilation warning (Saúl Ibarra Corretgé)

* unix: don't close the fds we just setup (Sam Roberts)

* test: spawn child replacing std{out,err} to stderr (Saúl Ibarra
  Corretgé)

* unix: fix swapping fds order in uv_spawn (Saúl Ibarra Corretgé)

* unix: fix potential bug if dup2 fails in uv_spawn (Saúl Ibarra
  Corretgé)

* test: remove LOG and LOGF variadic macros (Saúl Ibarra Corretgé)

* win: fix uv_fs_access on directories (Saúl Ibarra Corretgé)

* win: fix of double free in uv_uptime (Per Nilsson)

* unix: open "/dev/null" instead of "/" for emfile_fd (Alan Rogers)

* docs: add some missing words (Daryl Haresign)

* unix: clean up uv_fs_open() O_CLOEXEC logic (Ben Noordhuis)

* build: set SONAME for shared library in uv.gyp (Rui Abreu Ferreira)

* windows: define snprintf replacement as inline instead of static (Rui
  Abreu Ferreira)

* win: fix unlink of readonly files (João Reis)

* doc: fix uv_run(UV_RUN_DEFAULT) description (Ben Noordhuis)

* linux: intercept syscall when running under memory sanitizer (Keno
  Fischer)

* aix: fix uv_interface_addresses return value (farblue68)

* windows: defer reporting TCP write failure until next tick (Saúl
  Ibarra Corretgé)

* test: add test for deferred TCP write failure (Saúl Ibarra Corretgé)
2015-05-06 21:48:15 +02:00
Saúl Ibarra Corretgé
1f711e4d6d Revert "memory: add uv_replace_allocator"
This reverts commit c272f1f1bc.

The concept will come back to libuv, but it needs some more work.
2015-04-29 09:37:02 +02:00
Kazuho Oku
252f3624c2 include: use extern "c++" for defining C++ code
PR-URL: https://github.com/libuv/libuv/pull/265
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-03-18 09:40:51 +01:00
Brett Vickers
c272f1f1bc memory: add uv_replace_allocator
With uv_replace_allocator, it's possible to override the default
memory allocator's malloc and free calls with functions of the user's
choosing. This allows libuv to interoperate with projects requiring a
custom memory allocator.

Internally, all calls to malloc and free have been replaced with
uv__malloc and uv__free, respectively. The uv__malloc and uv__free
functions call malloc and free unless they have been overridden by a
previous call to uv_replace_allocator.

As part of this change, the special aligned memory allocations
performed in src/win/fs-event.c have been replaced with standard
allocations. The 4-byte alignment being requested in this file was
unnecessary, since standard allocators already guarantee at least an
8-byte alignment.

PR-URL: https://github.com/libuv/libuv/pull/231
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-03-05 20:02:16 +01:00
TomCrypto
073323baca win: name all anonymous structs and unions
All the public structs and unions in the private fields in uv-win.h have
been named and all code accessing them updated, to comply to the C89
spec (which were previously causing warnings with the -pedantic flag).

PR-URL: https://github.com/libuv/libuv/pull/239
Reviewed-By: Andrius Bentkus <andrius.bentkus@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-03-04 09:35:10 +01:00
Saúl Ibarra Corretgé
8ef34592a9 doc: document uv_getnameinfo_t.{host|service}
Fixes: https://github.com/libuv/libuv/issues/182
PR-URL: https://github.com/libuv/libuv/pull/233
Reviewed-By: Tim Caswell <tim@creationix.com>
2015-03-02 16:53:57 +01:00
Saúl Ibarra Corretgé
1a7391348a 2015.02.27, Version 1.4.2 (Stable)
Changes since version 1.4.1:

* stream: ignore EINVAL for SO_OOBINLINE on OS X (Fedor Indutny)
2015-02-26 11:20:00 +01:00
Saúl Ibarra Corretgé
e8e3fc5789 2015.02.25, Version 1.4.1 (Stable)
Changes since version 1.4.0:

* win: don't use inline keyword in thread.c (Ben Noordhuis)

* windows: fix setting dirent types on uv_fs_scandir_next (Saúl Ibarra
  Corretgé)

* unix,windows: make uv_thread_create() return errno (Ben Noordhuis)

* tty: fix build for SmartOS (Julien Gilli)

* unix: fix for uv_async data race (Michael Penick)

* unix, windows: map EHOSTDOWN errno (Ben Noordhuis)

* stream: use SO_OOBINLINE on OS X (Fedor Indutny)
2015-02-24 20:45:46 +01:00
Ben Noordhuis
3f910a0196 unix, windows: map EHOSTDOWN errno
Fixes: https://github.com/libuv/libuv/issues/195
PR-URL: https://github.com/libuv/libuv/pull/212
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-02-19 15:38:12 +01:00
Saúl Ibarra Corretgé
3ddfb4a9cc windows: fix setting dirent types on uv_fs_scandir_next
Also make the tests more strict.

PR-URL: https://github.com/libuv/libuv/pull/201
Reviewed-By: Tim Caswell <tim@creationix.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2015-02-12 09:05:48 +01:00
Saúl Ibarra Corretgé
19fb8a9064 2015.02.10, Version 1.4.0 (Stable)
Changes since version 1.3.0:

* unix: check Android support for pthread_cond_timedwait_monotonic_np
  (Leith Bade)

* test: use modified path in test (cjihrig)

* unix: implement uv_stream_set_blocking() (Ben Noordhuis)
2015-02-09 21:06:37 +01:00
Saúl Ibarra Corretgé
165685b2a9 2015.01.29, Version 1.3.0 (Stable)
Changes since version 1.2.1:

* unix, windows: set non-block mode in uv_poll_init (Saúl Ibarra
  Corretgé)

* doc: clarify which flags are supported in uv_fs_event_start (Saúl
  Ibarra Corretgé)

* win,unix: move loop functions which have identical implementations
  (Andrius Bentkus)

* doc: explain how the threadpool is allocated (Alex Mo)

* doc: clarify uv_default_loop (Saúl Ibarra Corretgé)

* unix: fix implicit declaration compiler warning (Ben Noordhuis)

* unix: fix long line introduced in commit 94e628fa (Ben Noordhuis)

* unix, win: add synchronous uv_get{addr,name}info (Saúl Ibarra
  Corretgé)

* linux: fix epoll_pwait() regression with < 2.6.19 (Ben Noordhuis)

* build: compile -D_GNU_SOURCE on linux (Ben Noordhuis)

* build: use -fvisibility=hidden in autotools build (Ben Noordhuis)

* fs, pipe: no trailing terminator in exact sized buffers (Andrius
  Bentkus)

* style: rename buf to buffer and len to size for consistency (Andrius
  Bentkus)

* test: fix test-spawn on MinGW32 (Luis Martinez de Bartolome)

* win, pipe: fix assertion when destroying timer (Andrius Bentkus)

* win, unix: add pipe_peername implementation (Andrius Bentkus)
2015-01-28 21:54:27 +01:00
Andrius Bentkus
39a0936fec win, unix: add pipe_peername implementation
PR-URL: https://github.com/libuv/libuv/pull/166
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-01-28 21:40:32 +01:00
Andrius Bentkus
2bfa2e5e22 style: rename buf to buffer and len to size for consistency
PR-URL: https://github.com/libuv/libuv/pull/159
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-01-27 11:31:16 +01:00
Saúl Ibarra Corretgé
f2bb8d394c unix, win: add synchronous uv_get{addr,name}info
PR-URL: https://github.com/libuv/libuv/pull/156
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2015-01-23 01:12:05 +01:00
Saúl Ibarra Corretgé
4ca78e9890 2015.01.15, Version 1.2.1 (Stable)
Changes since version 1.2.0:

* unix: remove unused dtrace file (Saúl Ibarra Corretgé)

* test: skip TTY select test if /dev/tty can't be opened (Saúl Ibarra
  Corretgé)

* doc: clarify the behavior of uv_tty_init (Saúl Ibarra Corretgé)

* doc: clarify how uv_async_send behaves (Saúl Ibarra Corretgé)

* build: make dist now generates a full tarball (Johan Bergström)

* freebsd: make uv_exepath more resilient (Saúl Ibarra Corretgé)

* unix: make setting the tty mode to the same value a no-op (Saúl Ibarra
  Corretgé)

* win,tcp: support uv_try_write (Bert Belder)

* test: enable test-tcp-try-write on windows (Bert Belder)

* win,tty: support uv_try_write (Bert Belder)

* unix: set non-block mode in uv_{pipe,tcp,udp}_open (Ben Noordhuis)
2015-01-14 19:52:26 +01:00
Saúl Ibarra Corretgé
09f25b13cd 2015.01.06, Version 1.2.0 (Stable)
Changes since version 1.1.0:

* linux: fix epoll_pwait() sigmask size calculation (Ben Noordhuis)

* tty: implement binary I/O terminal mode (Yuri D'Elia)

* test: fix spawn test with autotools build (Ben Noordhuis)

* test: skip ipv6 tests when ipv6 is not supported (Ben Noordhuis)

* common: move STATIC_ASSERT to uv-common.h (Alexey Melnichuk)

* win/thread: store thread handle in a TLS slot (Alexey Melnichuk)

* unix: fix ttl, multicast ttl and loop options on IPv6 (Saúl Ibarra
  Corretgé)

* linux: fix support for preadv/pwritev-less kernels (Ben Noordhuis)

* unix: make uv_exepath(size=0) return UV_EINVAL (Ben Noordhuis)

* darwin: fix uv_exepath(smallbuf) UV_EPERM error (Ben Noordhuis)

* openbsd: fix uv_exepath(smallbuf) UV_EINVAL error (Ben Noordhuis)

* linux: fix uv_exepath(size=1) UV_EINVAL error (Ben Noordhuis)

* sunos: preemptively fix uv_exepath(size=1) (Ben Noordhuis)

* win: fix and clarify comments in winapi.h (Bert Belder)

* win: make available NtQueryDirectoryFile (Bert Belder)

* win: add definitions for directory information types (Bert Belder)

* win: use NtQueryDirectoryFile to implement uv_fs_scandir (Bert Belder)

* unix: don't unlink unix socket on bind error (Ben Noordhuis)

* build: fix bad comment in autogen.sh (Ben Noordhuis)

* build: add AC_PROG_LIBTOOL to configure.ac (Ben Noordhuis)

* test: skip udp_options6 if there no IPv6 support (Saúl Ibarra
  Corretgé)

* win: add definitions for MUI errors mingw lacks (Bert Belder)

* build: enable warnings in autotools build (Ben Noordhuis)

* build: remove -Wno-dollar-in-identifier-extension (Ben Noordhuis)

* build: move flags from Makefile.am to configure.ac (Ben Noordhuis)
2015-01-05 20:28:35 +01:00
Yuri D'Elia
025602da13 tty: implement binary I/O terminal mode
Introduce a uv_tty_mode_t enum for uv_tty_set_mode(), with backward
compatible values.  Add a new mode UV_TTY_MODE_IO, which uses
cfmakeraw() internally.

PR-URL: https://github.com/libuv/libuv/pull/86
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-27 18:18:24 +01:00
Saúl Ibarra Corretgé
a6d3d5a0f5 2014.12.25, Version 1.1.0 (Stable)
Changes since version 1.0.2:

* test: test that closing a poll handle doesn't corrupt the stack (Bert
  Belder)

* win: fix compilation of tests (Marc Schlaich)

* Revert "win: keep a reference to AFD_POLL_INFO in cancel poll" (Bert
  Belder)

* win: avoid stack corruption when closing a poll handle (Bert Belder)

* test: fix test-fs-file-loop on Windows (Bert Belder)

* test: fix test-cwd-and-chdir (Bert Belder)

* doc: indicate what version uv_loop_configure was added on (Saúl Ibarra
  Corretgé)

* doc: fix sphinx warning (Saúl Ibarra Corretgé)

* test: skip spawn_setuid_setgid if we get EACCES (Saúl Ibarra Corretgé)

* test: silence some Clang warnings (Saúl Ibarra Corretgé)

* test: relax osx_select_many_fds (Saúl Ibarra Corretgé)

* test: fix compilation warnings when building with Clang (Saúl Ibarra
  Corretgé)

* win: fix autotools build of tests (Luis Lavena)

* gitignore: ignore Visual Studio files (Marc Schlaich)

* win: set fallback message if FormatMessage fails (Marc Schlaich)

* win: fall back to default language in uv_dlerror (Marc Schlaich)

* test: improve compatibility for dlerror test (Marc Schlaich)

* test: check dlerror is "no error" in no error case (Marc Schlaich)

* unix: change uv_cwd not to return a trailing slash (Saúl Ibarra
  Corretgé)

* test: fix cwd_and_chdir test on Unix (Saúl Ibarra Corretgé)

* test: add uv_cwd output to platform_output test (Saúl Ibarra Corretgé)

* build: fix dragonflybsd autotools build (John Marino)

* win: scandir use 'ls' for formatting long strings (Kenneth Perry)

* build: remove clang and gcc_version gyp defines (Ben Noordhuis)

* unix, windows: don't treat uv_run_mode as a bitmask (Saúl Ibarra
  Corretgé)

* unix, windows: fix UV_RUN_ONCE mode if progress was made (Saúl Ibarra
  Corretgé)
2014-12-24 09:03:51 +01:00
Bert Belder
9f3fa71cfa Merge branch 'v0.10' into v1.x
Conflicts:
	src/win/poll.c
	test/test-poll-close-doesnt-corrupt-stack.c
2014-12-10 16:58:01 +01:00
Bert Belder
152c35d54d Revert "win: keep a reference to AFD_POLL_INFO in cancel poll"
The offending patch doesn't completely fix the issue, it just trades
stack corruption for heap corruption which is less likely.

In addition there is a much simpler solution for this problem.

This reverts commit cd894521dd.

PR-URL: https://github.com/libuv/libuv/pull/49
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Marc Schlaich <marc.schlaich@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-10 16:44:28 +01:00
Saúl Ibarra Corretgé
d42630dd9b 2014.12.10, Version 1.0.2 (Stable)
Changes since version 1.0.1:

* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)

* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)

* doc: fix spelling (Joey Geralnik)

* unix, windows: fix typos in comments (Joey Geralnik)

* test: canonicalize test runner path (Ben Noordhuis)

* test: fix compilation warnings (Saúl Ibarra Corretgé)

* test: skip tty test if detected width and height are 0 (Saúl Ibarra
  Corretgé)

* doc: update README with IRC channel (Saúl Ibarra Corretgé)

* Revert "unix: use cfmakeraw() for setting raw TTY mode" (Ben
  Noordhuis)

* doc: document how to get result of uv_fs_mkdtemp (Tim Caswell)

* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)

* unix, windows: add uv_loop_configure() function (Ben Noordhuis)

* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)

* test: raise fd limit for OSX select test (Saúl Ibarra Corretgé)

* unix: remove overzealous assert in uv_read_stop (Saúl Ibarra Corretgé)

* unix: reset the reading flag when a stream gets EOF (Saúl Ibarra
  Corretgé)

* unix: stop reading if an error is produced (Saúl Ibarra Corretgé)

* cleanup: remove all dead assignments (Maciej Małecki)

* linux: return early if we have no interfaces (Maciej Małecki)

* cleanup: remove a dead increment (Maciej Małecki)
2014-12-09 20:17:06 +01:00
Saúl Ibarra Corretgé
7d144851b5 Merge branch 'v0.10' into v1.x
Conflicts:
	AUTHORS
	ChangeLog
	src/version.c
	src/win/poll.c
2014-12-09 19:58:38 +01:00
schlamar
cd894521dd win: keep a reference to AFD_POLL_INFO in cancel poll 2014-12-09 08:49:59 +01:00
Ben Noordhuis
a6f2a4f834 Merge branch 'v0.10' into v1.x
Conflicts:
	AUTHORS
	ChangeLog
	README.md
	config-unix.mk
	include/uv.h
	src/unix/internal.h
	src/unix/kqueue.c
	src/unix/linux-core.c
	src/unix/stream.c
	src/uv-common.c
	src/uv-common.h
	src/version.c
	test/test-osx-select.c
2014-12-05 19:18:36 +01:00
Ben Noordhuis
9da5fd443e unix, windows: add uv_loop_configure() function
The only supported option right now is UV_LOOP_BLOCK_SIGNAL, which only
supports the SIGPROF signal and only on UNIX platforms.  So yes, it is
kind of limited right now.  But everything has to start somewhere.

Refs strongloop/strong-agent#3 and strongloop-internal/scrum-cs#37.

PR-URL: https://github.com/libuv/libuv/pull/15
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-05 17:39:43 +01:00
Bert Belder
0a8e81374e 2014.11.27, Version 1.0.1 (Stable)
Changes since version 1.0.0:

* readme: remove Rust from users (Elijah Andrews)

* doc,build,include: update project links (Ben Noordhuis)

* doc: fix typo: Strcutures -> Structures (Michael Ira Krufky)

* unix: fix processing process handles queue (Saúl Ibarra Corretgé)

* win: replace non-ansi characters in source file (Bert Belder)
2014-11-26 21:31:41 +01:00
Ben Noordhuis
7ce1113885 doc,build,include: update project links
The project home has moved from https://github.com/joyent/libuv to
https://github.com/libuv/libuv.  Update the links inside the repo.
2014-11-25 15:39:12 +01:00
Saúl Ibarra Corretgé
feb2a9e694 2014.11.21, Version 1.0.0 (Stable)
Changes since version 1.0.0-rc2:

* doc: fix git/svn url for gyp repo in README (Emmanuel Odeke)

* windows: fix fs_read with nbufs > 1 and offset (Unknown W. Brackets)

* win: add missing IP_ADAPTER_UNICAST_ADDRESS_LH definition for MinGW
  (huxingyi)

* doc: mention homebrew in README (Mikhail Mukovnikov)

* doc: add learnuv workshop to README (Thorsten Lorenz)

* doc: fix parameter name in uv_fs_access (Saúl Ibarra Corretgé)

* unix: use cfmakeraw() for setting raw TTY mode (Yuri D'Elia)

* win: fix uv_thread_self() (Alexis Campailla)

* build: add x32 support to gyp build (Ben Noordhuis)

* build: remove dtrace probes (Ben Noordhuis)

* doc: fix link in misc.rst (Manos Nikolaidis)

* mailmap: remove duplicated entries (Saúl Ibarra Corretgé)

* gyp: fix comment regarding version info location (Saúl Ibarra
  Corretgé)
2014-11-20 19:34:12 +01:00
Saúl Ibarra Corretgé
e03c0c7383 doc: fix parameter name in uv_fs_access
Closes #1560
2014-11-06 21:14:57 -05:00
Saúl Ibarra Corretgé
f277e80707 version: now working on 1.0.0-rc3 2014-10-20 22:50:40 +02:00
Saúl Ibarra Corretgé
e3ea6c1179 2014.10.21, Version 1.0.0-rc2 (Pre-release)
Changes since version 1.0.0-rc1:

* build: add missing fixtures to distribution tarball (Rob Adams)

* doc: update references to current stable branch (Zachary Newman)

* fs: fix readdir on empty directory (Fedor Indutny)

* fs: rename uv_fs_readdir to uv_fs_scandir (Saúl Ibarra Corretgé)

* doc: document uv_alloc_cb (Saúl Ibarra Corretgé)

* doc: add migration guide from version 0.10 (Saúl Ibarra Corretgé)

* build: add DragonFly BSD support in autotools (Robin Hahling)

* doc: document missing stream related structures (Saúl Ibarra Corretgé)

* doc: clarify uv_loop_t.data field lifetime (Saúl Ibarra Corretgé)

* doc: add documentation for missing functions and structures (Saúl
  Ibarra Corretgé)

* doc: fix punctuation and grammar in README (Jeff Widman)

* windows: return libuv error codes in uv_poll_init() (cjihrig)

* unix, windows: add uv_fs_access() (cjihrig)

* windows: fix netmask detection (Alexis Campailla)

* unix, windows: don't include null byte in uv_cwd size (Saúl Ibarra
  Corretgé)

* unix, windows: add uv_thread_equal (Tomasz Kołodziejski)

* windows: fix fs_write with nbufs > 1 and offset (Unknown W. Brackets)
2014-10-20 22:47:56 +02:00
Tomasz Kołodziejski
59658a8de7 unix, windows: add uv_thread_equal 2014-10-20 09:51:49 +02:00
cjihrig
c18205a1c5 unix, windows: add uv_fs_access() 2014-10-13 10:23:53 +02:00
Saúl Ibarra Corretgé
03e53f1cf7 fs: rename uv_fs_readdir to uv_fs_scandir
Closes #1431
2014-09-25 10:09:58 +02:00
Saúl Ibarra Corretgé
01293ac03a version: now working on 1.0.0-rc2 2014-09-18 18:48:09 +02:00
Saúl Ibarra Corretgé
0c28bbf7b4 version: set version to 1.0.0-rc1 2014-09-18 18:13:53 +02:00
Alexis Campailla
6ced8c2cc7 windows: improve timer precision
Improve timing precision by using QueryPerformanceCounter.

This is part of the fix for Node.js' test-timers-first-fire.js.
2014-09-17 23:17:41 +02:00
Saúl Ibarra Corretgé
f70b3fae8b version: add ability to specify a version suffix 2014-09-11 20:58:41 +02:00
Saúl Ibarra Corretgé
1cc5f179f5 include: cleanup uv.h
Remove comments describing the API which are now part of the
documentation, thus avoiding future comment rot (and removing the
existing part).
2014-09-11 09:38:35 +02:00
Saúl Ibarra Corretgé
2d5eaea1cd unix: simplify how process handle queue is managed 2014-09-04 10:06:52 +02:00
mattn
ae6197d730 windows: remove duplicated field
Fixes build
2014-09-03 18:42:46 +02:00
Saúl Ibarra Corretgé
06f9e1438e core: add a reserved field to uv_handle_t and uv_req_t
Just in case we need to work hard in keeping ABI compatibility.
2014-08-29 13:27:53 +02:00
Saúl Ibarra Corretgé
e524f89beb core: update version to 1.0.0 2014-08-29 10:31:50 +02:00
Saúl Ibarra Corretgé
4ca9a36389 unix, windows: add uv_fileno
Returns the platform specific file descriptor for handles that are
backed by one. The datatype is abstracted as uv_os_fd_t, which maps to
int on Unices and HANDLE on Windows.

Users can use this function to set specific socket options, for example,
in a non portable way.

This function is essentially a shotgun, you better be careful with
whatever you do with it, don't blame me if you used it to get the fd of
a stream, close it yourself and expect things to Just Work.
2014-08-27 10:53:40 +02:00
Saúl Ibarra Corretgé
df8ab507a0 fs: extend reported types in uv_fs_readdir_next
Support all possible types on Unix, and files, directories and links on
Windows. Some systems (hello SunOS!) don't have the d_type field on struct
dirent, so mark them as UV_DIRENT_UNKNOWN.
2014-08-15 16:44:44 +02:00
Fedor Indutny
ab2c4425a5 fs: introduce uv_readdir_next() and report types
Introduce:

    int uv_fs_readdir_next(uv_fs_t* req, uv_dirent_t* ent);

`uv_fs_readdir()` is not returning a file names list in `req->ptr`
anymore, the proper way to gather them is to call `uv_fs_readdir_next()`
in a callback.
2014-08-14 17:19:45 +04:00
Pavel Platto
a669f21bf8 windows: use OpenBSD implementation for uv_fs_mkdtemp 2014-08-12 10:04:09 +02:00
Leonard Hecker
4c90cc8e14 unix: fix typedef of uv_buf_t
Typedefs of unnamed structs cannot be forward declared.
Giving the uv_buf_t struct a name makes forward declarations possible.
2014-08-10 17:30:13 +02:00
huxingyi
ca4741b4a5 windows: fix build on MinGW 2014-08-10 12:09:04 +02:00
Andrius Bentkus
0ecee213ea unix, windows: add uv_recv_buffer_size and uv_send_buffer_size 2014-08-09 11:36:35 +02:00
Jameson Nash
837c62c71b windows: make uv_read_stop immediately stop reading
This implements locking around the blocking call to ReadFile to get
around a Windows kernel bug where a blocking ReadFile operation on a
stream can deadlock the thread. This allows uv_read_stop to immediately
cancel a pending IO operation, and allows uv_pipe_getsockname to
"pause" any pending read (from libuv) while it retrieves the
sockname information.

If unsupported by the OS (pre-Vista), this reverts to the old
(e.g. deadlock-prone) behavior

Closes #1313
2014-08-09 11:10:57 +02:00
Saúl Ibarra Corretgé
02e1ebd40b include: remove unneeded EADDRINFO errno
EADDRINFO is not a readl errno, it was used to signal any error that
getaddrinfo would return, but we return actual errors now.
2014-08-07 21:24:55 +02:00
Saúl Ibarra Corretgé
a9a4872c29 Now working on v0.11.29 2014-08-07 12:21:41 +02:00
Saúl Ibarra Corretgé
fc9e2a0bc4 2014.08.08, Version 0.11.28 (Unstable)
Changes since version 0.11.27:

* unix, windows: const-ify handle in uv_udp_getsockname (Rasmus
  Pedersen)

* windows: use UV_ECANCELED for aborted TCP writes (Saúl Ibarra
  Corretgé)

* windows: add more required environment variables (Jameson Nash)

* windows: sort environment variables before calling CreateProcess
  (Jameson Nash)

* unix, windows: move uv_loop_close out of assert (John Firebaugh)

* windows: fix buffer overflow on uv__getnameinfo_work() (lilohuang)

* windows: add uv_backend_timeout (Jameson Nash)

* test: disable tcp_close_accept on Windows (Saúl Ibarra Corretgé)

* windows: read the PATH env var of the child (Alex Crichton)

* include: avoid using C++ 'template' reserved word (Iñaki Baz Castillo)

* include: fix version number (Saúl Ibarra Corretgé)
2014-08-07 12:18:10 +02:00
Saúl Ibarra Corretgé
6bcb799a0d include: fix version number 2014-08-07 12:17:06 +02:00
Iñaki Baz Castillo
a1ff22cb7e include: avoid using C++ 'template' reserved word
Closes #1394
2014-08-06 12:52:46 +02:00
Rasmus Christian Pedersen
e72d48ddab unix, windows: const-ify handle in uv_udp_getsockname 2014-07-31 22:27:36 +02:00
Alexis Campailla
6d3a051eb4 windows: relay TCP bind errors via ipc
This is the libuv side of the fix for Node's cluster module on Windows.
https://github.com/joyent/node/issues/7691

Windows and Unix return certain socket errors (i.e. EADDRINUSE) at
different times: bind on Windows, and listen on Unix.
In an effort to hide this difference, libuv on Windows stores such
errors in the bind_error field of uv_tcp_t, to defer raising it at
listen time.
This worked fine except for the case in which a socket is shared in
a Node cluster and a bind error occurs.

A previous attempt to fix this (
d1e6be1460
3da36fe00e
) was flawed becaused in an attempt to relay the error at the JS level
it caused the master to start accepting connections.

With this new approach, libuv itself is relaying the bind errors,
providing for a uniform behavior of uv_tcp_listen.
2014-07-31 17:24:40 +02:00
Pavel Platto
e99b89f2ad unix, windows: add uv_fs_mkdtemp 2014-07-31 09:43:55 +02:00
Andrew Low
cdc979dbe0 aix: improve AIX compatibility 2014-07-22 22:57:24 +02:00
Graham Lee
dc1ea27c73 doc: clarify the return value of uv_default_loop 2014-07-13 11:23:08 +02:00
Iñaki Baz Castillo
bf6e90f4d6 doc: cleanup API documentation in uv.h 2014-07-06 22:33:15 +02:00
mattn
b17223cd60 build: fix build on MinGW32 2014-07-06 20:40:59 +02:00
Andrius Bentkus
b9b386ac5a doc: grammar, udp documentation fix up 2014-07-05 11:23:48 +02:00
Saúl Ibarra Corretgé
40ad12e5be unix: return UV_EAGAIN if uv_try_write cannot write any data 2014-07-04 20:45:09 +02:00
Andrius Bentkus
0d43992c3b unix, win: add uv_udp_try_send
The function returns UV_EAGAIN if the queue is not empty and
the message couldn't be sent immediately.
2014-07-04 18:30:33 +02:00
Andrius Bentkus
b769484ca3 unix, win: add send_queue_size and send_queue_count to uv_udp_t
This functionality is present in stream and uv_udp_t has a queue
as well so it makes sense for udp to have a send_write_size.
Since udp sends entire messages atomically, the send_queue_count field
lets the user determine how many messages are there left to send.
2014-07-04 18:28:18 +02:00
Andrius Bentkus
d17bfc617e doc: add documentation to uv_udp_start_recv 2014-07-02 18:49:06 +02:00
Saúl Ibarra Corretgé
4bace4d67c unix: use struct sockaddr_storage for target UDP addr 2014-06-29 23:52:46 +02:00
Saúl Ibarra Corretgé
8d11aacb79 unix, windows: use the same threadpool implementation 2014-06-27 14:27:04 +02:00
Tim Cooper
546fa7d508 doc: remove duplicate word 2014-06-27 08:16:53 +02:00
Fedor Indutny
4661f2d6c0
Now working on v0.11.27 2014-06-27 04:41:02 +04:00
Fedor Indutny
115281a105
2014.06.28, Version 0.11.26 (Unstable)
Changes since version 0.11.25:

* windows: add VT100 codes ?25l and ?25h (JD Ballard)

* windows: add invert ANSI (7 / 27) emulation (JD Ballard)

* unix: fix handling error on UDP socket creation (Saúl Ibarra Corretgé)

* unix, windows: getnameinfo implementation (Rasmus Pedersen)

* heap: fix `heap_remove()` (Fedor Indutny)

* unix, windows: fix parsing scoped IPv6 addresses (Saúl Ibarra
  Corretgé)

* windows: fix handling closed socket while poll handle is closing (Saúl
  Ibarra Corretgé)

* thread: barrier functions (Ben Noordhuis)

* windows: fix PYTHON environment variable usage (Jay Satiro)

* unix, windows: return system error on EAI_SYSTEM (Saúl Ibarra
  Corretgé)

* windows: fix handling closed socket while poll handle is closing (Saúl
  Ibarra Corretgé)

* unix: don't run i/o callbacks after prepare callbacks (Saúl Ibarra
  Corretgé)

* windows: add tty unicode support for input (Peter Atashian)

* header: introduce `uv_loop_size()` (Andrius Bentkus)

* darwin: invoke `mach_timebase_info` only once (Fedor Indutny)
2014-06-27 04:40:57 +04:00
Saúl Ibarra Corretgé
d4c1228d15 include: const-ify arguments to uv_getnameinfo_cb 2014-06-26 22:46:39 +02:00
Saúl Ibarra Corretgé
029e1273b8 unix: define NI_MAXHOST and NI_MAXSERV if needed
OSX only exposes them if _POSIX_C_SOURCE is not defined, for instance.
2014-06-24 10:20:43 +02:00
Andrius Bentkus
e392a1af4d header: introduce uv_loop_size()
We add a function called uv_loop_size which returns the size of
the loop. It is an additional function which complements
`uv_handle_size` and` uv_req_size` in order to provide full FFI
support.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-24 08:47:17 +04:00
Saúl Ibarra Corretgé
a098ac66dd unix, windows: return system error on EAI_SYSTEM 2014-06-16 10:09:45 +02:00
Ben Noordhuis
b64c359557 include: document barrier functions
Add some basic doc comments to the uv_barrier_*() functions and document
the "serializer" return value from the previous commit.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-07 07:57:09 -07:00
Ben Noordhuis
91985d48f6 unix, windows: make uv_barrier_wait() return bool
Make uv_barrier_wait() return a boolean value indicating whether this
thread was the "serializer".

From `man pthread_barrier_wait`:

    Upon successful completion, the pthread_barrier_wait() function
    shall return PTHREAD_BARRIER_SERIAL_THREAD for a single (arbitrary)
    thread synchronized at the barrier and zero for each of the other
    threads.

Exposing that information from libuv is useful because it can make
cleanup significantly easier:

    if (uv_barrier_wait(&barrier) > 0)
      uv_barrier_destroy(&barrier);

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-07 07:57:08 -07:00
Saúl Ibarra Corretgé
aab8d9dab4 doc: clarify return value when UV_RUN_NOWAIT is used
Signed-off-by: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-05-25 23:39:40 +02:00
Rasmus Christian Pedersen
70c42563c1 unix, windows: getnameinfo implementation
Closes #852
2014-05-20 17:33:52 +02:00
Rasmus Christian Pedersen
ecaede660c unix, windows: uv_dlerror const argument 2014-05-13 00:00:54 +02:00
Saúl Ibarra Corretgé
fa0e1e5071 unix, windows: remove unneeded define 2014-05-08 09:08:33 +02:00
Trevor Norris
32597100b8 thread: add uv_thread_cb typedef
To keep with convention, add a typedef for the function called that
initializes the new thread.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-02 01:33:13 +04:00
Timothy J Fontaine
b5548f18c9 Now working on v0.11.26 2014-05-01 09:16:48 -07:00
Timothy J Fontaine
2acd544cff 2014.05.02, Version 0.11.25 (Unstable)
Changes since version 0.11.24:

* osx: pass const handle pointer to uv___stream_fd (Chernyshev
  Viacheslav)

* unix, windows: pass const handle ptr to uv_tcp_get*name (Chernyshev
  Viacheslav)

* common: pass const sockaddr ptr to uv_ip*_name (Chernyshev Viacheslav)

* unix, windows: validate flags on uv_udp|tcp_bind (Saúl Ibarra
  Corretgé)

* unix: handle case when addr is not initialized after recvmsg (Saúl
  Ibarra Corretgé)

* unix, windows: uv_now constness (Rasmus Pedersen)
2014-05-01 09:16:45 -07:00
Rasmus Christian Pedersen
87ae69b638 unix, windows: uv_now constness
uv_now doesnt require modification of uv_loop_t as such argument is
changed to a const uv_loop_t* as this more in spirit with remaining
API in libuv.
2014-04-29 19:39:13 -03:00
Saúl Ibarra Corretgé
76eb7518c6 doc: clarify what the addr argument of uv_udp_recv_cb contains 2014-04-23 19:28:30 +02:00
Saúl Ibarra Corretgé
d86d86633e doc: clarify uv_try_write return values 2014-04-22 08:41:16 +02:00
Chernyshev Viacheslav
20d092edc8 common: pass const sockaddr ptr to uv_ip*_name
uv_ip4_name and uv_ip6_name do not modify passed sockaddr pointer,
so there is no need to keep this parameter non-const.
2014-04-18 12:07:38 +02:00
Chernyshev Viacheslav
886e2bcd55 unix, windows: pass const handle ptr to uv_tcp_get*name
uv_tcp_getsockname and uv_tcp_getpeername do not modify passed handle
pointer, so there is no need to keep this parameter non-const.
2014-04-18 12:07:38 +02:00
Trevor Norris
f212ceffae include: reorder UV_HANDLE_PRIVATE_FIELDS
The fields for UV_HANDLE_PRIVATE_FIELDS in uv-win.h and uv-unix.h are
the same, but in different order. Simply swap them so uv_handle_t are
the same on both platforms.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-17 14:31:23 +04:00
Timothy J Fontaine
1daff47ae9 Now working on v0.11.25 2014-04-14 09:56:52 -07:00
Timothy J Fontaine
ed948c29f6 2014.04.15, Version 0.11.24 (Unstable)
Changes since version 0.11.23:

* linux: reduce file descriptor count of async pipe (Ben Noordhuis)

* sunos: support IPv6 qualified link-local addresses (Saúl Ibarra
  Corretgé)

* windows: fix opening of read-only stdin pipes (Alexis Campailla)

* windows: Fix an infinite loop in uv_spawn (Alex Crichton)

* windows: fix console signal handler refcount (李港平)

* inet: allow scopeid in uv_inet_pton (Fedor Indutny)

* win: always leave crit section in get_proc_title (Fedor Indutny)
2014-04-14 09:56:49 -07:00
Fedor Indutny
6a657dcbee include: add reserved field for #926
Introduce reserved field to be able to fix #926 after v0.12 release.
2014-04-14 20:44:49 +04:00
Saúl Ibarra Corretgé
2c02c4ee1e sunos: support IPv6 qualified link-local addresses 2014-04-09 19:40:01 +02:00
Fedor Indutny
842c70c5c5
Now working on v0.11.24
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-07 15:39:10 +04:00
Fedor Indutny
e54de537ef
2014.04.07, Version 0.11.23 (Unstable)
Changes since version 0.11.22:

* fs: avoid using readv/writev where possible (Fedor Indutny)

* mingw: fix build with autotools (Saúl Ibarra Corretgé)

* bsd: support IPv6 qualified link-local addresses (Saúl Ibarra Corretgé)

* unix: add UV_HANDLE_IPV6 flag to tcp and udp handles (Saúl Ibarra Corretgé)

* unix, windows: do not set SO_REUSEADDR by default on udp (Saúl Ibarra
  Corretgé)

* windows: fix check in uv_tty_endgame() (Maks Naumov)

* unix, windows: add IPv6 support for uv_udp_multicast_interface (Saúl Ibarra
  Corretgé)

* unix: fallback to blocking writes if reopening a tty fails (Saúl Ibarra
  Corretgé)

* unix: fix handling uv__open_cloexec failure (Saúl Ibarra Corretgé)

* unix, windows: add IPv6 support to uv_udp_set_membership (Saúl Ibarra
  Corretgé)

* unix, windows: removed unused status parameter (Saúl Ibarra Corretgé)

* android: add support of ifaddrs in android (Javier Hernández)

* build: fix SunOS and AIX build with autotools (Saúl Ibarra Corretgé)

* build: freebsd link with libelf if dtrace enabled (Saúl Ibarra Corretgé)

* stream: do not leak `alloc_cb` buffers on error (Fedor Indutny)

* unix: fix setting written size on uv_wd (Saúl Ibarra Corretgé)

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-07 15:38:27 +04:00
Fedor Indutny
7d5ac7b9cc Merge branch 'v0.10'
Conflicts:
	include/uv.h
	src/unix/error.c
2014-04-03 17:04:32 +04:00
Fedor Indutny
295882ed32 error: add EMLINK mapping
fix joyent/node#7307
2014-04-03 16:37:25 +04:00
Saúl Ibarra Corretgé
e89740a957 bsd: support IPv6 qualified link-local addresses 2014-04-02 01:27:01 +02:00
Saúl Ibarra Corretgé
3558d65d2f unix, windows: do not set SO_REUSEADDR by default on udp
Add UV_UDP_REUSEADDR flag instead, which can be passed to uv_udp_bind.
If the udp handle is unbound when uv_udp_set_memberhsip or
uv_udp_set_multicast_interface is called, the handle will be bound with
UV_UDP_REUSEADDR set.
2014-04-02 01:21:35 +02:00
Saúl Ibarra Corretgé
db2a9072bc unix, windows: removed unused status parameter
async, timer, prepare, idle and check handles don't need the status
parameter.
2014-03-17 21:42:36 +01:00
Javier Hernández
a2506c9362 android: add support of ifaddrs in android
Fixes https://github.com/joyent/node/issues/7291
2014-03-16 23:16:25 +01:00
Timothy J Fontaine
1dc2709b99 Now working on v0.11.23 2014-03-10 16:58:32 -07:00
Timothy J Fontaine
cd0c19b1d3 2014.03.11, Version 0.11.22 (Unstable)
Changes since version 0.11.21:

* unix, windows: map ERANGE errno (Saúl Ibarra Corretgé)

* unix, windows: make uv_cwd be consistent with uv_exepath (Saúl Ibarra
  Corretgé)

* process: remove debug perror() prints (Fedor Indutny)

* windows: fall back for volume info query (Isaiah Norton)

* pipe: allow queueing pending handles (Fedor Indutny)

* windows: fix winsock status codes for address errors (Raul Martins)

* windows: Remove unused variable from uv__pipe_insert_pending_socket
  (David Capello)

* unix: workaround broken pthread_sigmask on Android (Paul Tan)

* error: add ENXIO for O_NONBLOCK FIFO open() (Fedor Indutny)

* freebsd: use accept4, introduced in version 10 (Saúl Ibarra Corretgé)

* windows: fix warnings of MinGW -Wall -O3 (StarWing)

* openbsd, osx: fix compilation warning on scandir (Saúl Ibarra
  Corretgé)

* linux: always deregister closing fds from epoll (Geoffry Song)

* unix: reopen tty as /dev/tty (Saúl Ibarra Corretgé)

* kqueue: invalidate fd in uv_fs_event_t (Fedor Indutny)
2014-03-10 16:54:33 -07:00
Fedor Indutny
9aa48312bc Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	include/uv.h
	src/unix/error.c
	src/unix/process.c
	src/version.c
2014-03-06 20:45:15 +04:00
Fedor Indutny
4f72f2145b error: add ENXIO for O_NONBLOCK FIFO open()
When opening FIFO with `O_NONBLOCK` flag, `ENXIO` could be returned if
the readable side hasn't yet opened this FIFO.
2014-03-06 20:36:07 +04:00
Paul Tan
347000929d unix: workaround broken pthread_sigmask on Android
On android, if a call to `pthread_sigmask` fails with EINVAL, fallback
to `sigprocmask`. This workarounds the broken behaviour of
`pthread_sigmask` on Android versions < 4.1. See:

* https://android.googlesource.com/platform/bionic/+/9bf330b5
* https://code.google.com/p/android/issues/detail?id=15337

This is implemented by replacing all calls of `pthread_sigmask` to a new
function `uv__pthread_sigmask` which implements this fallback mechanism.
2014-03-06 11:54:50 +01:00
Fedor Indutny
b05a3ee4d1 pipe: allow queueing pending handles
Introduce `int uv_pipe_pending_count(uv_pipe_t*)` and
`uv_handle_type uv_pipe_pending_type(uv_pipe_t*)`. They should be
used in IPC pipe's read cb to accept incoming handles:

    int count = uv_pipe_pending_count(pipe);
    int i;
    for (i = 0; i < count; i++) {
      uv_handle_type type = uv_pipe_pending_type(pipe);
      /* ... */
      uv_accept(...);
    }
2014-03-04 00:34:29 +04:00
Saúl Ibarra Corretgé
422d2810b3 unix, windows: make uv_cwd be consistent with uv_exepath
Fixes #446
2014-02-27 09:44:28 +01:00
Timothy J Fontaine
649dfc3037 Now working on v0.11.22 2014-02-26 18:04:24 -08:00
Timothy J Fontaine
3ef958158a 2014.02.28, Version 0.11.21 (Unstable)
Changes since version 0.11.20:

* unix: fix uv_fs_write when using an empty buffer (Saúl Ibarra
  Corretgé)

* unix, windows: add assertion in uv_loop_delete (Saúl Ibarra Corretgé)
2014-02-26 18:04:23 -08:00
Timothy J Fontaine
2cfb96e9e2 src: bump the version number
There was a bug in the libuv release tool where it didn't properly
update the proper version file.
2014-02-26 17:53:01 -08:00
Saúl Ibarra Corretgé
b055538d09 unix, windows: clarify what uv_stream_set_blocking does
Also replace the assert with an error on unix.
2014-02-26 00:03:30 +01:00
Saúl Ibarra Corretgé
7ad8f74302 unix, windows: set required size on UV_ENOBUFS
When the supplied buffer is not big enough and UV_ENOBUFS is
returned, hint the user about the required size by setting
the len paramemeter to the required value.

Applies to:
- uv_pipe_getsockname
- uv_fs_event_getpath
- uv_fs_poll_getpath
2014-02-25 11:56:02 +01:00
Saúl Ibarra Corretgé
6f98f4efd1 unix, windows: map ERANGE errno
This is a backport of 2f58bb6 from the master branch
2014-02-25 10:48:26 +01:00
Saúl Ibarra Corretgé
2f58bb6018 unix, windows: map ERANGE errno 2014-02-25 09:51:44 +01:00
Saúl Ibarra Corretgé
8c9d5dce57 unix, windows: add uv_fs_poll_getpath 2014-02-24 23:21:13 +01:00
Saúl Ibarra Corretgé
a7ac2c462a unix, windows: add uv_fs_event_getpath 2014-02-24 22:08:23 +01:00
Saúl Ibarra Corretgé
e5bdef9b59 fsevent: rename filename field to path
Also, it's now considered private.
2014-02-24 21:51:21 +01:00
Saúl Ibarra Corretgé
10f9120d78 errno: map EFBIG, ENOPROTOOPT and ETXTBSY
This is a backport of:
107be2bed3
4a023fc078
aaaefe32ca
2014-02-24 12:57:28 +01:00
Fedor Indutny
aaaefe32ca errno: add ETXTBSY
Add `ETXTBSY` which could be returned by file system reads on some
unixes and emulate it with -148 (`ERROR_PATH_BUSY`) on windows.
2014-02-24 15:41:17 +04:00
Saúl Ibarra Corretgé
4a023fc078 unix, windows: map ENOPROTOOPT errno
Fixes #1143
2014-02-24 09:19:12 +01:00
Saúl Ibarra Corretgé
5ac214c712 unix, windows: add uv_pipe_getsockname 2014-02-23 20:25:20 +01:00
Saúl Ibarra Corretgé
a442aa7643 doc: small fixes to comments and syntax 2014-02-23 18:01:03 +01:00
Benjamin Saunders
13dd3502a7 fs: vectored IO API for filesystem read/write
This improves API consistency with uv_read and uv_write and may
improve efficiency for some uses. Vectored IO is emulated when the
requisite system calls are unavailable.
2014-02-23 17:24:05 +01:00
Oleg Efimov
da9a2b1d3d unix, windows: add uv_getrusage() function 2014-02-21 18:50:15 +01:00
Saúl Ibarra Corretgé
787f5fff92 unix, windows: add uv_loop_init and uv_loop_close
These functions supersede uv_loop_new and uv_loop_delete.
uv_loop_init initialized a user allocated loop and uv_loop_close
removes all associated resources a loop uses after it has finished
execution.

uv_loop_new and uv_loop_delete are now deprecated.
2014-02-21 09:56:13 +01:00
Ben Noordhuis
f17c535b73 unix: use a heap for timers
Replace the red-black tree with a heap.  The most common operation that
libuv performs on timers is looking up the first timer to expire.  With
a red-black tree, that operation is O(log n).  With a heap, it's O(1).
2014-02-19 13:36:14 +01:00
Fedor Indutny
a03ea239db Revert "fs: vectored IO API for filesystem read/write"
This reverts commit 7df24583e5.
2014-02-18 21:48:13 +04:00
Benjamin Saunders
7df24583e5 fs: vectored IO API for filesystem read/write
This improves API consistency with uv_read and uv_write and may
improve efficiency for some uses. Vectored IO is emulated when the
requisite system calls are unavailable.
2014-02-18 12:30:20 +04:00
Saúl Ibarra Corretgé
d4c12adff6 include: expose libuv version in header files 2014-02-17 20:53:20 +01:00
Saúl Ibarra Corretgé
107be2bed3 unix, windows: map EFBIG errno 2014-02-14 17:03:19 +01:00
Saúl Ibarra Corretgé
c8e4db6e00 include: mark close_cb field as private 2014-02-11 23:56:50 +01:00
Sam Roberts
a3c0e48faa doc: describe signal send emulation on windows
Signals don't exist on Windows, but libuv emulates the behaviour of
several Unix signals. This wasn't documented, and the existing
documentation for signal reception emulation on Windows was worded as if
it applied to signal sending, which it does not.
2014-02-07 09:39:06 +01:00
Austin Foxley
451de61b72 unix, win: add uv_udp_set_multicast_interface() 2014-02-07 09:07:11 +01:00
Fedor Indutny
6abe1e4b95 fs: uv__cloexec() opened fd
Every file descriptor opened using libuv should be automatically marked
as CLOEXEC to prevent it from leaking to a child process. Note that
since we are opening fds in a thread pool, there is a possible race
condition between `uv_spawn()` and the `open()` + `uv__cloexec()`. The
rwlock was added to avoid it.

see https://github.com/joyent/node/issues/6905
2014-02-01 01:02:37 +04:00
Fedor Indutny
8f15aae52f tcp: uv_tcp_dualstack()
Explicitly disable/enable dualstack depending on presence of flag set by
uv_tcp_dualstack() function.
2014-01-19 23:07:42 +00:00
Fedor Indutny
8b6c19e219 Revert "pipe: allow queueing pending handles"
The commit is quite broken and must be refactored before going into.

This reverts commit 08aeaf6193.
2013-12-24 02:17:12 +04:00
Fedor Indutny
08aeaf6193 pipe: allow queueing pending handles
If multiple handles arrive to the IPC pipe at the same time (happens on
some platforms), libuv will queue them internally, and call `read2_cb`
multiple times with a null-buffer and proper `handle_type`.
2013-12-23 14:15:32 +04:00
Sam Roberts
ed36b85d3b unix, windows: add uv_loop_alive() function
Useful to know when the the event loop is empty, this can't be done with
uv_run() without possibly blocking, or running some events (which might
empty the event loop as a side-effect).
2013-12-19 15:35:03 -08:00
Fedor Indutny
17d60e3f94 stream: allow multiple buffers for uv_try_write 2013-12-13 22:59:47 +04:00
Fedor Indutny
b5e7798a89 stream: introduce uv_try_write(...)
`uv_try_write(stream, buf, size)` acts like `uv_write()`,
but without queueing actual write until UV_POLLOUT (or IOCP completion).
This is useful for doing writes using on-stack `uv_write_t` requests.

fix #1025
2013-12-13 22:29:00 +04:00
Steven Kabbes
dbe9905799 libuv: add more getaddrinfo errors 2013-11-25 00:53:07 +01:00
Alex Crichton
f764bff699 unix: return exec errors from uv_spawn, not async
If spawning a process fails due to an exec() failure (but it succeeded
in forking), then this should be considered a spawn failure instead of
an asynchronous termination of the process. This allows to check for
common exec() failure conditions such as a bad path quickly instead of
having to rely on keeping track of the async callback.

Additionally, the meaning of the two fields returned in the callback are
now exactly what they advertise to be. The process exit argument is not
one of two values depending on what happened to the child.

Fixes #978.
2013-11-07 22:10:38 +01:00
Ben Noordhuis
7f44933c43 include: remove uv_strlcat() and uv_strlcpy()
It was pointed out that they don't quite work like their BSD namesakes
and they arguably shouldn't have been part of the API anyway.

Fixes #983.
2013-11-03 03:50:23 +01:00
Fedor Indutny
8a4aa22677 include: UV_FS_EVENT_RECURSIVE is a flag
It should not be the same as:

`UV_FS_EVENT_WATCH_ENTRY | UV_FS_EVENT_STAT`

Because we never meant that, and that's not how it works.
2013-10-31 01:11:06 +04:00
Fedor Indutny
43bef41031 fsevents: report errors to user 2013-10-31 01:06:37 +04:00
Ben Noordhuis
9ab5ee2f39 include: document pipe path truncation behavior
Document the fact that the maximum path length for UNIX domain socket
paths is much less than _POSIX_PATH_MAX.

For most file systems, _POSIX_PATH_MAX is 1024 or 4096 bytes while
`sizeof(sockaddr_un.sun_path)` is typically between 92 and 108 bytes.
2013-10-22 12:12:59 +02:00
Ben Noordhuis
f2ab62ec10 include: add E2BIG status code mapping
Forgotten in commit 3ee4d3f.  Add it now and renumber the other status
codes.  The Windows status code mappings may not be exhaustive.

Fixes #959.
2013-10-20 14:00:29 +02:00
Ben Noordhuis
777019b768 unix: make uv_tty_reset_mode() async signal-safe
Make it possible to call uv_tty_reset_mode() from inside a signal
handler.  The primary motivation is to make it possible to restore
the TTY from inside a SIGINT or SIGTERM signal handler.

Fixes #954.
2013-10-20 13:58:34 +02:00
Saúl Ibarra Corretgé
9d44d786ad unix, windows: add uv_fs_event_start/stop functions
Make uv_fs_event behave like other handles, that is, it's inactive after
init, and it's active between start and stop.
2013-10-12 20:37:05 +02:00
Ben Noordhuis
5c00a0ee33 unix: fix SIGCHLD waitpid() race in process.c
Before this commit, multiple event loops raced with each other when a
SIGCHLD signal was received.  More concretely, it was possible for
event loop A to consume waitpid() events that should have been
delivered to event loop B.

This commit addresses that by doing a linear scan over the list of
child processes.  An O(n) scan is not terribly efficient but the
actual performance impact is not measurable in a benchmark that spawns
rounds of several thousands instances of /bin/false.  For the time
being, this patch will suffice; we can always revisit it later.

Fixes #887.
2013-10-09 11:18:13 +02:00
Ben Noordhuis
38df93cfed unix: revert recent FSEvent changes
This commit reverts the following commits:

    983fa68 darwin: fix 10.6 build error in fsevents.c
    684e212 fsevents: use shared FSEventStream
    ea4cb77 fsevents: FSEvents is most likely not thread-safe
    9bae606 darwin: create fsevents thread on demand

Several people have reported stability issues on OS X 10.8 and bus
errors on the 10.9 developer preview.

See also joyent/node#6296 and joyent/node#6251.
2013-10-05 18:24:33 +02:00
Ben Noordhuis
ce3c38a5d8 include: make uv_process_options_t.cwd const
There is no reason for it to be non-const, libuv treats it as a
read-only input.  Make it a pointer to a const string.
2013-09-10 23:29:35 +02:00
Ben Noordhuis
adcc2273f4 include: update uv_is_active() documentation
Seems to have been overlooked in the reference counting refactor back
in May 2012 in commit 9efa8b3.  Clarify what "active" means for
different kinds of handles.
2013-09-08 23:25:31 +02:00
Ben Noordhuis
b83109c524 include: fix typo in comment in uv.h 2013-09-08 23:25:07 +02:00
Ben Noordhuis
9e4982f5c9 include: remove UV_IO_PRIVATE_FIELDS macro
It's an alias for UV_IO_PRIVATE_PLATFORM_FIELDS.  Remove the macro and
use UV_IO_PRIVATE_PLATFORM_FIELDS directly.
2013-09-08 20:21:24 +02:00
Ben Noordhuis
b7d333fc91 include: clean up includes in uv.h
* size_t is defined in <stddef.h>, not <sys/types.h>

* Simplify the platform check.
2013-09-08 20:14:30 +02:00
Ben Noordhuis
02e8c8ef65 include: clarify uv_tcp_bind() behavior
On BSD-like platforms, EADDRINUSE is returned by the bind() system call.
On other platforms, it's returned by the listen() system call.

In other words, some platforms are 'first to bind wins', others are
'first to listen wins' - but only with TCP sockets: UNIX domain sockets
always return EADDRINUSE from the bind() system call, UDP sockets don't
call listen() in the first place.

Fixes #769.
2013-09-06 15:15:36 +02:00
Ben Noordhuis
08c6ddeefb include: merge uv_udp_send and uv_udp_send6
Merge uv_udp_send6() into uv_udp_send().  uv_udp_send() now takes a
const struct sockaddr*.
2013-09-04 03:17:29 +02:00
Ben Noordhuis
bcee403ed2 include: merge uv_udp_bind and uv_udp_bind6
Merge uv_udp_bind6() into uv_udp_bind().  uv_udp_bind() now takes a
const struct sockaddr*.
2013-09-04 03:17:04 +02:00
Ben Noordhuis
5c675c4a4e include: merge uv_tcp_connect and uv_tcp_connect6
Merge uv_tcp_connect6() into uv_tcp_connect().  uv_tcp_connect() now
takes a const struct sockaddr*.
2013-09-04 03:16:36 +02:00
Ben Noordhuis
5fceccc535 include: merge uv_tcp_bind and uv_tcp_bind6
Merge uv_tcp_bind6() into uv_tcp_bind().  uv_tcp_bind() now takes a
const struct sockaddr*.
2013-09-04 03:15:30 +02:00
Ben Noordhuis
779b8d81e9 include: make uv_write{2} const correct 2013-09-01 08:25:25 +02:00
Ben Noordhuis
8c6ea10502 include: uv_spawn takes const uv_process_options_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:25:00 +02:00
Ben Noordhuis
263da51967 include: uv_udp_send{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:20 +02:00
Ben Noordhuis
525dbb5e31 include: uv_udp_bind{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:18 +02:00
Ben Noordhuis
0f7b2963ad include: uv_udp_recv_cb now takes const uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:17 +02:00
Ben Noordhuis
255671da74 include: uv_tcp_connect{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:15 +02:00
Ben Noordhuis
daa229ace3 include: uv_tcp_bind{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:13 +02:00
Ben Noordhuis
8184076879 include: uv_ip[46]_addr now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:07 +02:00
Ben Noordhuis
b7d027c3a8 include: uv_read{2}_cb now takes const uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:01:34 +02:00
Ben Noordhuis
3fb6612233 include: uv_alloc_cb now takes uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 07:57:31 +02:00
Ben Noordhuis
5d2434bf71 unix, windows: add thread-local storage API
Uses the pthread_key_{create,delete} and pthread_{get,set}specific
functions on UNIX platforms, Tls{Alloc,Free} and Tls{Get,Set}Value
on Windows.

Fixes #904.
2013-08-25 15:51:07 +02:00
Ben Noordhuis
d3308c25b9 include: update uv_udp_open() / uv_udp_bind() docs
Mention that:

* these functions set the SO_REUSEADDR and SO_REUSEPORT socket flags,
* what the effect of those flags is, and
* that we may remove it someday
2013-08-25 22:00:12 +02:00
Bert Belder
66ae0ff562 process: make the 'status' parameter for exit_cb an int64_t
This means we no longer have to strip the high bit from the process exit
code on Windows, which is problematic because an unhandled SEH exception
can make a process exit with a status code that has the high bit set.
2013-08-23 18:35:09 +02:00
Fedor Indutny
684e2124e7 fsevents: use shared FSEventStream
It seems that number of simultaneously opened FSEventStreams is
limited on OSX (i.e. you can have only fixed number of them on
one running system), getting past through this limit will cause
`FSEventStreamCreate` to return false and write following message
to stderr:

    (CarbonCore.framework) FSEventStreamStart: register_with_server:
    ERROR: f2d_register_rpc() => (null) (-21)

To prevent this, we must use only one shared FSEventStream with a
paths for all uv_fsevent_t handles, and then filter out events for
each handle using this paths again.

See https://github.com/joyent/node/issues/5463

Conflicts:
	include/uv-private/uv-darwin.h
	src/unix/fsevents.c
2013-08-22 16:57:54 +04:00
Fedor Indutny
cd2794c01f fsevents: use shared FSEventStream
It seems that number of simultaneously opened FSEventStreams is
limited on OSX (i.e. you can have only fixed number of them on
one running system), getting past through this limit will cause
`FSEventStreamCreate` to return false and write following message
to stderr:

    (CarbonCore.framework) FSEventStreamStart: register_with_server:
    ERROR: f2d_register_rpc() => (null) (-21)

To prevent this, we must use only one shared FSEventStream with a
paths for all uv_fsevent_t handles, and then filter out events for
each handle using this paths again.

See https://github.com/joyent/node/issues/5463
2013-08-22 16:35:13 +04:00
Ben Noordhuis
1510ce81fd unix, windows: allow NULL async callback
Allow a NULL callback so the user doesn't have to provide a dummy when
the actual event is processed by e.g. a check handle callback.
2013-08-12 08:55:51 +02:00
Ben Noordhuis
0e7ba080b4 unix, windows: make buf arg to uv_fs_write const
Change the uv_fs_write() prototype so the 'buf' argument is now
`const void*` rather than `void*`.

The argument is stored in a non-const field in the uv_fs_t but that's
inconsequential because the memory it points to is not touched.
2013-07-29 05:27:45 +02:00
Ben Noordhuis
3d4099ebcb Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	src/version.c
	src/win/fs.c
2013-07-25 20:01:31 +02:00
Brian White
e3a657c662 unix, windows: add MAC to uv_interface_addresses()
Make uv_interface_addresses() return the MAC address as a 48 bits
binary value in the phys_addr field of the uv_interface_address_t
struct.
2013-07-25 13:49:39 +02:00
Ben Noordhuis
1acbd768b0 unix, windows: don't read/recv if buf.len==0
Make it possible for the libuv user to handle out of memory conditions
gracefully. When alloc_cb() returns a buffer with len==0, call the read
or recv callback with nread=UV_ENOBUFS. It's up to the user to stop or
close the handle.

Fixes #752.
2013-07-25 01:32:04 +02:00
Ben Noordhuis
d779eb53d5 unix, windows: fix uv_fs_chown() function prototype
Before this commit, uv_fs_chown() and uv_fs_fchown() took the uid and
gid as signed integers which is wrong because uid_t and gid_t are
unsigned on most all platforms and IDs that don't fit in a signed
integer do exist.

This is not an ABI change because the size of the uid and gid arguments
do not change, only their sign.

On Windows, uv_uid_t and uv_gid_t are typedef'd as unsigned char for
reasons that are unclear. It doesn't matter: they get cast to ints when
used as function arguments. The arguments themselves are unused.

Partial fix for joyent/node#5890.
2013-07-23 13:24:37 +02:00
Ben Noordhuis
3ee4d3f183 unix, windows: return error codes directly
This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like this one:

    if (uv_foo(loop) < 0) {
      uv_err_t err = uv_last_error(loop);
      fprintf(stderr, "%s\n", uv_strerror(err));
    }

Should be rewritten like this:

    int err = uv_foo(loop);
    if (err < 0)
      fprintf(stderr, "%s\n", uv_strerror(err));

The rationale for this change is that it should make creating bindings
for other languages a lot easier: dealing with struct return values is
painful with most FFIs and often downright buggy.
2013-07-07 09:51:00 +02:00
Miroslav Bajtoš
fd45f876ff linux,darwin,win: link-local IPv6 addresses
Modified uv_ip6_addr() to fill sin6_scope_id for link-local addresses.

Fixes #271

Conflicts:
	build.mk
2013-07-04 15:43:20 +02:00
Ben Noordhuis
ddd7e04fd6 build: switch to autotools
Switch to the build tool everyone loves to hate.  The Makefile has
served us well over the years but it's been acquiring more and more
features that autotools gives us for free, like easy static+shared
library building, sane install targets, and so on.

This commit drops MinGW support.  If there is demand for it, we'll
re-add it.
2013-07-02 01:21:16 +02:00
Saúl Ibarra Corretgé
f9e6029b82 unix, windows: add extra fields to uv_stat_t 2013-06-28 00:42:37 +02:00
Henry Rawas
92040eb712 stream: add an API to make streams do blocking writes
This patch adds the `uv_stream_set_blocking` API which makes all
uv_write calls to that stream blocking. It currently only works for
pipes, on windows.
2013-06-20 19:27:39 +02:00
Ben Noordhuis
c16ed503b0 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	src/unix/stream.c
	src/version.c
2013-06-07 11:41:41 +02:00
Linus Mårtensson
3fdd2a1128 uv: support android libuv standalone build
Tested most of my compilation in the previous patch on NodeJS
and extracted the patches from there. This patch ensures libuv
will be capable of building standalone as well, both with gyp
and Makefiles.

Build documentation was added to the README.md file.

Some tests are failing, and I have not heavily investigated
the reasons. The failures are generally on errors, and are
likely related to differences between fully POSIX-compatible
systems and android.
2013-05-31 13:25:17 +02:00
Bert Belder
b9eb402fb0 include: remove lame comment from uv.h 2013-05-30 22:54:44 +02:00
Ben Noordhuis
442d11d618 unix: avoid extra read, short-circuit on POLLHUP
Avoid going through an extra alloc_cb -> read() -> read_cb cycle when
the POLLHUP flag is set because we know the next read() will hit EOF.

Fixes #803.
2013-05-30 22:34:03 +02:00
Ben Noordhuis
dfff2e9e23 include: document uv_update_time() and uv_now() 2013-05-28 23:49:09 +02:00
Linus Mårtensson
fc6a2ad24f unix: support for android builds
Adds targets and fixes to ensure building for android works.

To build on android, refer to the android standalone toolchain.
2013-05-25 21:16:52 +02:00
Ben Noordhuis
8ef9592a95 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	ChangeLog
	src/unix/stream.c
	src/version.c
2013-05-29 23:32:07 +02:00
Ben Noordhuis
c77707984d include: fix typo in comment in uv.h
Fixes #790.
2013-04-24 11:34:55 +02:00
Bert Belder
ffe2ef06eb windows: deal with the fact that GetTickCount might lag
We use GetQueuedCompletionStatus(Ex) to sleep the thread until the next
timer expires (provided that no other events happen before that).
However after waking up from a sleep the GetTickCount() return value may
not immediately reflect that some time has passed. This happens because
gqcs can sometimes sleep for periods shorter than the GetTickCount clock
resulution. This patch changes time tracking so the amount of time
waited by gqcs is taken into account.

This has the following advantages:

* Excessive loop iterations are avoided.
* Small timeouts are fired more precisely.
* The `loop-stop` test that used to be flaky on Windows now passes
  consistently.
2013-04-18 23:39:16 +02:00
Ben Noordhuis
7f8130a21b unix: remove src/unix/cygwin.c
The cygwin build has been broken for a long time now and no one is
complaining, which strongly suggests that no one actually uses it.
Remove it.
2013-04-18 21:53:33 +02:00
Saúl Ibarra Corretgé
a92b66fe33 unix, windows: add uv_has_ref() function 2013-04-17 15:31:08 +02:00
Ben Kelly
14aa6153be unix, win: add netmask to uv_interface_address
Include the netmask when returning information about the OS network
interfaces.

This commit provides implementations for windows and those unix
platforms using getifaddrs().

AIX was not implemented because it requires the use of ioctls and I do
not have an AIX development/test environment.  The windows code was
developed using mingw on winxp as I do not have access to visual studio.

Tested on darwin (ipv4/ipv6) and winxp (ipv4 only).  Needs testing on
newer windows using ipv6 and other unix platforms.
2013-04-10 14:48:23 +02:00
Kristian Evensen
1e8fe45995 include: updated uv_udp_open documentation
On Unix, uv_udp_open can be used with any socket as long as the socket
follows the datagram contract (works in unconnected mode, supports
sendmsg()/recvmsg(), etc.). This means that any datagram-socket, like
for example netlink or raw sockets, can be used with libuv. Added this
information to the documentation.
2013-04-08 16:54:45 +02:00
Ben Noordhuis
78e8034b32 Merge remote-tracking branch 'origin/v0.10' 2013-04-04 03:11:33 +02:00
Ben Noordhuis
ec24bfac19 include: update uv_backend_fd() documentation
uv_run_once() is no more, replace with uv_run(UV_RUN_NOWAIT).

Fixes #759.
2013-03-31 20:02:25 +02:00
Ben Noordhuis
3c3a348abd include: remove UV_VERSION_* macros
Superseded by uv_version() and uv_version_string().
2013-03-29 16:01:14 +01:00
Ben Noordhuis
0635e29714 unix, windows: remove ngx-queue.h
Avoids an extra #include in public headers and stops the ngx_queue_*
types and macros from leaking into user code.
2013-03-27 00:09:36 +01:00
Ben Noordhuis
73524cdd3a Merge remote-tracking branch 'origin/v0.10' 2013-03-26 15:17:00 +01:00
Ben Noordhuis
3f6122b3f7 include: remove extraneous const from uv_version()
Fixes the following warning:

  include/uv.h:236:30: warning: type qualifiers ignored on function
  return type [-Wignored-qualifiers]
   UV_EXTERN const unsigned int uv_version(void);
2013-03-26 14:48:30 +01:00
Bert Belder
c7b1c53ef1 Prepare for making releases, add uv_version/uv_version_string API 2013-03-25 15:35:00 +01:00
Timothy J Fontaine
499c7976c6 unix, windows: nanosecond resolution for uv_fs_[fl]stat
Closes #739.
2013-03-19 21:48:15 +01:00
Ben Noordhuis
ab935a25a5 include: use x macros for uv_any_{handle,req} unions
Generate the members of the uv_any_handle and uv_any_req unions with
the UV_HANDLE_TYPE_MAP and UV_REQ_TYPE_MAP macros. Eases maintenance
when new handle or request types are added.
2013-03-17 20:32:42 +01:00
Ben Noordhuis
9f714a1d25 include: bump UV_VERSION_MINOR
Fixes #740.
2013-03-14 12:49:21 +01:00
Ben Noordhuis
905d56c140 unix: fix uv_tcp_simultaneous_accepts() logic
Inverts the meaning of the 'enable' argument. Before, it actually set
the UV_TCP_SINGLE_ACCEPT flag when enable=1. Now it clears it, which is
what uv-win does and what you would expect it to do.
2013-03-12 12:39:37 +01:00
Bert Belder
4abad2381e win/tty: don't touch insert mode or quick edit mode
Hopefully this fixes joyent/node#4809.
2013-03-05 20:05:58 +01:00
Saúl Ibarra Corretgé
bb3d1e24da unix, windows: add uv_stop, stop running event loop 2013-02-25 16:21:37 +01:00
Ben Noordhuis
92151658eb unix: abstract away async pipe infrastructure
This commit lays the groundwork for the switch to eventfds on Linux.
2013-02-25 02:36:52 +01:00
Ben Noordhuis
30f6288347 unix, windows: make uv_timer_get_repeat() const correct 2013-02-20 17:01:00 +01:00
Ben Noordhuis
0cb9fbfe18 unix, windows: change timer intervals to uint64_t 2013-02-20 16:59:33 +01:00
Ben Noordhuis
d6bfedb862 unix, windows: make uv_now() return uint64_t
Using int64_t doesn't make sense here because the return value is never
negative.
2013-02-20 16:58:45 +01:00
Andrius Bentkus
7480974efe 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.
2013-02-20 16:33:56 +01:00
Ben Noordhuis
da71649991 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.
2013-02-10 17:50:03 +01:00
Shigeki Ohtsu
fadfeaf6ec 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.
2013-02-10 17:46:22 +01:00
Fedor Indutny
c15d4a7c62 stream: use kevent() information before accept()
Limit number of syscalls by using backlog length information provided by
kevent().
2013-02-09 00:54:08 +04:00
Ben Noordhuis
da33bba7c0 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.
2013-02-06 23:28:09 +01:00
Ben Noordhuis
4ba03ddd56 unix, windows: rename uv_run2 to uv_run
This changes the prototype of uv_run() from:

  int uv_run(uv_loop_t* loop);

To:

  int uv_run(uv_loop_t* loop, uv_run_mode mode);

Where `mode` is UV_RUN_DEFAULT, UV_RUN_ONCE or UV_RUN_NOWAIT.

Fixes #683.
2013-01-16 23:35:29 +01:00
Bruce Mitchener
2cecd0d3d1 include: fix typos in comments 2013-01-10 15:12:02 +01:00
Ben Noordhuis
546387fc47 include: add note about SIGRT0 and SIGRT1 on linux 2012-12-28 22:17:51 +01:00
Ben Noordhuis
69ab328d9f sunos: fix !defined(PORT_SOURCE_FILE) build 2012-12-28 12:45:47 +01:00
Ben Noordhuis
3164f1ea69 include: update uv_signal_t doc comments
Fixes #668.
2012-12-25 21:51:19 +01:00
Saúl Ibarra Corretgé
0820be7008 Implemented uv_run2
Allows for running the event loop in 3 modes:
  * default: loop runs until the refcount drops to zero
  * once: poll for events only once and block until one is handled
  * nowait: poll for events only once but don't block if there are
    no pending events
2012-12-18 16:11:23 +01:00
Ben Noordhuis
92fb84b751 unix: rework uv_cancel() api
Bert Belder informs me the current approach where a request is immediately
cancelled, is impossible to implement on Windows.

Rework the API to always invoke the "done" callback with an UV_ECANCELED error
code.
2012-12-13 13:46:38 +01:00
Fedor Indutny
731adacad2 unix: use select() for specific fds on OS X
kqueue(2) on osx doesn't work (emits EINVAL error) with specific fds
(i.e. /dev/tty, /dev/null, etc). When given such descriptors - start
select(2) watcher thread that will emit io events.
2012-12-09 15:43:08 +01:00
Ben Noordhuis
52c8a8617d unix: add uv_cancel() 2012-12-09 15:12:42 +01:00
Ben Noordhuis
4a69c4bb5f unix: change uv_backend_timeout() prototype
* change return value to signed int
* constify loop argument
2012-11-28 17:02:30 +01:00
Fedor Indutny
09a7f85b70 unix: add uv_backend_fd() and uv_backend_timeout()
This can be used in conjuction with uv_run_once() to poll in one thread and run
the event loop's event callbacks in another.

Useful for embedding libuv's event loop in another event loop.
2012-11-28 16:30:50 +01:00
Shane Holloway
5d92ccce94 windows: add flag for hiding windows created by a spawned process
Closes GH-627
2012-11-27 16:48:46 +01:00
Ben Noordhuis
665a316aa9 unix: remove libev 2012-11-16 17:33:29 +01:00
Ben Noordhuis
1282d64868 unix: remove dependency on libev 2012-11-16 17:33:25 +01:00
Stephen Gallagher
05aac92913 include: export uv_inet_* functions 2012-11-15 21:48:41 +01:00
Ben Noordhuis
d56434a21d build: support building a .so
You can now select to build a shared object at configure time:

  $ ./gyp_uv -Dcomponent=shared_library -Dlibrary=shared_library

And build it with:

  $ make -C out BUILDTYPE=Debug # or BUILDTYPE=Release

Or, if you use ninja:

  $ ninja -C out/Debug
2012-11-07 16:55:53 +01:00
Stephen Gallagher
e318b06a0e include: split off libev function prototypes
This patch creates a new header - ev-proto.h - which contains all of the
protoypes for libev functions. This allows us to create a shared object of
libuv without exposing libev internal functions.
2012-11-07 16:55:49 +01:00
Ben Noordhuis
0ddf9d6b98 Revert "unix: use select() for specific fds on OS X"
This reverts commit 5da380a5ca.

Contains a bug that effectively makes the select() thread busy-loop. The file
descriptor is polled for both reading and writing, regardless of what events
the main thread wants to receive. Fixing that requires proper synchronization
between the two threads.

See #614.
2012-11-04 01:23:12 +01:00
Ben Noordhuis
225c6f1719 unix, windows: fix several error messages 2012-11-01 14:49:21 +01:00
Ben Noordhuis
0d5d6504e5 unix, windows: fix EAGAIN error message 2012-11-01 14:03:38 +01:00
Leonard Hecker
97c527ac43 darwin: make it possible to compile for iOS
Relocate the include of TargetConditionals.h and fixe the use of
TARGET_OS_IPHONE. Furthermore, uv__fsevents_init() and uv__fsevents_close are
now empty functions for iOS, since the FSEvents API is not available there.
2012-10-29 23:45:52 +01:00
Ben Noordhuis
5cb4197deb Merge branch 'v0.8' 2012-10-25 04:43:19 +02:00
Ben Noordhuis
f43ad85edd include: fix ngx_queue_foreach() macro
Guard against the possibility that the queue is emptied while we're iterating
over it. Simple test case:

  #include "ngx-queue.h"
  #include <assert.h>

  int main(void) {
    ngx_queue_t h;
    ngx_queue_t v[2];
    ngx_queue_t* q;
    unsigned n = 0;
    ngx_queue_init(&h);
    ngx_queue_insert_tail(&h, v + 0);
    ngx_queue_insert_tail(&h, v + 1);
    ngx_queue_foreach(q, &h) {
      ngx_queue_remove(v + 0);
      ngx_queue_remove(v + 1);
      n++;
    }
    assert(n == 1); // *not* 2
    return 0;
  }

Fixes #605.
2012-10-25 04:36:51 +02:00
Ben Noordhuis
b7f38b1e53 Revert "unix: avoid iterating over all async handles"
This reverts commit 209abbab27.

Fixes the following SIGSEGV:

  (gdb) f 1
  #1  0x00007fc084683aec in uv__async_io (loop=0x7fc0848e0b40,
  handle=0x7fc0848e0c78, events=1) at src/unix/async.c:175
  175             ASYNC_CB(h)
  (gdb) list
  170
  171         /* If we need to sweep all handles anyway - skip this loop */
  172         if (!loop->async_sweep_needed) {
  173           for (i = 0; i < end; i += sizeof(h)) {
  174             h = *((uv_async_t**) (buf + i));
  175             ASYNC_CB(h)
  176           }
  177         }
  178
  179         bytes -= end;
  (gdb) print *h
  $1 = {close_cb = 0x184e1b0, data = 0x18d9520, loop = 0x7fc0848e0b40,
  type = 49, handle_queue = {prev = 0x18dae10, next = 0x7860c0}, flags = 32,
  next_closing = 0x1863b40, pending = 0, async_cb = 0x31,
  queue = {prev = 0x18dae50, next = 0x7860c0}}
  (gdb)

It looks like the async handle gets closed or otherwise becomes invalid before
the sweep is executed.

Fixes #603.
2012-10-24 14:58:49 +02:00
saghul
61ecb3415d win: support compilation with Visual Studio 2008 2012-10-23 22:55:25 +02:00
Fedor Indutny
209abbab27 unix: avoid iterating over all async handles 2012-10-19 17:22:30 +02:00
Bert Belder
1e32cb01b5 unix: support signal handlers outside the main loop 2012-10-17 01:25:02 +02:00
Hiroaki Nakamura
acea3028c5 unix, windows: add thread barrier support 2012-10-09 17:30:52 +02:00
Andrius Bentkus
193432df7d uv.h: move gid and uid to the end of the uv_process_t struct
uv_gid_t and uv_uid_t have different sizes on different platforms.
Moving them to the end of the struct is easier for bindings that use
FFI.
2012-10-09 16:57:02 +02:00
Andrius Bentkus
b2caee7cfb uv.h: move private uv_req_t fields to the bottom of the struct 2012-10-09 16:56:11 +02:00
Ben Noordhuis
7aa1261769 include: fix confusing uv_tcp_keepalive comment 2012-10-05 15:05:40 +02:00
Hiroaki Nakamura
976c8a4387 Add support for condition variables on all platforms 2012-10-05 13:03:55 +02:00
Ben Noordhuis
f793298c9e include: remove uv_fs_poll ABI compat padding 2012-10-01 23:43:32 +02:00
Ben Noordhuis
b60a24a206 unix: remove libeio 2012-10-01 22:53:59 +02:00
Ben Noordhuis
74999f8f99 unix: port fs and work api to new thread pool 2012-10-01 22:53:59 +02:00
Ben Noordhuis
36c91e3ba0 unix: port getaddrinfo to new thread pool 2012-10-01 22:53:59 +02:00
Ben Noordhuis
f35a4b628a unix: add custom thread pool 2012-10-01 22:53:59 +02:00
Ben Noordhuis
1020a1a82e include: make ngx_queue macros sanitary 2012-10-01 22:53:59 +02:00
Ben Noordhuis
17ea46d259 include: remove uv_counters_t, missed in 837edf4 2012-09-28 07:44:36 +02:00
Bert Belder
46bd5fb392 Rearrange struct layouts to make FFI bindings easier
This patch ensures that all struct fields are in this order:
  1. public
  2. readonly
  3. private
2012-09-20 16:07:08 +02:00
Fedor Indutny
778144f0b5 darwin: emit relative path in fsevents 2012-09-18 00:29:29 +02:00
Ben Noordhuis
be2a2176ce unix: rethink relaxed accept() approach
Benchmarks demonstrated that the idle timer handle approach didn't balance the
load quite fair enough, the majority of new connections still ended up in one
or two processes.

The new approach voluntarily gives up a scheduler timeslice by calling
nanosleep() with a one nanosecond timeout.

Why not sched_yield()? Because on Linux (and this is probably true for other
Unices as well), sched_yield() only yields if there are other processes running
on the same CPU.

nanosleep() on the other hand always forces the process to sleep, which gives
other processes a chance to accept our pending connections.
2012-09-18 00:16:43 +02:00
Saúl Ibarra Corretgé
cc1c1912ca unix, windows: add uv_tcp_open and uv_udp_open 2012-09-17 18:09:51 +02:00
Saúl Ibarra Corretgé
c8514b0382 unix, windows: return error if uv_pipe_open fails 2012-09-17 18:09:51 +02:00
Bert Belder
5a2988fc33 windows: remove unnecessary pointer alignment code 2012-09-14 01:48:41 +02:00
Andrew Paprocki
900ad30b43 aix: add initial platform support for aix using gcc/gxlc
Adds initial libuv build/platform support for AIX. Builds work using gcc or the
IBM XL C compiler using its gxlc wrapper. Platform support is added for
uv_hrtime, uv_exepath, uv_get_free_memory, uv_get_total_memory, uv_loadavg,
uv_uptime, uv_cpu_info, uv_interface_addresses.
2012-09-14 01:23:28 +02:00
Prancesco Pertugio
1f9bd99531 Add uv_thread_self. 2012-09-13 16:08:07 +02:00
Fedor Indutny
f8e7513a06 darwin: use FSEvents to watch directory changes 2012-09-12 23:38:57 +02:00
Ben Noordhuis
4f5c8da191 unix: reimplement accept() EMFILE trick
Implement a best effort approach to mitigating accept() EMFILE errors.

We have a spare file descriptor stashed away that we close to get below
the EMFILE limit. Next, we accept all pending connections and close them
immediately to signal the clients that we're overloaded - and we are, but
we still keep on trucking.

There is one caveat: it's not reliable in a multi-threaded environment.
The file descriptor limit is per process. Our party trick fails if another
thread opens a file or creates a socket in the time window between us
calling close() and accept().

Fixes #315.
2012-09-10 22:12:30 +02:00
Ben Noordhuis
a75e10504f freebsd: fix build breakage introduced in 3b69c0f 2012-08-29 22:27:27 +02:00
Ben Noordhuis
a3c6a485c6 Merge branch 'v0.8'
Conflicts:
	include/uv.h
2012-08-25 22:33:17 +02:00
Bert Belder
d62b1ac382 windows: fix the MinGW build 2012-08-23 23:50:03 +02:00
Ben Noordhuis
0ac2fdc554 unix: map errno ESPIPE 2012-08-23 00:32:56 +02:00
Bert Belder
564e7c765c windows: emit SIGWINCH when the console size changes 2012-08-22 00:43:55 +02:00
Fedor Indutny
5da380a5ca unix: use select() for specific fds on OS X
kqueue(2) on osx doesn't work (emits EINVAL error) with specific fds
(i.e. /dev/tty, /dev/null, etc). When given such descriptors - start
select(2) watcher thread that will emit io events.
2012-08-20 23:35:13 +02:00
Ben Noordhuis
28ff1422e8 Merge branch 'v0.8'
Conflicts:
	src/fs-poll.c
2012-08-20 18:11:43 +02:00
Ben Noordhuis
012cbda719 unix, windows: fix memory corruption in fs-poll.c
uv_fs_poll_t has an embedded uv_timer_t handle that got closed at a time when
the memory of the encapsulating handle might already have been deallocated.

Solve that by moving the poller's state into a structure that is allocated on
the heap and can be freed independently.
2012-08-20 17:13:27 +02:00
Bert Belder
201b8f935f Merge branch 'v0.8' 2012-08-18 03:57:41 +02:00
Bert Belder
9f0e00c7b3 unix: fix the build
uv_signal_t.signum was moved to uv.h in an earlier commit.
2012-08-17 19:41:14 +02:00
Bert Belder
c4dbb60cff windows: basic signal handling support with uv_signal_t
This still needs tests.
2012-08-17 19:38:29 +02:00
Bert Belder
95a742be02 Revert "windows: readable tty handles need access to console output"
This is not the way to go.
This reverts commit 1b929bfff5.
2012-08-17 19:38:28 +02:00
Ben Noordhuis
3b69c0f56d unix: split up uv-unix.h 2012-08-17 16:42:31 +02:00
Ben Noordhuis
a7f7696a8d unix: remove UV_REQ_BUFSML_SIZE 2012-08-17 15:19:40 +02:00
Bert Belder
1b929bfff5 windows: readable tty handles need access to console output
Readable tty handles need to be able to update the virtual window,
so if uv_tty_t is initialized with a console input fd, additionally
open the console output.
2012-08-17 00:10:18 +02:00
Bert Belder
88634c1405 windows: separate uv_tty_t read state from write state 2012-08-17 00:10:15 +02:00
Bert Belder
7cf1b67594 windows: small style fix in uv-win.h 2012-08-16 23:11:26 +02:00
Ben Noordhuis
90a75b0d84 include: update uv_timer doc comments 2012-08-15 23:08:31 +02:00
Bert Belder
938a30589c windows: tweak formatting inside uv-win.h 2012-08-15 03:13:58 +02:00
Bert Belder
4442ddcaae windows: fix formatting issue in uv-win.h 2012-08-14 00:19:19 +02:00
Bert Belder
7c3ba514e7 windows: use WCHAR consistently 2012-08-13 22:31:48 +02:00
Bert Belder
aa69f34d53 windows: report spawn errors to the exit callback
Formerly spawn errors would be reported as a message printed to the
process' stderr, to match unix behaviour. Unix has now been fixed to
be more sensible, so this hack can now be removed.

This also fixes a race condition that could occur when the user closes
a process handle before the exit callback has been made.
2012-08-13 22:31:47 +02:00
Fedor Indutny
23dc564f3b darwin: emulate fdatasync() with fcntl(F_FULLFSYNC)
OS X has no public API for fdatasync. And as pointed out in `man fsync(2)`:

  For applications that require tighter guarantees about the integrity of
  their data, Mac OS X provides the F_FULLFSYNC fcntl. The F_FULLFSYNC
  fcntl asks the drive to flush all buffered data to permanent storage.
  Applications, such as databases, that require a strict ordering of writes
  should use F_FULLFSYNC to ensure that their data is written in the order
  they expect.  Please see fcntl(2) for more detail.
2012-08-11 23:43:51 +02:00
Ben Noordhuis
837edf4c0f unix, windows: remove handle init counters
Remove the handle init counters, no one uses them.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
caa79af2ad unix: rework uv_eio_init() init once logic
Don't use counters.eio_init to track if libeio has been initialized, it's going
to be removed in a follow-up commit.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
75ba681913 unix: remove dependency on ev_child 2012-08-10 02:00:11 +02:00
Ben Noordhuis
ee50db6e36 unix, windows: preliminary signal handler support
* a no-op on Windows for now
* only supports the main loop on UNIX (again, for now)
2012-08-10 02:00:07 +02:00
Trond Norbye
5143d54ad3 Allow inclusion of <uv.h> with Sun Studio compiler
The Sun Studio compiler did not define any of the symbols used to determine if
the system was a unix-like system or not causing it to include the windows
header.
2012-08-09 01:09:14 +02:00
Trond Norbye
cbb930024f Allow headers to be included with -Werror and -Wundef
Users of the library may enforce a stricter set of compiler warnings causing
their builds to fail due to warnings emitted from the headers.
2012-08-09 01:09:09 +02:00
Ben Noordhuis
13467a40d4 unix: retrieve execve() errors in process.c
Make the forked child process send the errno to its parent process when it
fails to spawn a new process.
2012-08-08 23:19:50 +02:00
Ben Noordhuis
21f2c1629a include: fix macro formatting 2012-08-08 02:18:59 +02:00
Ben Noordhuis
f372024342 include: link to Nikhil Marathe's libuv ebook 2012-08-07 22:01:24 +02:00
Bert Belder
41b1265af8 Rip out c-ares 2012-08-07 01:04:26 +02:00
Bert Belder
a069956996 Remove c-ares integrations 2012-08-07 01:03:52 +02:00
Bert Belder
32f93e14cb Add libuv-ified versions of inet_pton and inet_ntop 2012-08-07 01:03:47 +02:00
Bert Belder
32da23988b Merge branch 'v0.8'
Conflicts:
	src/unix/sunos.c
2012-08-05 23:51:04 +02:00
Ben Noordhuis
9f7cdb20aa unix: add relaxed accept() setting
Mitigates unfair scheduling in multi-process setups that share a single listen
socket across multiple processes.
2012-08-02 15:58:55 +02:00
Ben Noordhuis
4168855da5 include: move ssize_t workaround to uv-win.h 2012-07-31 00:05:03 +02:00
Bert Belder
514265ec6e windows: fix memory leaks in fs
Also clean up the code in various ways.
2012-07-31 00:04:48 +02:00
Ben Noordhuis
4eccb2ee52 include: move ssize_t workaround to uv-win.h 2012-07-30 14:26:50 +02:00
Ben Noordhuis
be1032431d Merge branch 'v0.8' 2012-07-29 03:13:21 +02:00
Ben Noordhuis
4fe1916926 linux: fix 'two watchers, one path' segfault
Problem: registering two uv_fs_event_t watchers for the same path, then closing
them, caused a segmentation fault. While active, the watchers didn't work right
either, only one would receive events.

Cause: each watcher has a wd (watch descriptor) that's used as its key in a
binary tree. When you call inotify_watch_add() twice with the same path, the
second call doesn't return a new wd - it returns the existing one. That in turn
resulted in the first handle getting ousted from the binary tree, leaving
dangling pointers.

This commit addresses that by storing the watchers in a queue and storing the
queue in the binary tree instead of storing the watchers directly in the tree.

Fixes joyent/node#3789.
2012-07-28 16:31:47 +02:00
Ben Noordhuis
912348261e include: update confusing uv_write comment 2012-07-27 16:04:13 +02:00
Ben Noordhuis
cf05c5f0d6 Raise UV_ECANCELED on premature close.
Set the error code to the more appropriate UV_ECANCELED instead of UV_EINTR
when the handle is closed and there are in-flight requests.
2012-07-27 15:13:29 +02:00
Ben Noordhuis
9f59e8e38c include: update uv_close documentation 2012-07-27 14:44:06 +02:00
Fedor Indutny
3726dee5e9 unix: thread: use mach semaphores on osx 2012-07-10 14:14:50 +02:00
Ben Noordhuis
15cfcfd309 c-ares: libuv-ify c-ares 2012-06-29 05:29:13 +02:00
Saúl Ibarra Corretgé
3e425ab9ba c-ares: upgrade to 1.9.0 2012-06-29 05:29:04 +02:00
Ben Noordhuis
b779a0db74 Merge branch 'v0.8' 2012-06-29 02:28:57 +02:00
Roman Neuhauser
5a0f3411fc unix: map ENODEV to UV_ENODEV
produces better error message from test-dgram-multicast-multi-process
when run w/o network.

before:

=== release test-dgram-multicast-multi-process ===
Path: simple/test-dgram-multicast-multi-process
dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
Error: addMembership Unknown system errno 19
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 9223 died. 1 dead of 3

dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
Error: addMembership Unknown system errno 19
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

[PARENT] sent 'First message to send' to 224.0.0.114:12346
dgram.js:287
[PARENT] sent 'Second message to send' to 224.0.0.114:12346
    throw new errnoException(errno, 'addMembership');
[PARENT] sent 'Third message to send' to 224.0.0.114:12346
          ^
[PARENT] sendSocket closed
[PARENT] Worker 9224 died. 2 dead of 3
Error: addMembership Unknown system errno 19
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 9225 died. 3 dead of 3
[PARENT] All workers have died.
[PARENT] Fail
Command: out/Release/node /home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js

after:

=== release test-dgram-multicast-multi-process ===
Path: simple/test-dgram-multicast-multi-process
dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
Error: addMembership ENODEV
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 13141 died. 1 dead of 3

dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
[PARENT] sent 'First message to send' to 224.0.0.114:12346
[PARENT] sent 'Second message to send' to 224.0.0.114:12346
[PARENT] sent 'Third message to send' to 224.0.0.114:12346
[PARENT] sent 'Fourth message to send' to 224.0.0.114:12346
[PARENT] sendSocket closed

dgram.js:287
    throw new errnoException(errno, 'addMembership');
          ^
Error: addMembership ENODEV
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 13142 died. 2 dead of 3
Error: addMembership ENODEV
    at new errnoException (dgram.js:356:11)
    at Socket.addMembership (dgram.js:287:11)
    at Object.<anonymous> (/home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js:224:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:487:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
[PARENT] Worker 13143 died. 3 dead of 3
[PARENT] All workers have died.
[PARENT] Fail
Command: out/Release/node /home/roman/wc/node/test/simple/test-dgram-multicast-multi-process.js
2012-06-26 17:33:29 +02:00
Shigeki Ohtsu
c6f2ef25c6 uv.h: add members to any-union of handle and req 2012-06-26 16:24:20 +02:00
Ben Noordhuis
0005b52b70 Update uv_getaddrinfo_cb prototype.
Make it clear that the first argument is a req, not a handle.
2012-06-25 01:26:08 +02:00
Ben Noordhuis
61f04877a7 Update uv_getaddrinfo() documentation. 2012-06-23 04:09:22 +02:00
Bert Belder
d831e52e45 uv: now working on v0.9 2012-06-22 20:44:08 +02:00
Ben Noordhuis
120a4af3eb sunos: remove unused field event_watcher 2012-06-22 15:19:12 +00:00
Ben Noordhuis
c222f075c3 sunos: replace ev_io with uv__io_t 2012-06-22 15:09:56 +00:00
Ben Noordhuis
f01e9d708a unix: clarify that uv_getaddrinfo_t is a req 2012-06-22 16:40:45 +02:00
Ben Noordhuis
171e2f71b9 Update libuv version macro. 2012-06-22 15:43:14 +02:00
Ben Noordhuis
14ffaa668d unix, windows: stat: never pass NULL to cb
Never pass NULL to the fs_poll callback, use a zeroed out statbuf instead.

Makes the interface a little more convenient to use.
2012-06-20 17:56:37 +02:00
Bert Belder
b496c1221c windows: reserve some room for zero-read minibuffer 2012-06-19 21:11:17 +02:00
Ben Noordhuis
6d67cf1952 unix, windows: update uv_fs_poll API
* the callback gets called only once on error, not repeatedly...

* ...unless the error reason changes from e.g. UV_ENOENT to UV_EACCES

* the callback receives pointers to uv_statbuf_t objects so it can inspect what
  changed
2012-06-16 04:54:25 +02:00
Ben Noordhuis
cc7c8542a5 unix, windows: add stat() based file watcher
Monitors a file path for changes. Supersedes ev_stat.
2012-05-31 20:32:24 +02:00
Bert Belder
ade6930241 windows: implement uv_disable_stdio_inheritance 2012-06-14 01:19:52 +02:00
Bert Belder
07c6ac2b55 windows: move child stdio buffer ops to a separate file 2012-06-13 19:17:13 +02:00
Ben Noordhuis
78bc0d6134 unix: implement async handles in libuv
Replace libev backed async handles with a pure libuv implementation.
2012-06-11 04:19:31 +02:00
Ben Noordhuis
053d3afcbf Make ngx_queue_foreach() impl more explicit. 2012-06-07 17:00:33 +02:00
Ben Noordhuis
649ad50c32 unix: fix event loop stall
Undoes most of the changes made to libev in 7d2ea31 and c9396dd.
2012-06-06 05:12:28 +02:00
Bert Belder
64f8cf463d windows, unix: uv_buf_init should take unsigned int for the buffer length 2012-06-04 18:04:49 +02:00