Commit Graph

943 Commits

Author SHA1 Message Date
Bert Belder
1d64a36caa windows: add support for cpu times to uv_cpu_info()
* Also cleans up the code and makes it use unicode APIs consistently.
* Credits go to Brian White for creating an earlier version of this
  patch.

Closes #327
2012-06-02 20:05:12 +02:00
Brian White
4252240e54 windows: add uv__once_init() that ensures that libuv has been initialized 2012-06-02 20:05:12 +02:00
Brian White
87f3530a1e windows: retrieve NtQuerySystemInformation at startup 2012-06-02 20:05:11 +02:00
Bert Belder
120d997809 windows: fix NTSTATUS redefined when compiling with MinGW
Closes #403
Closes #422
2012-06-02 17:39:31 +02:00
Bert Belder
961e0cf8da windows/tty: never report error after forcibly aborting line-buffered read 2012-06-02 03:08:48 +02:00
Bert Belder
07f0175239 windows: fix hang when closing an active poll handle 2012-06-01 18:39:49 +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
Bert Belder
528123ad9a windows: fix bugs in uv__fast_poll_cancel_poll_req 2012-06-01 03:05:31 +02:00
Charlie McConnell
69a923bf93 process: implement UV_PROCESS_DETACHED flag for uv_spawn 2012-06-01 02:24:05 +02:00
Bert Belder
aecddfe530 windows: style fix 2012-05-31 17:35:25 +02:00
Bert Belder
0c727fd774 windows: don't crash 2012-05-31 17:34:53 +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
71a66c17a1 unix: mark eio poll handles as internal 2012-05-30 02:33:50 +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
122cd94695 unix: remove unused flag UV__PENDING 2012-05-30 01:34:11 +02:00
Ben Noordhuis
9d26f49725 unix, windows: rename flags UV__ACTIVE, UV__REF
Rename UV__ACTIVE and UV__REF to UV__HANDLE_ACTIVE and UV__HANDLE_REF to make
it clear that they apply to handles, not requests or loops.
2012-05-30 01:30:24 +02:00
Ben Noordhuis
58a272e556 unix: rework pending handle/req logic 2012-05-30 00:08:22 +02:00
Bert Belder
7556590707 win/process.c: stdio fd should default to ignore 2012-05-29 00:53:04 +02:00
Ben Noordhuis
18e622d43e unix: fix indentation in sunos.c 2012-05-29 00:09:47 +02:00
Bert Belder
81aff93633 win/process.c: remove unused function duplicate_std_handle 2012-05-29 00:06:11 +02:00
Ben Noordhuis
4690204682 unix: fix getaddrinfo bad pointer deref 2012-05-29 00:06:11 +02:00
Fedor Indutny
c0081f0e66 unix: 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. It also makes it possible to set more than just stdin,
stdout and stderr.
2012-05-29 00:05:12 +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
2ec09862e4 unix, windows: set active flag on unref'd handles
A logic bug in uv__handle_start() and uv__handle_stop() stopped the active flag
from getting set (or unset) on unref'd handles.
2012-05-28 00:24:39 +02:00
Ben Noordhuis
028fef84b8 unix: update timer if already active
uv_timer_start() no longer returns an error when the timer is already active,
now it just updates the timer. Consistent with the uv-win implementation.

Fixes #425.
2012-05-26 02:09:59 +02:00
Ben Noordhuis
ce28e13038 unix: remove unused __attribute__((unused)) 2012-05-25 01:24:17 +02:00
isaacs
604802ad47 Fix sunos build: undeclared variable 'handle' 2012-05-24 23:00:31 +02:00
Ben Noordhuis
752ac30ec8 unix: don't pass sockaddr to accept()
Shaves a few nanoseconds off the accept() syscall.
2012-05-24 14:31:53 +02:00
Ben Noordhuis
cff2221fbf unix: split up loop.c
Move prepare/check/idle watcher code to loop-watcher.c so it can be reused for
the linux backend.
2012-05-23 23:47:06 +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
5fd2c406f1 unix: fix up asserts in core.c and stream.c 2012-05-23 22:19:12 +02:00
Ben Noordhuis
2609e43632 unix: remove unnecessary functions in udp.c 2012-05-23 21:18:40 +02:00
Ben Noordhuis
2b09cc2246 unix: fix up asserts in udp.c 2012-05-23 21:08:40 +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
3604b8ddd3 unix: don't unlink UNIX socket on EADDRINUSE
It was a bad idea to start with...
2012-05-23 14:06:32 +02:00
Ben Noordhuis
2e3e658be1 unix: fix uv_poll CPU usage spike
Saúl Ibarra Corretgé reports that calling uv_poll_start() repeatedly results
in CPU usage spikes. Fixed by stopping the poll I/O watcher before updating it.

