Commit Graph

736 Commits

Author SHA1 Message Date
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
Ben Noordhuis
c76c2066c6 unix, windows: add semaphore functions 2012-06-03 04:04:05 +02:00
Bert Belder
3ec9c67f93 windows: improve spawn stdio support
* Make using an existing stream for stdio actually work
* Support up to 256 stdio channels
* Fix some minor bugs
2012-06-01 17:47:20 +02:00
Fedor Indutny
f5b5127db0 change spawn() api to allow using existing streams for stdio
This commit also adds support for this api on Unix.
2012-06-01 17:32:27 +02:00
Charlie McConnell
69a923bf93 process: implement UV_PROCESS_DETACHED flag for uv_spawn 2012-06-01 02:24:05 +02:00
Ben Noordhuis
c9396dd57e unix: implement timers in libuv
* replace libev backed timers with a pure libuv implementation
* gut ev_run() and make it take a timeout instead of flags

Incidentally speeds up the loop_count_timed benchmark by about 100%.
2012-05-31 03:08:34 +02:00
Ben Noordhuis
171ad8567d unix, windows: add uv_walk()
Lets the libuv user iterate over the open handles. Mostly intended as a
debugging tool or a post-hoc cleanup mechanism.
2012-05-30 02:33:39 +02:00
Ben Noordhuis
58a272e556 unix: rework pending handle/req logic 2012-05-30 00:08:22 +02:00
Igor Zinkovsky
5a34f19970 windows: allow specifying FDs to be inherited by a child process
Previously the only option was to create a pipe or an ipc channel. This
patch makes it possible to inherit a handle that is already open in the
parent process. There is also room for setting more than just stdin,
stdout and stderr, although this is not supported yet.
2012-05-28 23:59:58 +02:00
Bert Belder
e4f23aacec Get rid of UV_LEAN_AND_MEAN 2012-05-28 01:53:22 +02:00
Ben Noordhuis
793a52f5df unix: pack uv structs more
Try to avoid alignment holes on x86_64. Shaves off 4-8 bytes from most structs.
2012-05-24 16:04:01 +02:00
Ben Noordhuis
890d443558 unix: shave about 100 bytes off uv_udp_send_t 2012-05-23 23:21:08 +02:00
Ben Noordhuis
e71495c84a unix: turn field stream->blocking into a flag
Saves 4 bytes.
2012-05-23 22:48:57 +02:00
Ben Noordhuis
7c8313bd0f unix, windows: make uv_run_once() return a bool
The return value of uv_run_once() now signals if it needs to be called again.

Fixes #427.
2012-05-23 20:49:03 +02:00
Ben Noordhuis
5b9c45120a unix: fold uv__io_cb into ev_io struct
Makes the uv__io code a little more obscure but has the advantage that
sizeof(uv__io_t) == sizeof(ev_io), i.e. the sizes of embedding handles
don't change.
2012-05-23 03:57:08 +02:00
Ben Noordhuis
3bc9707054 unix: replace ev_io with uv__io_t
Replace ev_io usage with wrapper constructs.

This is preliminary work for the transition to a libev-less linux backend.
2012-05-23 03:42:32 +02:00
Bert Belder
d1665792ca Get rid of UV_HANDLE_TYPE_PRIVATE 2012-05-22 16:11:24 +02:00
Bert Belder
58ba2d86e1 Move shared c-ares glue code from uv-common to cares.c 2012-05-22 16:11:23 +02:00
Bert Belder
c06edd4c88 windows, unix: share c-ares glue code 2012-05-22 16:11:22 +02:00
Ben Noordhuis
80b554129b unix: reactive new idle watcher implementation
The new idle watcher was temporarily disabled in 073a48d due to some semantic
incompatibilities with the previous implementation. This commit resolves those
issues and reactivates the new implementation.

One outstanding bug is that idle watchers can run in a different order
(relative to other handle types) than the old implementation, e.g. (timer, idle)
instead of the expected (idle, timer). This will be fixed in an upcoming commit.
2012-05-22 15:13:52 +02:00
Frank Denis
d27a62deff unix: fix build on dragonfly bsd
Unbreak compilation on Dragonfly BSD, that uses kqueue, too.
2012-05-21 15:44:20 +02:00
Ben Noordhuis
073a48d6bf unix: back out new idle watcher for now
Its semantics don't quite match what node.js expects. This breaks the
stdio_over_pipes and shutdown_close_pipe tests but that can't be helped.
2012-05-18 01:19:56 +02:00
Igor Zinkovsky
60af28abab windows: support junctions with uv_fs_synlink
based on @piscisaureus implementation
2012-05-17 09:53:26 -07:00
Ben Noordhuis
9efa8b3571 unix, windows: rework reference counting scheme
This commit changes how the event loop determines if it needs to stay alive.

Previously, an internal counter was increased whenever a handle got created
and decreased again when the handle was closed.

While conceptually simple, it turned out hard to work with: you often want
to keep the event loop alive only if the handle is actually doing something.
Stopped or inactive handles were a frequent source of hanging event loops.

