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
Frank Denis
783753e57f
Remove unused variables on NetBSD.
2012-02-14 14:49:31 +01:00
Ben Noordhuis
b8649fdf00
unix: don't flush tty on switch to raw mode
...
Drain, don't flush the tty when switching from cooked to raw mode. Prevents
buffered keystrokes from getting lost. Switching back to cooked mode still
flushes.
Fixes joyent/node#2744 .
2012-02-13 22:41:36 +01:00
Bert Belder
1d942e2ad4
Merge branch 'v0.6'
2012-02-13 20:02:39 +01:00
Bert Belder
bc8b99097a
win: add ERROR_FILENAME_EXCED_RANGE mapping, fix fs_file_nametoolong test
2012-02-13 20:01:36 +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
c1cea705ba
windows: map WSAETIMEDOUT to UV_ETIMEDOUT
2012-02-13 14:08:27 +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
Luis Lavena
c800043112
Add missing IPV6_HOPLIMIT definition for MinGW
...
Closes GH-307
2012-02-07 14:34:40 +01:00
Nathan Rajlich
dbc046cb7f
Add EXDEV to the errno map.
2012-02-06 21:32:16 +01:00
Ben Noordhuis
4a5f3bbd51
eio: don't use futimes() on linux
...
uclibc does not provide the syscall wrapper. Translate it into a direct utimesat
syscall if available, else fail with ENOSYS.
2012-02-06 20:35:56 +01:00
Bert Belder
443445a3c6
Windows: reset brightness when reverting to default text color
2012-02-05 19:54:26 +01:00
Maciej Małecki
e2565c332a
win: map ERROR_CANT_RESOLVE_FILENAME to UV_ENAMETOOLONG
2012-02-03 22:20:14 +01:00
Maciej Małecki
3ff3626e52
unix: map ELOOP to UV_ELOOP
2012-02-03 22:20:14 +01:00
Ben Noordhuis
2f182f4451
unix: map ECONNABORTED
2012-02-03 16:20:24 +01:00
Bert Belder
267e75dda2
Windows: better stat implementation
2012-02-02 17:03:40 +01:00
Igor Zinkovsky
495853ee2b
windows: map ERROR_ACCESS_DENIED to UV_EPERM
2012-02-01 12:38:14 -08: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
Bert Belder
3eb94e92f7
Implement udp multicast methods on windows
...
uv_udp_set_membership is not supported for UDP-IPv6 sockets yet.
2012-01-31 17:29:22 +01:00
Bert Belder
62d9360477
Windows: enable SO_REUSEADDR for datagram sockets
2012-01-31 17:29:21 +01:00
Ben Noordhuis
45d7bd88c9
unix: explain SO_REUSEADDR and SO_REUSEPORT
2012-01-31 16:52:27 +01:00
Ben Noordhuis
e34dc13496
unix: implement uv_import() and uv_export()
2012-01-30 21:44:47 +01:00
Ben Noordhuis
abdc3efffe
unix: add uv__dup()
2012-01-30 21:44:27 +01:00
Igor Zinkovsky
2ce0058251
import/export streams accross loops
2012-01-30 21:44:27 +01:00
Ben Noordhuis
cdb44df86d
unix: add UNREACHABLE() macro
...
Asserts and aborts when program flow reaches a place it shouldn't.
2012-01-30 21:44:27 +01:00
isaacs
98c0498dbc
unix: Remove assert in uv__pipe_accept
...
This assert unnecessarily prevents people from using the pipe_wrap
class in node to send file descriptors over sockets.
2012-01-30 11:28:54 -08:00
Brandon Benvie
74cff551d5
windows: fix off-by-one error in uv_fs_stat
...
uv__is_root typo caused incorrect fs.exists results in Node.
2012-01-28 16:52:44 +01:00
Ben Noordhuis
332b72e589
sunos: fix uv_udp_set_ttl and uv_udp_set_multicast_loop
...
It turns out that setsockopt(IP_TTL) *does* expect an int, whereas
setsockopt(IP_MULTICAST_LOOP) needs a char.
2012-01-28 01:19:49 +01:00
Ben Noordhuis
16124bb34e
sunos: fix uv_udp_set_ttl and uv_udp_multicast_ttl
...
The argument to setsockopt(IP_TTL|IP_MULTICAST_TTL) should be a char, not an int
like on other Unices.
2012-01-28 00:11:47 +01:00
Ben Noordhuis
3de0411591
Merge remote-tracking branch 'origin/v0.6'
2012-01-27 22:23:26 +01:00
Bert Belder
92b260c065
windows: fix stat("c:\\") regression
2012-01-27 22:09:55 +01:00
Ben Noordhuis
9c76d0d742
unix: turn on SO_REUSEPORT for UDP sockets
...
Required on BSD-like systems for local UDP multicast. Without it, the bind()
call fails with EADDRINUSE.
2012-01-27 00:49:57 +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
Bert Belder
6554954e3e
Windows: add error mapping for WSAENOBUFS
2012-01-23 20:21:56 +01:00
Brandon Benvie
3ade5f0011
Windows: Add support for interpreting axiterm-style colors.
2012-01-23 20:06:24 +01:00
Maciej Małecki
24e6c7ec86
unix: map ENAMETOOLONG to UV_ENAMETOOLONG
...
With tests. Closes #295
2012-01-23 19:33:09 +01:00
Igor Zinkovsky
edbabe6f83
windows: set error using WSAGetLastError
2012-01-22 18:00:07 -08:00
Igor Zinkovsky
726e36cf7c
implement uv_udp_set_multicast_ttl and uv_udp_set_broadcast on windows
2012-01-22 17:52:20 -08:00
Dan VerWeire
497b1ecd00
unix: add uv_udp_set_broadcast() and uv_udp_set_multicast_ttl()
2012-01-21 03:06:47 +01:00
Dan VerWeire
b674187c38
unix: set SO_REUSEADDR before binding
2012-01-21 03:06:43 +01:00
Ben Noordhuis
98f3446c43
unix: don't close kqueue fd in kqueue_fork()
...
The file descriptor is not inherited by the child process. Trying to close it is
not just useless, it's actively harmful - if the close() call succeeds, it will
have closed an altogether different file descriptor.
2012-01-19 14:48:41 +01:00
Ben Noordhuis
bf8ccfce18
unix: fix segfault in uv_guess_handle()
...
Fixes #293 .
2012-01-17 17:47:33 +01:00
Ben Noordhuis
0e6e4abedc
unix: fix udp recv_start refcount
...
Calling uv_udp_recv_start() should not bump the event loop's reference count.
Fixes failing test udp_ref2.
2012-01-14 01:44:27 +01:00
Ben Noordhuis
6d9c9a533f
Add uv_loop_refcount() function, debug tool.
2012-01-14 00:33:08 +01:00
Ben Noordhuis
a13584bec7
unix: remove unused #define
2012-01-13 15:59:53 +01:00
Ben Noordhuis
52fba1a38f
unix: fix compiler warning
2012-01-12 16:00:31 +01:00
Igor Zinkovsky
855764406e
windows: improve uv_fs_stat performance (by about 60%)
2012-01-11 19:21:47 -08:00
Ben Noordhuis
803f5a096e
linux: fix build on older distros
2012-01-09 15:43:00 +01:00
Ben Noordhuis
38fc6ad839
unix: unref fs event watcher
...
Watchers were being ref-counted twice which wasn't harmful in itself but stopped
uv_unref() from working like you'd expect it to.
2012-01-02 10:42:27 +01:00
Igor Zinkovsky
43e3ac5798
windows: uv_fs_rename to replace the new file if it exists
...
fixes #283
2011-12-30 15:48:22 -08: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
Ben Noordhuis
e9235a39f8
unix: the dl functions don't set errno
2011-12-18 16:47:06 +01:00
Ben Noordhuis
d808cf9023
linux: detect if inotify syscalls are supported
2011-12-16 15:50:27 +01:00
Ben Noordhuis
6b3075cd73
linux: improve kernel feature detection
...
Do not check for minimum kernel and glibc versions, just check that the kernel
headers export the syscall number and invoke the syscall directly. Effectively
bypasses glibc.
2011-12-16 15:16:31 +01:00
Igor Zinkovsky
a4c8ffa3c2
windows: correctly check the result of malloc
2011-12-12 19:10:11 -08:00
Igor Zinkovsky
4e99cd4e29
windows: fix memory leak when non-zero tcp reads are used
2011-12-12 12:30:12 -08:00
Shigeki Ohtsu
ba52023ef3
Fix missing increments of loop->counters
2011-12-12 18:01:26 +01:00
Ben Noordhuis
b89c31b936
unix: fix warning: return 0 in function returning void
2011-12-06 22:20:30 +01:00
Ben Noordhuis
0db3274f8a
unix: check UV_CLOSING flag in uv__write()
...
uv__write() runs after the read callbacks have fired. Said callbacks may have
closed the handle, handle that graciously.
2011-12-05 16:56:30 +01:00
Ben Noordhuis
34e95d1a4c
unix: make it safe to delete the default loop
...
Fixes a potential free() of non-malloc'ed memory.
2011-12-04 13:20:23 +01:00
Ben Noordhuis
248ca5d612
unix: translate ETIMEDOUT to UV_ETIMEDOUT
2011-12-03 23:31:02 +01:00
Igor Zinkovsky
60630dab0f
windows: enable pending pipe instances knob
2011-12-01 13:48:57 -08:00
Bert Belder
9c064fbbd2
Win: utf-8 decoder bug when compiling with gcc
2011-12-01 22:45:58 +01:00
Bert Belder
2a6a4a0864
Fix MinGW and MinGW-w64 builds
2011-12-01 22:45:40 +01:00
Yuki Okumura
f71f5a02e6
Win: lower case tlhelp32.h to support cross compilation
2011-12-01 22:42:35 +01:00
Igor Zinkovsky
dceb3e65ca
uv_cwd + uv_chdir
2011-12-01 12:27:12 -08:00
Bruce Mitchener
d513d9bb41
Fix typos.
2011-11-30 14:35:13 +01:00
Bert Belder
fce90652ed
Windows: avoid the loop starvation bug. Closes GH-154
2011-11-28 19:36:41 +01:00
Bert Belder
01f64f6612
Win: get rid of UV_EAINONAME, use UV_ENOENT instead
2011-11-25 10:11:29 +01:00
Bert Belder
b4698d414b
Strip trailing whitespace
2011-11-25 10:03:27 +01:00
Igor Zinkovsky
cfa4112950
windows: make uv_fs_stat use open + fstat to support long paths
2011-11-24 19:18:17 -08:00
Bert Belder
3a50f8fca0
Win: fix uv_getaddrinfo error reporting
2011-11-25 02:05:07 +01:00
Bert Belder
45b976abd9
Win: add mapping for ERROR_ACCESS_DENIED
2011-11-25 00:59:40 +01:00
Bert Belder
ea63f06987
Win: ignore ECONNRESET when receiving udp packets
2011-11-24 19:16:24 +01:00
Bert Belder
261d792a7a
Win: map STATUS_HOPLIMIT_EXCEEDED status to WSAECONNRESET error
2011-11-24 19:16:18 +01:00
Bert Belder
0ded5d29cd
Win: fix improper treatment of real ntstatus codes as mapped win32 errors
2011-11-24 19:16:12 +01:00
Ben Noordhuis
96c230344d
linux: fix build when compiling with -std=c89 -pedantic
2011-11-23 19:05:46 +01:00
Ben Noordhuis
92c9e95721
unix: fix stray pointer free() when HAVE_FUTIMES=0
...
uv_fs_futime() failed to initialize req.path when HAVE_FUTIMES=0.
uv_fs_req_cleanup() later on tried to free the bogus pointer.
2011-11-22 00:00:52 +01:00
Shimon Doodkin
1b9d00fb42
cygwin: fix undefined _SC_PAGESIZE
...
unistd.h was not included, when tried to build node 0.5.9 had an error of:
_SC_PAGESIZE undefined
2011-11-20 15:02:16 +01:00
Ben Noordhuis
2bd181a8d2
unix: properly disarm kqueue fs watcher
...
Fixes "Assertion failed: (revents == EV_LIBUV_KQUEUE_HACK),
function uv__fs_event, file ../src/unix/kqueue.c, line 58."
2011-11-18 01:40:11 +01:00
Igor Zinkovsky
08a5546753
windows: return UV_FILE for non-console FILE_TYPE_CHAR
2011-11-17 15:36:34 -08:00
Ryan Dahl
2007eb813d
Set uv_write_t errno correctly
...
Fixes #206 .
2011-11-16 13:02:18 -08:00
Frank Denis
89ea3be6c2
Add support for DragonFly BSD by sharing code for FreeBSD.
2011-11-13 19:46:24 +01:00
Frank Denis
93faeb2189
Fix typo that broke libuv on NetBSD: psysconf() -> sysconf()
2011-11-13 19:42:57 +01:00
Ben Noordhuis
224584c53e
sunos: check that event ports supports fs watching
2011-11-10 20:04:55 +01:00
Ben Noordhuis
26806e2b1c
sunos: add getaddrinfo() compatibility hack
...
getaddrinfo() returns EAI_MEMORY if strlen(hostname) >= MAXHOSTNAMELEN
2011-11-10 16:39:03 +00:00
Ben Noordhuis
04dfd46349
unix: remove unused uv__translate_lib_error() function
2011-11-10 15:26:12 +00:00
Ben Noordhuis
61ef8cc962
freebsd: remove unused variables
2011-11-10 13:57:58 +01:00
Ryan Dahl
808bb8ed0b
Shared uv_strerror
2011-11-09 18:06:49 -08:00
Ryan Dahl
fd2b04d784
Alternative errno strategy
2011-11-09 17:47:24 -08:00
Igor Zinkovsky
f17d4837a8
windows: turn WSAECONNABORTED from WSARecv to UV_ECONNRESET
2011-11-09 14:57:41 -08:00
Ben Noordhuis
4794c12f58
linux: fall back to traditional syscalls if necessary
...
libuv uses feature checks to determine if newer syscalls like pipe2() are
available. This works fine until someone compiles libuv against kernel headers
that are newer than the actual kernel our software runs on.
Fall back to traditional (but race-y!) syscalls when the kernel reports ENOSYS
or EINVAL.
2011-11-09 15:38:51 +01:00
Igor Zinkovsky
942c68b80e
windows: fix utf16->utf8 conversion in uv_fs_readdir
2011-11-08 19:23:30 -08:00
Ryan Dahl
196e14528f
Map UV_ESRCH in uv_err_name
2011-11-08 16:59:05 -08:00
Bert Belder
2b7774ae49
Windows: return UV_ESRCH from uv_kill
2011-11-09 01:48:04 +01:00
Tj Holowaychuk
a378110f9e
Add UV_ESRCH
...
Fixes #239 .
2011-11-08 16:36:20 -08:00