Fixes #424.
2012-05-23 12:52:44 +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
Igor Zinkovsky
2df831723f windows: set flags for uv_fs_symlink 2012-05-22 16:32:17 -07:00
Igor Zinkovsky
253d718572 report correct error 2012-05-22 15:58:01 -07: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
Ben Noordhuis
6190caba05 unix: remove outdated comment 2012-05-22 15:08:29 +02:00
Bert Belder
ad279df7c0 Unix: remove superfluous variable from uv_poll_start 2012-05-22 01:03:47 +02:00
Ben Noordhuis
6fd9bfb7b0 unix: fix event loop block, prepare/check invoke
Don't block in epoll_wait() / kevent() / etc. syscall unless there are active
handles. If there are only active requests, do a non-blocking poll.

Likewise, don't run the prepare and check watchers unless there are active
handles *or* requests.
2012-05-21 17:41:52 +02:00
Ben Noordhuis
e82d46452e unix: fix close-before-connect bug
Closing the TCP socket before the SYN/ACK handshake completed hung the event
loop, the connect req didn't get unregistered.
2012-05-18 01:19:57 +02:00
Ben Noordhuis
e10a87adb9 unix: streamline shutdown req cleanup logic 2012-05-18 01:19:57 +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
Frank Denis
07622e767d unix: change #if FIONBIO to #ifdef FIONBIO
Fixes compilation on Debian/ppc 6.0.4.
2012-05-16 16:59:42 +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
Bert Belder
1d24c76df7 Windows: fix MinGW
MinGW's headers are missing a definition for SIO_BASE_HANDLE
2012-05-05 00:05:36 +02:00
Bert Belder
4365896921 Windows: skip GetFileAttributes call when opening a file
It wasn't working, and everything seemed to work fine nonetheless. Removing it just saves a syscall.
2012-05-04 14:31:48 -07:00
Bert Belder
b750dec517 Windows: fix iocp emulation bugs for tcp handles
Makes ipc_tcp_connection pass on Windows XP
2012-05-04 13:54:02 -07:00
Ben Noordhuis
6037684ef8 unix: zero out new loop struct
Fixes spurious segfaults in pyuv.
2012-05-04 15:02:33 +02:00
Ben Noordhuis
ce129ac6e2 windows: remove unused variables 2012-05-03 19:50:49 +02:00
Ben Noordhuis
395e256889 unix: don't use setlocale()
setlocale() is not inherently thread-safe. We'll have to live with the fact
that test/test-dlerror.c fails on systems with localized error messages.
2012-05-03 19:50:40 +02:00
Ben Noordhuis
5d19aa84f0 unix, win: rework uv_dlopen() API 2012-05-03 19:36:40 +02:00
Ben Noordhuis
93d16e6a84 unix: change uv_dl*() error code
Return UV_ENOENT instead of UV_EINVAL. UV_EINVAL was arbitrarily chosen and
turns out to be inconsistent with the Windows implementation.

Fixes #395.
2012-05-03 16:54:59 +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
e38755485e Unix: namespace stream handle flags 2012-05-03 01:47:13 +02:00
Ben Noordhuis
1ebe14e494 linux: fix build error with old kernel headers
O_CLOEXEC was introduced in linux 2.6.23, don't assume it's available.