That's why this commit changes the reference counting scheme to a model where
a handle only references the event loop when it's active. 'Active' means
different things for different handle types, e.g.:

 * timers: ticking
 * sockets: reading, writing or listening
 * processes: always active (for now, subject to change)
 * idle, check, prepare: only active when started

This commit also changes how the uv_ref() and uv_unref() functions work: they
now operate on the level of individual handles, not the whole event loop.

The Windows implementation was done by Bert Belder.
2012-05-17 07:07:53 +02:00
Andrius Bentkus
985b961d4e Put POLL into the handle_map, so handle_size returns the size of it correctly. 2012-05-05 17:31:16 +02:00
Ben Noordhuis
b5f9bc861f sunos: make fs.watch scale better
Instead of using one port per watch, use one port for all the watches.
This is a cherry-pick of commit 7326962 from v0.6 into master.

Conflicts:

	include/uv-private/uv-unix.h
	src/unix/core.c
	src/unix/sunos.c
2012-05-05 00:51:32 +00:00
Ben Noordhuis
5d19aa84f0 unix, win: rework uv_dlopen() API 2012-05-03 19:36:40 +02:00
Bert Belder
b9504f7987 Rename uv_platform_socket_t to uv_os_sock_t 2012-05-03 16:05:05 +02:00
Bert Belder
d60d94e0c3 Unix: implement uv_poll 2012-05-03 15:52:56 +02:00
Bert Belder
d7a71761c4 Windows: implement uv_poll 2012-05-03 15:52:52 +02:00
Bert Belder
e1154d70ce Api for polling external sockets 2012-05-03 15:51:37 +02:00
Bert Belder
19aca7a7c0 Windows: add uv_msafd_poll, to support overlapped socket polling 2012-05-02 03:45:00 +02:00
Bert Belder
99a995a6b8 uv_spawn: support setting the child process' user and group id 2012-04-28 02:38:41 +02:00
Bert Belder
1b6329dd3e Style fixes 2012-04-25 00:30:07 +02:00
Bert Belder
5342bac4c2 uv.h: make the ssize_t fallback more portable 2012-04-25 00:30:06 +02:00
Ben Noordhuis
feafcdbf5f include: remove stray backslash 2012-04-18 23:08:33 +02:00
Igor Zinkovsky
d5acfd0c05 64bit offsets for fs operations and cleanup uv_fs_* for uv-win 2012-04-18 11:05:27 -07:00
Ben Noordhuis
132fe600c7 const-ify stream argument to uv_is_readable() and uv_is_writable() 2012-04-18 03:15:53 +02:00
Ben Noordhuis
edb39b2499 const-ify handle argument to uv_is_closing() 2012-04-18 03:11:25 +02:00
Ben Noordhuis
fb6c9eef2a const-ify handle argument to uv_is_active() 2012-04-18 03:09:53 +02:00
Maciej Małecki
58733d18a6 unix: map EROFS to UV_EROFS 2012-04-16 16:33:35 +02:00
Bert Belder
6ec330a6c3 Add UV_EIO error code 2012-04-12 03:17:04 +02:00
Ben Noordhuis
3c415975d9 unix: don't conditionally compile kqueue fs watcher
Always compile in the kqueue-based fs event watcher and handle it at run-time
if the kernel doesn't actually support it.

Works around build issues when -mmacosx-version-min is not set properly.

Fixes joyent/node#3075.
2012-04-10 23:22:32 +02:00
Bulat Shakirzyanov
f09f7bc6a8 Add functions to look up req and handle sizes
Useful for FFI bindings. Closes #370.
2012-04-05 01:39:40 +02:00
Bert Belder
5f38ba1a89 Move private req and handle fields to platform headers
And fix other problems introduced with UV_HANDLE_TYPE_MAP and UV_REQ_TYPE_MAP.
2012-04-05 01:28:24 +02:00
Ben Noordhuis
ed395e0619 unix: replace handle->next_watcher
Remove the next_watcher and replace it with a linked list. Said list is named
endgame_handles (because the uv-win calls it that) and contains all the handles
that are in the UV_CLOSING state.

The goal of this commit is two-fold:

a) remove a dependency on libev, and
b) share more code with uv-win in the future

A nice side effect is that it shaves a few bytes off a uv_handle_t.
2012-04-04 05:22:20 -07:00
Ben Noordhuis
bf9a2b3463 x-macro-ify uv_handle_type and uv_req_type 2012-04-04 09:05:13 +02:00
Ben Noordhuis
effa3b65b1 Rename __unused to UV__UNUSED.
__unused is - contrary to its name - used in glibc.

The ANSI/ISO standards reserve all identifiers starting with two underscores so
it's generally a good idea not to use those.
2012-04-03 17:41:50 +02:00
Ben Noordhuis
8895c9e672 unix: use uv_timer_t for c-ares' timeout timer 2012-04-03 03:23:57 +02:00
Ben Noordhuis
42095c85a0 Remove UV_ARES_TASK_PRIVATE_FIELDS.
It's only used internally, it doesn't have to be part of a public header file.
2012-04-03 02:44:50 +02:00
Vladimir Dronnikov
b309f2e2e6 Add uv_is_closing()
Closes #367.
2012-04-01 21:05:50 +02:00
Ben Noordhuis
1ab8f5a3c5 Conditionally define __unused.
Fixes compiler warning '"__unused" redefined' on OS X.

