Commit Graph

29 Commits

Author SHA1 Message Date
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
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
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
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
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
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
779b8d81e9 include: make uv_write{2} const correct 2013-09-01 08:25:25 +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
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
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
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
Ryan Dahl
b47c474cfd Move private headers into include/uv-private 2011-08-31 00:43:55 -07:00
Ryan Dahl
56dcaf9b06 unix: multiplicity 2011-08-31 04:18:55 +02:00
Ryan Dahl
1a4ead53d6 unix: implement uv_queue_work 2011-08-29 22:57:34 -07:00
Ryan Dahl
0e81406bfb unix fs_async_dir works 2011-08-29 22:08:51 -07:00
Ryan Dahl
3be275bad7 Begin implementation of UNIX uv_fs_ functions
Adding this incomplete work now to ease rebase troubles later as it moves
the functions to src/unix/fs.c and introduces src/unix/internal.h.
2011-08-29 14:36:45 -07:00
Ryan Dahl
7cad73aa47 Fix build for UNIX 2011-08-26 11:26:24 -07:00
Igor Zinkovsky
25175c7071 uv_fs & uv_work APIs 2011-08-26 11:00:53 -07:00
Ben Noordhuis
36ce74f2ca Add UDP support to libuv. 2011-08-24 04:55:01 +02:00
Ryan Dahl
b2ed24d86e unix: Remove flock code
solaris doesn't have flock
2011-08-02 07:08:13 +00:00
Ben Noordhuis
8e8af8fd34 uv-unix: use lock file to detect stale UNIX sockets 2011-07-29 03:59:55 +02:00
Ryan Dahl
92bc7b4959 Start uv_spawn()
Unix only at the moment. Lacks test for stdio
2011-07-25 16:19:27 -04:00
Ben Noordhuis
4eff34da43 uv-unix: pipes API implementation
Based on UNIX sockets to avoid the vagaries of FIFOs
in asynchronous mode. Currently unlinks stale sockets
before binding and cleans them up again after shutdown.
2011-07-19 00:58:02 +02:00
Bert Belder
c1bddb9677 Stop g++ from complaining about anonymous struct usage 2011-07-16 00:33:31 +02:00
Ryan Dahl
abe0b1ea61 Better request API
Instead of uv_shutdown, uv_write, uv_connect taking raw uv_req_t we subclass
uv_req_t into uv_shutdown_t, uv_write_t, and uv_connect_t.

uv_req_init is removed.
2011-07-14 10:45:28 -07:00
Igor Zinkovsky
b6a6dae34f Named pipes implementation for Windows 2011-07-09 21:41:04 +02:00
Ryan Dahl
ce8ff3031c src/ and include/ directories
Helps #71 but does not update the MSVC files.
2011-07-07 07:52:57 -07:00