Fixes #400.
2012-05-02 17:42:59 +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
9f0dc2601e Windows: fetch pointer for CancelIoEx on startup 2012-05-02 03:38:31 +02:00
Bert Belder
7d45cca12a Windows: we're out of handle flags - arrange them more efficiently 2012-05-02 03:38:30 +02:00
Bert Belder
6367da25b3 Merge branch 'v0.6' 2012-05-01 16:54:27 +02:00
Ben Noordhuis
936795a2c8 windows: map ERROR_WRITE_PROTECT to UV_EROFS 2012-05-01 16:53:00 +02:00
Maciej Małecki
edb40b16ce unix: map EROFS to UV_EROFS
Conflicts:

	src/unix/error.c
2012-05-01 16:52:48 +02:00
Fedor Indutny
0efa3cf4d3 err: handle EIO errors on win/unix 2012-05-01 16:43:00 +02:00
Bert Belder
c7edea997e Merge branch 'v0.6' 2012-05-01 16:21:11 +02:00
Bert Belder
32f6f6e2c7 Windows: map ERROR_NOT_SAME_DEVICE to UV_EXDEV 2012-05-01 16:20:52 +02:00
Keno Fischer
d13b1e0803 Windows: fix uv_fs_ftruncate to compile with Mingw32
Close: #382, #397
Ref: #381
2012-04-29 02:32:27 +02:00
Ben Noordhuis
fac3b68fff linux: add IN_MOVE_SELF to inotify event mask
Partially fixes joyent/node#3172, behavior is now consistent with inotifywait.
2012-04-28 02:47:58 +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
c862acc609 Windows: add mappings for UV_ENOENT 2012-04-28 02:09:29 +02:00
isaacs
b26fdde181 Map ENOMEM to UV_ENOMEM 2012-04-28 02:09:17 +02:00
Bert Belder
d41cc9118d Windows: uv_spawn2 reports the wrong error when setuid/setgid is specified 2012-04-27 21:58:44 +02:00
Bert Belder
aea5db5da1 Windows: add mappings for UV_ENOENT 2012-04-27 21:24:27 +02:00
Bert Belder
c42ba103b7 Temporary API to support spawn with uid and gid options 2012-04-27 17:41:56 +02:00
Luis Lavena
b6e3dcc799 Windows: actually detect mingw-w64 and not 64 bits mode
__MINGW64__ is only defined when using mingw-w64 in 64bits mode, not when
using the 32bits version of the compiler.

Instead, to detect usage of mingw-w64 instead of mingw version of GCC we
should look at __MINGW64_VERSION_MAJOR and __MINGW64_VERSION_MINOR. If one
of these is defined means we are running on mingw-w64 compiler and headers
and not mingw.org build.

Read more here: http://bit.ly/detect-mingw-w64-vs-mingw