Reported by Saúl Ibarra Corretgé.
2012-03-30 22:40:53 +02:00
Igor Zinkovsky
ab8c3b85c1 export uv_is_readable & uv_is_writable 2012-03-29 18:38:33 -07:00
Igor Zinkovsky
c3daa44c25 windows: explicitly disallow sending non-listening or non-connected
TCP sockets over IPC
2012-03-29 18:19:01 -07:00
Igor Zinkovsky
70925c3bb9 windows: Enable passing of TCP connections over IPC 2012-03-29 18:18:46 -07:00
Ben Noordhuis
ef47a627ad unix: move libeio specific fields to uv-unix.h 2012-03-21 02:11:18 +01:00
Ben Noordhuis
681aa831fa Mark rbtree functions with __attribute__((unused)). 2012-03-16 02:35:05 +01:00
Bert Belder
aff94a069c Add UV_ENOSPC and mappings to it
Closes GH-337
2012-03-16 02:31:12 +01:00
Ben Noordhuis
dfda5009c2 unix, win: store ares handles in a binary tree
Store the uv_ares_task_t handles in a red-black tree, not a linked list.

Fixes #72.
2012-03-16 00:49:29 +01:00
Ben Noordhuis
7a2bd05493 Fix include guard in tree.h and ngx-queue.h
The C99 standard reserves all identifiers (including macros) that start with an
underscore and a capital letter.

Fixes #260.
2012-03-15 02:23:22 +01:00
Bert Belder
2ef5798c6f Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	src/unix/core.c
2012-03-08 03:22:10 +01:00
Bert Belder
1ac71a31e9 Map EBUSY and ENOTEMPTY errors 2012-03-07 21:26:37 +01:00
Nathan Rajlich
5505f2e906 Fix typo in uv.h 2012-03-05 17:32:26 +01:00
Shigeki Ohtsu
b55801f225 win, unix: add uv_dlerror() and uv_dlerror_free() 2012-03-02 16:39:21 +01:00
Ben Noordhuis
ec0eff955e Revert b3e0ad4, 149d32c, e99fdf0 and ea9baef.
Detaching doesn't work yet, the setsid() call fails and leaves the child process
attached to the parent's session.

Revert "test: Add test case for spawning detached child processes."
Revert "win: Implement options.detached for uv_spawn() for Windows."
Revert "unix: Implement options.detached for uv_spawn() for unix."
Revert "Add "detached" member to uv_process_options_t to denote whether a child
        process should spawn detached from its parent."

This reverts commit ea9baef95c.
This reverts commit e99fdf0df6.
This reverts commit 149d32cb96.
This reverts commit b3e0ad4db8.
2012-02-28 15:29:05 +01:00
Charlie McConnell
b3e0ad4db8 Add "detached" member to uv_process_options_t to denote whether a child process should spawn detached from its parent. 2012-02-24 15:15:00 +01:00
Ben Noordhuis
d3efefb043 linux: share inotify fd across event loop
Previously, a new inotify fd was created for each watcher, making it quite easy
to run into the system-wide fs.inotify.max_user_instances limit (usually 128).

Fixes #300.
2012-02-23 09:21:30 -08:00
Bert Belder
1d942e2ad4 Merge branch 'v0.6' 2012-02-13 20:02:39 +01:00
Bert Belder
6c80bf34d3 Clean up error handling in win/fs.c, add some error mappings 2012-02-13 20:01:19 +01:00
Ben Noordhuis
4e1f2b1f64 Merge remote-tracking branch 'origin/v0.6' 2012-02-12 16:10:05 +01:00
Ben Noordhuis
c5aa86bd39 Remove uv_import() and uv_export().
Not needed anymore now that support for isolates has been removed from Node.

This commit reverts the following commits:

  812e410 test: fix up stream import/export test
  e34dc13 unix: implement uv_import() and uv_export()
  d1a0e8e test: fix undefined macro error
  2ce0058 import/export streams accross loops
2012-02-12 15:49:54 +01:00
Igor Zinkovsky
f9be43a564 support half-duplex pipes 2012-02-09 13:33:15 -08:00
Ben Noordhuis
62206c2db0 Clarify API doc comments in uv.h 2012-02-09 22:12:32 +01:00
Nathan Rajlich
dbc046cb7f Add EXDEV to the errno map. 2012-02-06 21:32:16 +01:00
Ben Noordhuis
e53302fcea Explicitly export libuv symbols if gcc >= 4.
Only export symbols that are part of the libuv API, hide everything else.

Prevents symbol clashes in applications and libraries that depend on libuv and
speeds up link times to boot.
2012-02-06 17:05:47 +01:00
Maciej Małecki
3ff3626e52 unix: map ELOOP to UV_ELOOP 2012-02-03 22:20:14 +01:00
isaacs
243cfcd078 Merge remote-tracking branch 'ry/v0.6' 2012-01-31 18:00:59 -08:00
Brandon Philips
4cfda74de4 uv.h: add EPERM to errno map to fix regression
EPERM isn't mapped in so chown returns an unknown error. This is a
regression from 0.4.12.

