Commit Graph

172 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
e1154d70ce Api for polling external sockets 2012-05-03 15:51:37 +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
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
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
bf9a2b3463 x-macro-ify uv_handle_type and uv_req_type 2012-04-04 09:05:13 +02:00
Vladimir Dronnikov
b309f2e2e6 Add uv_is_closing()
Closes #367.
2012-04-01 21:05:50 +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
Ben Noordhuis
ef47a627ad unix: move libeio specific fields to uv-unix.h 2012-03-21 02:11:18 +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
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
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