Closes #384
2012-04-25 04:06:53 +02:00
Ben Noordhuis
06ae804e03 linux: add IN_MOVE_SELF to inotify event mask
Partially fixes joyent/node#3172, behavior is now consistent with inotifywait.
2012-04-25 01:27:43 +02:00
Bert Belder
42a86693a7 Windows: set loop counters to zero in uv_loop_init 2012-04-25 00:30:07 +02:00
Bert Belder
1b6329dd3e Style fixes 2012-04-25 00:30:07 +02:00
Ben Noordhuis
84d2f82a68 windows: rename local var errno to errorno
Fixes compiler warning: ‘_errno’ redeclared without dllimport attribute:
previous dllimport ignored.
2012-04-23 12:10:38 -07:00
Igor Zinkovsky
e6d4bca2ec remove left-over cast fixes #3160 2012-04-23 10:52:53 -07:00
Ben Noordhuis
1f001fe917 unix: remove kqueue cb == NULL check
The other implementations don't check for it and it's making the counters_init
test fail.
2012-04-23 17:55:57 +02:00
Ben Noordhuis
21bee8c36f unix: call pipe handle connection cb on accept() error 2012-04-22 19:32:47 +02:00
Ben Noordhuis
cf6dc082ca unix: handle EWOULDBLOCK in uv__read() 2012-04-22 19:32:47 +02:00
Ben Noordhuis
01cc491853 unix: handle EWOULDBLOCK in uv__write() 2012-04-22 19:32:47 +02:00
Ben Noordhuis
df22d5935e unix: handle EWOULDBLOCK in uv__server_io() 2012-04-22 19:32:46 +02:00
Ben Noordhuis
73cc3677fc unix: map EWOULDBLOCK to UV_EAGAIN 2012-04-22 19:32:46 +02:00
Ben Noordhuis
1fa1c5106a unix: call pipe handle connection cb on accept() error 2012-04-21 06:11:38 +02:00
Ben Noordhuis
a55a33625e unix: handle EWOULDBLOCK in uv__read() 2012-04-21 06:11:38 +02:00
Ben Noordhuis
4fd6264883 unix: handle EWOULDBLOCK in uv__write() 2012-04-21 06:11:38 +02:00
Ben Noordhuis
a8b5235132 unix: handle EWOULDBLOCK in uv__server_io() 2012-04-21 06:11:38 +02:00
Ben Noordhuis
a29892d9d4 unix: map EWOULDBLOCK to UV_EAGAIN 2012-04-21 06:11:34 +02:00
isaacs
f9fcaf5ccf Map ENOMEM to UV_ENOMEM 2012-04-20 08:16:55 -07:00
Ben Noordhuis
ab3b307df3 unix: clean up uv__req_init() 2012-04-18 22:30:20 +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
Bert Belder
13b8ebd7e6 windows: a closing async watcher should not call it's callback 2012-04-18 01:28:32 +02:00
Ben Noordhuis
d5e7786885 windows: map ERROR_WRITE_PROTECT to UV_EROFS 2012-04-16 16:35:50 +02:00
Maciej Małecki
58733d18a6 unix: map EROFS to UV_EROFS 2012-04-16 16:33:35 +02:00
Bert Belder
62a63a30e4 Windows: make uv_dlopen() look in the DLL path to resolve recursive dependencies 2012-04-13 00:47:45 +02:00
Bert Belder
9984d157ff Windows: make uv_uptime() more robust 2012-04-12 17:36:42 +02:00
Bert Belder
f3e3e5b504 Windows: validate UDP socket options
Makes test-udp-options pass on Windows.
2012-04-12 04:07:21 +02:00
Ben Noordhuis
a41016e9cd unix: run pending shutdown cb when stream is closed 2012-04-12 03:47:25 +02:00
Bert Belder
fa21584878 Whitespace 2012-04-12 03:17:03 +02:00
Ben Noordhuis
42d3533487 unix: fix udp_options test on OS X and Solaris
setsockopt(IP_TTL) will happily let you set a TTL > 255 on OS X, cap it.

-1 or 0 is a valid TTL on Linux but not portable, deny it.
2012-04-11 14:51:46 +00: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
Ben Noordhuis
d68b3d960b unix: add uv_fs_read64, uv_fs_write64 and uv_fs_ftruncate64 2012-04-06 01:47:18 +02:00
Ben Noordhuis
8e6f332fed unix: fix compiler warning, #include <unistd.h> 2012-04-06 01:24:20 +02:00
saghul
e3468e9d42 unix: add missing function declaration 2012-04-06 01:23:10 +02:00
Igor Zinkovsky
ea50126358 add 64bit offset fs functions 2012-04-05 16:01:29 -07:00
Ben Noordhuis
637d976c19 Revert "Fix memory leak in uv_exepath() on OSX."
This reverts commit f6c8e78db9.

realpath() on OS X 10.5 crashes if resolved_path == NULL.
2012-04-06 00:55:04 +02:00
Bert Belder
f6df47b474 Merge branch 'v0.6' 2012-04-05 17:26:23 +02:00
Bert Belder
3506cd1dc5 Windows: don't report ENOTSOCK when attempting to bind an udp handle twice 2012-04-05 17:25:21 +02:00
Bert Belder
cda7a28039 Windows: backport pipe-connect-to-file fixes from master
Conflicts:

    src/win/pipe.c