philips:node/ (master*) $ cat chown.js
var fs = require('fs')
fs.chown("/tmp/foobar", 100, 100, function(er){ console.log(er);})

philips:node/ (master*) $ ls -la /tmp/foobar
total 0
drwxr-xr-x   2 root  wheel   68 Jan 24 17:21 .

0.4
---

philips:node/ (master*) $ /usr/local/Cellar/node/0.4.12/bin/node chown.js
{ stack: [Getter/Setter],
  arguments: undefined,
  type: undefined,
  message: 'EPERM, Operation not permitted \'/tmp/foobar\'',
  errno: 1,
  code: 'EPERM',
  path: '/tmp/foobar' }

master
------

philips:node/ (master*) $ ./node chown.js
{ [Error: UNKNOWN, unknown error '/tmp/foobar'] errno: -1, code: 'UNKNOWN', path: '/tmp/foobar' }

AFTER
-----

philips:node/ (master*) $ ./node chown.js
{ [Error: EPERM, operation not permitted '/tmp/foobar'] errno: 49, code: 'EPERM', path: '/tmp/foobar' }
2012-01-31 16:37:26 -08:00
Ben Noordhuis
e34dc13496 unix: implement uv_import() and uv_export() 2012-01-30 21:44:47 +01:00
Igor Zinkovsky
2ce0058251 import/export streams accross loops 2012-01-30 21:44:27 +01:00
Ben Noordhuis
3de0411591 Merge remote-tracking branch 'origin/v0.6' 2012-01-27 22:23:26 +01:00
Ben Noordhuis
b88bc43543 unix: implement uv_udp_set_multicast_loop() 2012-01-24 00:07:22 +01:00
Ben Noordhuis
e710fdb518 unix: implement uv_udp_set_ttl() 2012-01-24 00:07:22 +01:00
Ben Noordhuis
02b41f63dc Add missing UV_EXTERN declarations in uv.h 2012-01-24 00:07:22 +01:00
Maciej Małecki
24e6c7ec86 unix: map ENAMETOOLONG to UV_ENAMETOOLONG
With tests. Closes #295
2012-01-23 19:33:09 +01:00
Dan VerWeire
497b1ecd00 unix: add uv_udp_set_broadcast() and uv_udp_set_multicast_ttl() 2012-01-21 03:06:47 +01:00
Ben Noordhuis
6d9c9a533f Add uv_loop_refcount() function, debug tool. 2012-01-14 00:33:08 +01:00
Igor Zinkovsky
4d1d02fd18 windows: ensure that uv_fs_event callbacks have long names 2011-12-30 14:59:28 -08:00
Ben Noordhuis
feb267e611 unix: it's legal for dlsym() to return NULL
A symbol name can map to NULL. Check dlerror() to see if a real error happened.
2011-12-18 16:49:40 +01:00
Igor Zinkovsky
60630dab0f windows: enable pending pipe instances knob 2011-12-01 13:48:57 -08:00
Igor Zinkovsky
dceb3e65ca uv_cwd + uv_chdir 2011-12-01 12:27:12 -08:00
Bruce Mitchener
c69ccfabc2 Remove incorrect documentation comment.
The callback for uv_close does not have a status parameter.
2011-12-01 14:22:47 +01:00
Bruce Mitchener
b684deb4f4 Note that uv_is_active works on timers. 2011-11-30 14:48:57 +01:00
Bruce Mitchener
d513d9bb41 Fix typos. 2011-11-30 14:35:13 +01:00
Bert Belder
01f64f6612 Win: get rid of UV_EAINONAME, use UV_ENOENT instead 2011-11-25 10:11:29 +01:00
Ryan Dahl
4ae40b6a3f Bump version to v0.6 2011-11-14 16:14:10 -08:00
Frank Denis
9322dd1724 Use (void) for a function taking no arguments - fix gcc -Wstrict-prototypes 2011-11-10 22:55:06 +01:00
Ben Noordhuis
224584c53e sunos: check that event ports supports fs watching 2011-11-10 20:04:55 +01:00
Ben Noordhuis
4889644301 Fix warning: comma at end of enumerator list 2011-11-10 11:37:08 +01:00
Ryan Dahl
6d5ba42436 Remove unnecessary errno 2011-11-09 18:07:13 -08:00
Ryan Dahl
fd2b04d784 Alternative errno strategy 2011-11-09 17:47:24 -08:00
Tj Holowaychuk
a378110f9e Add UV_ESRCH
Fixes #239.
2011-11-08 16:36:20 -08:00
Ben Noordhuis
51df5e3b00 unix: map EISDIR 2011-11-07 09:20:54 +01:00
Ben Noordhuis
7b973eb4ad Fix uv_loop_new() and uv_default_loop() function prototypes. 2011-11-06 04:04:32 +01:00
Bert Belder
1997e10b50 Add flags to uv_fs_event_init 2011-11-05 01:42:08 +01:00
Igor Zinkovsky
faca1402ef make uv_pipe_connect return void 2011-11-04 16:06:53 -07:00
Ryan Dahl
681bd290e6 UV_EACCESS -> UV_EACCES
In order to match existing Node API. See
https://github.com/joyent/node/pull/2001
2011-11-03 16:17:12 -07:00
Igor Zinkovsky
74b49e821b uv_kill 2011-11-02 14:34:07 -07:00
Igor Zinkovsky
78f4b120a1 windows: knob for tuning number of concurrent accept requests 2011-10-31 23:37:45 -07:00
Bert Belder
90e15f1110 Implement uv_dlopen and friends 2011-10-29 00:52:34 +02:00
Bert Belder
e9472fe02b Prepare libuv for shared library build 2011-10-29 00:52:32 +02:00
Ben Noordhuis
f2c6b4106d unix: have uv_strerror() handle getaddrinfo() errors 2011-10-28 01:31:55 +02:00
Ben Noordhuis
3e4af533ae sunos: implement file watcher API 2011-10-26 03:49:34 +00:00
Ben Noordhuis
ec825ffc62 unix: add TCP keepalive and no-delay control knobs 2011-10-21 16:08:26 -07:00
Ben Noordhuis
d396799210 Change return type of uv_get_*_memory() functions
... from double to uint64_t. Limit use of floating point in public API as much
as possible.
2011-10-21 10:09:59 -07:00
Bert Belder
fb7138614d Improve ansi escape code support on windows 2011-10-20 19:31:24 -07:00
Ryan Dahl
2c7e8bb137 Map EAI_NONAME to ENOENT 2011-10-20 17:13:48 -07:00
Igor Zinkovsky
28234d7336 windows: ref pipe writes to keep the event loop alive 2011-10-20 15:14:55 -07:00
Igor Zinkovsky
54982a23ef windows: stdio over non-overlapped pipes 2011-10-20 15:14:39 -07:00
Bert Belder
51e9dbc2bb Work around windows udp bug, allow zero reads 2011-10-20 15:01:31 -07:00
Frank Denis
e8a418e920 Fix pasto: uv_udp_recv_start() receives a UDP datagram, it doesn't send data. 2011-10-18 23:11:23 +02:00
Igor Zinkovsky
72b5976e83 windows: support utf8 in uv_fs functions
fixes #201
2011-10-12 13:24:22 -07:00
Ben Noordhuis
197f591ebc common: add UV_ENOTDIR error code 2011-10-12 16:43:29 +02:00
Ben Noordhuis
61343ecfbd common: add UV_ENOSYS error code 2011-10-11 23:15:41 +02:00
Roman Shtylman
a3d1f6fd6f add uv_udp_set_membership for unix multicast support
- test-udp-multicast-join tests that multicast packets can be received
- stub src/win/udp.c until support added
2011-10-11 21:25:20 +02:00
Igor Zinkovsky
4ac13090ca fix mingw build 2011-10-11 10:45:02 -07:00
Ryan Dahl
5656e3c8bd Prepare for writable TTY to be blocking 2011-10-10 13:25:46 -07:00
Fedor Indutny
5ac040069e better docs 2011-10-07 01:41:42 -07:00
Igor Zinkovsky
012fc0799f windows: fixes #193. Ensures that uv_fs_event deals with short and long names 2011-10-06 19:39:06 -07:00
Igor Zinkovsky
34f719d7a5 windows ipc fixes 2011-10-06 10:17:42 -07:00
Igor Zinkovsky
81c4043c83 ipc on windows 2011-10-06 10:17:42 -07:00
Ryan Dahl
bb6b629e6a make test-ipc accept the pending tcp server 2011-10-06 10:17:18 -07:00
Ryan Dahl
45306f2e7f unix: implement uv_write2 2011-10-06 10:17:18 -07:00
Ryan Dahl
e5e6efe317 Add uv_write2 and uv_read2_start to header file 2011-10-06 10:17:18 -07:00
Ryan Dahl
6921d2fc07 Add argument to uv_pipe_init for IPC, unix impl 2011-10-06 10:17:07 -07:00
Ben Noordhuis
8e9a3384c9 unix: implement kqueue file watcher API
kqueue fds are not embeddable into other pollsets (select, poll, kqueue).
Hack the libev event loop to receive kqueue events with filter flags intact.
2011-10-04 23:28:36 +02:00
Fedor Indutny
a35591bbfc os: implement loadavg (not working on cygwin/win) 2011-10-04 18:15:14 +02:00
Fedor Indutny
33cb8775bc os: implement memory bindings
* us_get_free_memory
* us_get_total_memory
2011-10-04 18:10:35 +02:00
Ryan Dahl
fe18438416 add uv_tty_reset_mode() 2011-09-30 13:09:06 -07:00
Ryan Dahl
153d3c7c57 unix: allow tty raw mode to be turned off 2011-09-30 11:21:51 -07:00
Igor Zinkovsky
e7a53aed48 fix windows build 2011-09-28 11:52:08 -07:00
Erick Tryzelaar
23796d208c Fixes #76. Unify OS error reporting
As a nice fringe benefit, this also shaves a word
off of a windows TCP handle by replacing "uv_err_t
bind_error" with "int bind_error".
2011-09-27 19:05:33 -07:00
Igor Zinkovsky
a1f98d55b1 fix c-ares on windows 2011-09-27 16:09:57 -07:00
Ben Noordhuis
2e4eca3b5e c-ares: upgrade to 1.7.5 2011-09-27 16:04:25 -07:00
Ben Noordhuis
1cca230d76 Merge remote-tracking branch 'origin/v0.6' 2012-01-23 13:27:47 +01:00
Igor Zinkovsky
52511b9ddc windows: implement uv_loop_new+uv_loop_delete 2012-01-16 17:07:49 -08:00
Ben Noordhuis
71f6c0edb8 Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	src/win/util.c
2012-01-16 18:07:49 +01:00
Igor Zinkovsky
26512731e3 remove uv_thread_self 2012-01-13 17:24:30 -08:00
Igor Zinkovsky
94a5c7b002 fix warnings in windows build 2012-01-11 18:12:51 -08:00
Ryan Dahl
51ea46de45 Merge remote branch 'origin/v0.6' 2012-01-09 11:31:13 -08:00
Ryan Dahl
4ad33e9748 Revert "Add uv_pipe_pair for communication between threads"
Not needed. We took a different approach for isolates.

This reverts commit 5cc6090fdf.
2012-01-09 11:22:46 -08:00
Ryan Dahl
5cc6090fdf Add uv_pipe_pair for communication between threads
This is only the Unix implementation and test.
2011-12-29 22:41:08 -08:00
Ben Noordhuis
85f6b7952b Fix Windows build, uv_eio_channel is Unix only. 2011-12-28 14:42:46 +01:00
Paddy Byers
abf9654a55 unix: create separate eio result queue per loop
Makes the eio "done" callback run in the thread that submitted it. Makes it safe
to use libeio from multiple event loops.
2011-12-20 20:47:33 +01:00
Ben Noordhuis
6a9cb902ae Add ngx_queue_foreach() macro. 2011-12-20 20:47:33 +01:00
Ben Noordhuis
69ce0145f6 Wrap platform "thread-safe run once" APIs. 2011-12-20 20:34:55 +01:00
Ryan Dahl
a993329c02 add uv_thread_self 2011-12-20 11:34:18 -08:00
Igor Zinkovsky
3d189de699 platform api 2011-12-14 17:50:36 -08:00
mattn
e53cecb8c0 add uv_run_once() 2011-12-14 14:28:35 +01:00
Ben Noordhuis
f5c2a4a1ae Merge branch 'v0.6'
Conflicts:
	src/unix/core.c
	src/win/winapi.h