commit e53ab6675ba12d97ad6d93c9913a473ba5172617
Author: Bert Belder <bertbelder@gmail.com>
Date:   Fri Mar 9 17:04:03 2012 +0100

    Windows: report UV_ENOTSOCK when we opened a file instead of a pipe

    Makes the pipe_connect_to_file test pass on Windows.

commit 8cbbfbe4c6489868470a7e410f80d4729f4091bf
Author: Igor Zinkovsky <igorzi@microsoft.com>
Date:   Thu Mar 1 14:32:59 2012 -0800

    test: make pipe_connect_to_file succeed with ECONNREFUSED

commit 6bbccf1fe0
Author: Igor Zinkovsky <igorzi@microsoft.com>
Date:   Thu Mar 1 12:11:12 2012 -0800

    windows: return UV_ENOTSOCK when doing uv_pipe_connect to a file
2012-04-05 16:47:49 +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
Ben Noordhuis
f4e7537184 unix: move inotify init logic to loop.c 2012-04-05 15:13:14 +02:00
Ben Noordhuis
68bed698fc unix: move loop init logic out of core.c 2012-04-04 05:54:39 -07:00
Ben Noordhuis
5a8446c309 unix: move handle specific close logic out of core.c 2012-04-04 05:30:15 -07: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
5fbe0aab33 unix: move active checks out of core.c
Move active checks out of core.c and into their respective compilation units:
check, idle, prepare, timer.
2012-04-04 06:52:29 +02:00
Ben Noordhuis
5a59e4924a unix: move idle code from core.c to idle.c 2012-04-04 05:25:34 +02:00
Ben Noordhuis
dd31265751 unix: move check code from core.c to check.c 2012-04-04 05:25:34 +02:00
Ben Noordhuis
f1a19e6d34 unix: move prepare code from core.c to prepare.c 2012-04-04 05:25:34 +02:00
Ben Noordhuis
f7359a335c unix: move async code from core.c to async.c 2012-04-04 05:25:34 +02:00
Ben Noordhuis
fd987a26fe unix: move timer code from core.c to timer.c 2012-04-04 05:25:27 +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
Brian White
442aa1f469 win: use performance counter instead of GetTickCount for uptime 2012-04-01 21:15:38 +02:00
Vladimir Dronnikov
b309f2e2e6 Add uv_is_closing()
Closes #367.
2012-04-01 21:05:50 +02:00
Ben Noordhuis
685b36ba66 linux: tidy up syscall code 2012-03-31 00:19:01 +00:00
Ben Noordhuis
4632163190 sunos: don't use fopen()
FILE uses an unsigned char to store the file descriptor so it cannot handle
situations where there are more than 256 open file descriptors.
2012-03-31 00:04:37 +00:00
Igor Zinkovsky
4360018774 add missing uv_tcp_close declaration 2012-03-30 11:49:31 -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
Bulat Shakirzyanov
31ff9863a1 unix: fix TARGET_OS_IPHONE conditional 2012-03-28 15:45:44 +02:00
Bert Belder
6e0ca3aa8f Merge branch 'v0.6'
Conflicts:
	src/unix/linux/inotify.c
2012-03-27 23:46:23 +02:00
Bert Belder
1795427ab0 Windows: never call fs event callbacks after closing the watcher 2012-03-27 23:00:26 +02:00
Aaron Bieber
40e6373263 unix: fix compiler warning
Fix warning "for loop initial declaration used outside C99 mode" on openbsd.
2012-03-27 17:34:18 +02:00
Ben Noordhuis
8409a6765b unix: ignore ECONNABORTED errors from accept()
ECONNABORTED means that the connection was torn down by the peer before the
TCP handshake completed. Ignore it, there's nothing we can do and it simplifies
error handling for libuv users.
2012-03-21 15:42:29 -07:00
Ben Noordhuis
c9c9d805da unix: ignore ECONNABORTED errors from accept()
ECONNABORTED means that the connection was torn down by the peer before the
TCP handshake completed. Ignore it, there's nothing we can do and it simplifies
error handling for libuv users.
2012-03-21 07:07:20 -07:00
Charlie McConnell
8e59042310 unix: map ENETUNREACH to UV_ENETUNREACH
UV_ENETUNREACH already exists, but was not mapped properly on unix.
2012-03-21 02:11:43 +01:00
Ben Noordhuis
4ff0898c5f unix: replace uv__close() with close()
uv__close() was deprecated a while ago. It's been an alias for close() ever
since. Remove it.
2012-03-21 02:11:18 +01:00
Ben Noordhuis
49d4e1884b linux: use CLOCK_BOOTTIME if available
Use CLOCK_BOOTTIME to calculate the system uptime. Fall back to CLOCK_MONOTONIC
if CLOCK_BOOTTIME is not available (all pre-2.6.39 kernels).