2011-12-02 18:15:04 +01:00
Bert Belder
ee49c7a2b6 Fix MinGW and MinGW-w64 builds
Closes GH-222 and GH-267.
Thanks Yuki Okumura and Yasuhiro Matsumoto for providing fixes.
2011-12-01 15:47:49 +01:00
Bert Belder
35fa2a6a51 Merge branch 'v0.6' 2011-11-25 12:46:17 +01:00
Ben Noordhuis
b52b8c7128 util: add uv_strlcpy() and uv_strlcat() functions 2011-11-23 17:29:02 +01:00
Ben Noordhuis
8e4ed88bbe Wrap platform thread APIs. 2011-11-21 21:04:16 +01:00
Ben Noordhuis
1fc1f28093 Wrap platform mutex and rwlock APIs.
Read/write locks are emulated with critical sections on Windows XP and Vista
because those platforms don't have a (complete) native read/write lock API.
2011-11-18 12:42:08 +01:00
Bert Belder
8f563e2963 Revert c-ares upgrade and includes fix
It broke the windows build.
This reverts commit 083c97e28b and commit b288afdf14.
2011-09-27 12:39:55 +02:00
Ben Noordhuis
083c97e28b c-ares: upgrade to 1.7.5 2011-09-26 22:41:17 +02:00
Bert Belder
622eb99113 win: implement tty
loose end: line-buffered input reads ascii, not unicode
2011-09-26 19:31:32 +02:00
Bert Belder
985f1a1b2d cleanup 2011-09-25 04:09:21 +02:00
Ryan Dahl
03d0c57ea2 Remove uv_is_tty. Use uv_guess_handle instead. 2011-09-23 10:01:45 -07:00
Erick Tryzelaar
7e8645d101 unix,win: Make uv_freeaddrinfo to clean up addrinfo
Fixes #196
2011-09-23 09:31:01 -07:00
Ryan Dahl
03652596cf unix: add uv_guess_handle and uv_tty_get_winsize 2011-09-22 19:35:46 -07:00
Ben Noordhuis
3368d6c1a2 unix: stub file watcher implementation
The file watcher API has not been implemented on all Unices yet.
Provide stubs on those platforms so libuv at least compiles.
2011-09-22 23:55:05 +02:00
Ben Noordhuis
2a1c32a60c linux: implement file watcher API 2011-09-21 13:23:49 -07:00
Igor Zinkovsky
1e0757ffda windows: file watcher 2011-09-21 13:13:34 -07:00
Ryan Dahl
c1374ba587 Add uv_is_tty() 2011-09-20 11:48:47 -07:00
Ben Noordhuis
bca49960fb unix: handle stream write errors properly
1. Ensure that failed writes don't leave the write queue in an inconsistent
   state. Before, write requests were handed back to the user but were not
   removed from the write queue. The cause of at least one use-after-free bug.

2. Pass the error to the callback on the next iteration of the event loop
   instead of returning it immediately.
2011-09-14 04:16:45 +02:00
isaacs
3c00d87b42 Add EEXIST handling
Additionally, map ERROR_ALREADY_EXISTS to EEXIST on Windows.  I'm a bit
unsure about this mapping.  Could a windows person confirm?
2011-09-12 16:36:35 -07:00
Ryan Dahl
4484d61fe1 Add interfaces for uv_pipe_open, uv_tty_init, uv_tty_set_mode
Nothing works - no tests. This is just to coordinate efforts between Bert
and I.
2011-09-12 14:32:14 -07:00
Bert Belder
f790b689a7 Remove uv_init from uv.h and windows backend 2011-09-12 11:32:41 -07:00
Erick Tryzelaar
efa1b54076 Subclass uv_getaddrinfo_t from uv_req_t.
This patch also fixes #155. Since we no longer
memset clear the uv_getaddrinfo_t, the user can
now set the `uv_getaddrinfo_t->data` field without
problems.
2011-09-10 01:46:26 -07:00
Ben Noordhuis
52eca75152 unix: uv_pipe_t should not depend on UV_TCP_PRIVATE_FIELDS 2011-09-10 01:39:46 +02:00
Bert Belder
3d538af06b win: correctly manage child process stdio handles 2011-09-06 03:20:16 +02:00
Ben Noordhuis
b7d88070d8 fs: add UV_ENOENT error code, add test 2011-09-06 00:17:59 +02:00
Igor Zinkovsky
b90459fc81 windows: use _stati64 2011-09-04 23:31:25 -07:00
Ryan Dahl
a18860aec6 Add uv_fs_t.path on unix and tests
Windows implementation missing https://github.com/joyent/libuv/issues/177
2011-09-04 18:05:11 -07:00
Igor Zinkovsky
060026ced3 windows: uv_fs_link + uv_fs_symlink 2011-09-04 13:24:35 -07:00
Bert Belder
7b87ff7c9b win: rename uv_loop_t.ares_channel to ares_chan to avoid confusing g++ 2011-09-04 21:54:31 +02:00
Bert Belder
12b01e95f9 Specialize uv_xxx_getsockname, add uv_tcp_getpeername 2011-09-04 04:49:13 +02:00
Igor Zinkovsky
22197ebf3f windows: include _stat struct into uv_fs_t 2011-09-01 11:54:43 -07:00
Ryan Dahl
cec94ee075 docs for uv_fs methods 2011-08-31 11:23:29 -07:00
Ryan Dahl
b47c474cfd Move private headers into include/uv-private 2011-08-31 00:43:55 -07:00
Bert Belder
78debf9f67 win: multiplicity 2011-08-31 04:19:16 +02:00
Bert Belder
3aec77f9d4 bring back uv_init 2011-08-31 04:19:07 +02: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
Igor Zinkovsky
3a374ca7c9 add missing values to uv_fs_type 2011-08-26 21:51:39 -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
Bert Belder
39aac4a5fc win: better shutdown for pipes 2011-08-26 02:21:33 +02:00
Ryan Dahl
80e5491886 Simplify UDP docs 2011-08-24 12:25:15 -07:00
Bert Belder
5c9d749a57 win: udp support 2011-08-24 04:55:08 +02:00
Ben Noordhuis
36ce74f2ca Add UDP support to libuv. 2011-08-24 04:55:01 +02:00
Ben Noordhuis
52024061e4 Make uv_getsockname() operate on uv_handle_t handles. 2011-08-24 04:17:36 +02:00
Bert Belder
5cae6e4e57 win: use uv_req_t.overlapped.Internal field to propagate request errors 2011-08-23 21:24:14 +02:00
Bert Belder
811828719f win: store the tcp deferred bind error in uv_tcp_t.bind_error, remove uv_handle_t.error 2011-08-23 20:41:16 +02:00
Ben Noordhuis
6cc241ac7a Fix 'incomplete prototype' compiler warnings on SunOS. 2011-08-22 14:27:39 +00:00
Bert Belder
cc0b0e6238 Remove trailing whitespace 2011-08-21 21:46:05 +02:00
Igor Zinkovsky
8448ee4bf6 Windows: Do simultaneous pending AcceptEx calls. 2011-08-18 17:45:59 -07:00
Ryan Dahl
d77e9795d3 Fix spelling 2011-08-18 10:35:52 -07:00
Igor Zinkovsky
422c139306 Windows: Pre-allocate buffers for overlapped WSARecv if the number of active tcp streams is below 50. 2011-08-17 17:44:54 -07:00
Ryan Dahl
e5a938f1f4 Add uv_buf_init() constructor 2011-08-17 17:43:19 -07:00
Ryan Dahl
ed118836c4 Improve docs 2011-08-17 00:42:44 -07:00
Ben Noordhuis
e8497aee5a Add error code UV_EPIPE. 2011-08-11 02:45:27 +02:00
Ben Noordhuis
4abd1e0ccc uv-unix: close file descriptors immediately in uv_close()
Don't defer closing of socket and pipe file descriptors to the
next iteration of the event loop. It breaks node.js unit tests
that assume the call to `server.close()` immediately frees up
the bound to address.
2011-08-09 23:14:38 +02:00
Ryan Dahl
1493dcf359 Peter Bright's MSVS fixes 2011-08-06 22:36:59 -07:00
Ryan Dahl
a30a7336f0 Build with gyp 2011-08-06 02:17:56 -07:00
Ryan Dahl
52e1a9e997 Upgrade eio (it has better msvs support) 2011-08-06 00:29:39 -07:00
Peter Bright
d84b249616 Support for unescaped arguments, suitable for use with cmd /c.
Robust argument escaping that hopefully matches Windows' algorithm for unescaping.
2011-08-04 18:22:47 -07:00
Ryan Dahl
b2ed24d86e unix: Remove flock code
solaris doesn't have flock
2011-08-02 07:08:13 +00:00
Bert Belder
2e9a743da0 Windows: report uv_spawn() failure asynchronously 2011-08-01 20:24:54 -07:00
Igor Zinkovsky
d272a2183d Windows: spawn child processes 2011-07-29 19:02:51 -07:00
Ryan Dahl
7108ca8853 uv_spawn requires stdio pipes to be initialized 2011-07-29 15:37:00 -07:00
Ben Noordhuis
8e8af8fd34 uv-unix: use lock file to detect stale UNIX sockets 2011-07-29 03:59:55 +02:00
Igor Zinkovsky
fc7bc2be70 fix mingw build; add stubs for child process API 2011-07-27 11:05:32 -07:00
Ryan Dahl
92bc7b4959 Start uv_spawn()
Unix only at the moment. Lacks test for stdio
2011-07-25 16:19:27 -04:00
Igor Zinkovsky
252da78830 uv_std_handle + uv_listen on stdin 2011-07-25 10:28:50 -07:00
Igor Zinkovsky
e7497227bd merge uv_tcp_listen and uv_pipe_listen into uv_listen 2011-07-22 16:57:09 -07:00
Ben Noordhuis
afd22904ea ev: mark inline functions in ev.h with __attribute__((unused))
Silences the ton of warnings you get with `gcc -Wall -Wextra`.
2011-07-21 15:55:23 +02:00
Igor Zinkovsky
f8bdddcda9 Allow pipe name to be in utf8 for uv_pipe_bind and uv_pipe_connect 2011-07-20 18:55:40 -07:00
Ryan Dahl
b931c9313f uv_close returns void 2011-07-20 18:03:48 -07:00
Ryan Dahl
07b49ce59a add uv_ip4_name and uv_ip6_name 2011-07-18 17:39:04 -07: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
Igor Zinkovsky
4d31f838b0 Windows: handle ERROR_PIPE_BUSY in uv_pipe_connect 2011-07-18 13:02:32 -07:00
Bert Belder
c1bddb9677 Stop g++ from complaining about anonymous struct usage 2011-07-16 00:33:31 +02:00
Bert Belder
2f83928b6f Define union uv_any_req 2011-07-14 10:46:34 -07:00
Bert Belder
0ea4c87f8b Windows implementation of new request API
This changes uv-win to use the new uv_req subclasses.