The problem with CLOCK_MONOTONIC is that it doesn't increase when the system is
suspended, making the uptime differ from what the uptime(1) tool reports.
2012-03-19 07:55:16 -07:00
Bert Belder
4ae316bcc9 Windows: fix compiler warnings 2012-03-16 02:38:37 +01:00
Ben Noordhuis
87151c8a7b Use RB_GENERATE_STATIC, not RB_GENERATE_INTERNAL. 2012-03-16 02:35:05 +01:00
Bert Belder
163d8de392 Add UV_ENOSPC and mappings to it
Closes GH-337
2012-03-16 02:32:06 +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
66a959c405 linux: try inotify_init if inotify_init1 returns ENOSYS
The kernel may be older than the kernel headers that libuv is compiled against.
2012-03-15 01:09:16 +01:00
Ben Noordhuis
1b6df97690 linux: try inotify_init if inotify_init1 returns ENOSYS
The kernel may be older than the kernel headers that libuv is compiled against.
2012-03-15 01:01:21 +01:00
okuoku
db413f3806 win: Fix MinGW32 build 2012-03-12 02:24:50 +01:00
Ben Noordhuis
71eea07a95 unix: add support for receiving UNIX sockets
Until now, all received file descriptors were reported as being UV_TCP streams:
AF_INET/AF_INET6 sockets of type SOCK_STREAM.

This commit adds support for AF_UNIX/AF_FILE sockets (UV_NAMED_PIPE in libuv
nomenclature).

Support for UV_UDP handles (AF_INET/AF_INET6 sockets of type SOCK_DGRAM) still
needs to be implemented.
2012-03-09 09:12:51 -08:00
Bert Belder
18b37d4a49 Windows: fix compiler warnings 2012-03-09 17:04:26 +01:00
Bert Belder
019118c3ab Windows: report UV_ENOTSOCK when we opened a file instead of a pipe
Makes the pipe_connect_to_file test pass on Windows.
2012-03-09 17:04:03 +01:00
Bert Belder
e99fba47c8 Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	src/win/pipe.c
	test/run-tests.c
2012-03-09 16:41:12 +01:00
Bert Belder
5d21056277 Windows: make sure that shutdown_cb is always called
This patch changes how uv-win uses the UV_SHUTTING and UV_SHUT flags.
UV_SHUT is now only used for tcp handles to track whether shutdown() has
actually been called. UV_SHUTTING has the more generic meaning of
"no longer readable". It would be good to replace it by an actual
UV_READABLE flag in the future.

This makes the shutdown_close_tcp and shutdown_close_pipe tests pass on
windows.
2012-03-09 16:31:16 +01:00
Bert Belder
95296dfa3c Windows: make the refcount tests pass 2012-03-09 16:31:15 +01:00
Bert Belder
18823270aa Windows: fix connecting a pipe in the thread pool
The code didn't function. Fixes the pipe_pound benchmarks.
2012-03-09 16:31:15 +01:00
Bert Belder
ec97ba8014 Windows uv_fs_stat: cap st_nlink to SHRT_MAX 2012-03-09 05:00:10 +01:00
Bert Belder
87752ac38b Fold trailing whitespace 2012-03-09 05:00:09 +01:00
Bert Belder
f43f1a7016 Windows: avoid uv_guess_handle crash in when fd < 0
Happens only when using a debug version of the crt.
2012-03-08 16:43:56 +01:00
Frank Denis
1c8cf617f9 windows: initialize ares handles list
We need to initialize the ares handles linked list or else bad things can happen
when we try to perform async lookups.
2012-03-08 15:12:23 +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
Frank Denis
4f1782a54b cygwin: we need to include uv-common.h for uv__set_sys_error() 2012-03-07 14:28:47 +01:00
Shigeki Ohtsu
b55801f225 win, unix: add uv_dlerror() and uv_dlerror_free() 2012-03-02 16:39:21 +01:00
Igor Zinkovsky
6bbccf1fe0 windows: return UV_ENOTSOCK when doing uv_pipe_connect to a file 2012-03-01 12:11:29 -08:00
Ben Noordhuis
b3fe183040 unix: fix fs_event refcount bug on darwin
The event loop got unref'd twice when the handle was closed.
2012-03-01 16:42:05 +01:00
Ben Noordhuis
44c9f63cb1 unix: don't rely on libev to track timer state
An obscure libev bug sometimes makes it miss state changes. Keep track of the
state ourselves.

Fixes joyent/node#2515.
2012-03-01 16:41:58 +01:00
Ben Noordhuis
0459097745 unix: fix fs_event refcount bug on darwin
The event loop got unref'd twice when the handle was closed.
2012-02-29 15:55:54 +01:00
Ben Noordhuis
2f886c892e unix: don't rely on libev to track timer state
An obscure libev bug sometimes makes it miss state changes. Keep track of the
state ourselves.

Fixes joyent/node#2515.
2012-02-28 17:24:50 +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
Igor Zinkovsky
9a5c1bad90 windows: fix time conversion in stat 2012-02-27 13:11:09 -08:00
Ben Noordhuis
57c5fa1af1 unix: fix build on iOS
_NSGetEnviron() doesn't exist on iOS, use plain `extern char **environ` instead.
2012-02-26 00:36:28 +01:00
Charlie McConnell
e99fdf0df6 win: Implement options.detached for uv_spawn() for Windows. 2012-02-24 15:15:00 +01:00
Charlie McConnell
149d32cb96 unix: Implement options.detached for uv_spawn() for unix. 2012-02-24 15:15:00 +01:00
Frank Denis
f6c8e78db9 Fix memory leak in uv_exepath() on OSX. 2012-02-24 13:09:43 +01:00
Bert Belder
fbc2154052 Merge branch 'v0.6' 2012-02-24 01:30:22 +01:00
Brandon Philips
fca18c33ac win: fs: handle EOF in read
in luvit after upgrade libuv from 243cfc to d3efef readSync started
failing.  It seems that the code cleanup stopped handling EOF

Trivially reproduced with this

    local fs = require('fs')
    print(fs.readFileSync('foo.luvit'))
2012-02-24 00:58:53 +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
09c722e72b common: make uv__set_*_error() return -1
So you can do `if (errno) return uv__set_sys_error(loop, errno);`.
2012-02-23 05:57:36 -08:00
Igor Zinkovsky
c0e7044862 windows: avoid IOCP short-circuit if non-ifs lsps are detected 2012-02-22 11:58:40 -08:00
Ben Noordhuis
e504719e17 linux: fix signedness issue in uv_exepath()
readlink() returns -1 on error. The <= 0 check failed to catch that because the
return value was implicitly cast to size_t, which is unsigned.
2012-02-21 13:26:45 +01:00
Frank Denis
75ab1ba774 linux: uclibc <0.9.32 doesn't have <ifaddrs.h>
uclibc didn't provide ifaddrs.h before version 0.9.32 It explicitly didn't
install it because (quoting) "the corresponding functionality is disabled". So,
fix libuv on uclibc < 0.9.32 by returning ENOSYS for uv_interface_addresses()
2012-02-18 00:12:45 +01:00
Bert Belder
86ebe48660 Windows: add error mappings that map to EPIPE 2012-02-16 23:58:14 +01:00
Frank Denis
372ed18986 Add more fixes for Dragonfly BSD. 2012-02-14 14:49:31 +01:00
Frank Denis
e19724912d Fix libuv on OpenBSD. struct kproc2 doesn't exist any more. 2012-02-14 14:49:31 +01:00