It gets rid of the uv_req.flags field. There used to be only request flag
(UV_REQ_PENDING), and it was mostly obsolete; it only had a real purpose for
internal uv_read requests. Now we'll use the UV_HANDLE_READ_PENDING flag on
the handle instead.

This patch also simplifies the accept logic for named pipes on windows. We
no longer have a separate struct to store information about established
connections. Instead we just carry over the windows HANDLE from the accept
request to the client handle in uv_pipe_accept().
2011-07-14 10:46:08 -07: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
f5ff869488 allocate windows pipe handles on demand 2011-07-13 20:43:10 -07:00
Bert Belder
4c2d0545fc Whitespace fixes 2011-07-14 03:00:21 +02:00
Bert Belder
28650425e2 uv-win: refactor request processing 2011-07-13 21:49:15 +02:00
Ben Noordhuis
f852c517a1 Change uv_pipe_*() prototypes from char* to const char*. 2011-07-13 00:12:30 +02:00
Henry Rawas
6b32ebc54f uv_getsockname 2011-07-12 09:57:08 -07:00
Igor Zinkovsky
2e49cc56d1 Rename uv_pipe_create to uv_pipe_bind.
Fixes issue #97.
2011-07-11 15:24:35 -07:00
Igor Zinkovsky
b6a6dae34f Named pipes implementation for Windows 2011-07-09 21:41:04 +02:00
Robert Mustacchi
ee599ec114 Fix Linux build 2011-07-07 23:55:58 -07:00
Robert Mustacchi
8287551b91 Fix SunOS build 2011-07-07 23:55:50 -07:00
Ryan Dahl
6d8c499e35 Don't export the private CPP symbols. 2011-07-07 22:38:41 -07:00
Ryan Dahl
18fa8c0ecd Move ev.h to include/ 2011-07-07 21:55:01 -07:00
Robert Mustacchi
8c00b369b4 C99 compatibility.
Get 99% of the way there for --std=c89 -pedantic for core files. Also cleans
up follow up warnings and others in tests.
2011-07-07 21:39:08 -07: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