Commit Graph

2922 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
df8ab507a0 fs: extend reported types in uv_fs_readdir_next
Support all possible types on Unix, and files, directories and links on
Windows. Some systems (hello SunOS!) don't have the d_type field on struct
dirent, so mark them as UV_DIRENT_UNKNOWN.
2014-08-15 16:44:44 +02:00
Fedor Indutny
ab2c4425a5 fs: introduce uv_readdir_next() and report types
Introduce:

    int uv_fs_readdir_next(uv_fs_t* req, uv_dirent_t* ent);

`uv_fs_readdir()` is not returning a file names list in `req->ptr`
anymore, the proper way to gather them is to call `uv_fs_readdir_next()`
in a callback.
2014-08-14 17:19:45 +04:00
Alexis Campailla
7bdcf3dc7e windows: fix GetNameInfoW error handling
GetNameInfoW return non-zero on error, and not vice versa.
2014-08-12 17:42:34 +02:00
Pavel Platto
a669f21bf8 windows: use OpenBSD implementation for uv_fs_mkdtemp 2014-08-12 10:04:09 +02:00
Andrius Bentkus
875814adc5 unix: replace some asserts with returning errors 2014-08-11 18:42:48 +02:00
Saúl Ibarra Corretgé
b53aeb491a windows: replace use of inet_addr with uv_inet_pton
Fixes a compilation warning with Visual Studio 2013.
2014-08-11 09:52:48 +02:00
Leonard Hecker
4c90cc8e14 unix: fix typedef of uv_buf_t
Typedefs of unnamed structs cannot be forward declared.
Giving the uv_buf_t struct a name makes forward declarations possible.
2014-08-10 17:30:13 +02:00
huxingyi
ca4741b4a5 windows: fix build on MinGW 2014-08-10 12:09:04 +02:00
Saúl Ibarra Corretgé
09cb5b534e test: fix spawn_reads_child_path when using autoconf
Don't hardcode the name of the executable, take it from the exepath.

Fixes #1407
2014-08-10 11:25:28 +02:00
Saúl Ibarra Corretgé
84ed98e88e test: skip UDP dualstack test on BSDs
As of right now Linux comes with bindv6only=0 by default but BSDs use
bindv6only=1. It can be changed systemwide with sysctl, but it's not
nice to depend on the environment for running tests, so disable it just
on BSDs.
2014-08-10 11:04:42 +02:00
Saúl Ibarra Corretgé
94c7a13f0a test: fix udp_multicast_interface6 on FreeBSD 2014-08-10 10:39:58 +02:00
Paul Goldsmith
ac879ed8f8 windows: add support for UNC paths on uv_spawn 2014-08-10 10:14:42 +02:00
Andrius Bentkus
0ecee213ea unix, windows: add uv_recv_buffer_size and uv_send_buffer_size 2014-08-09 11:36:35 +02:00
Saúl Ibarra Corretgé
4dc0d81ccb netbsd: fix build
Thanks @ezra1!

Closes #1391
2014-08-09 11:22:41 +02:00
Alexis Campailla
c87c44fff3 windows: fix uv__getaddrinfo_translate_error
Use Windows socket error codes, as recommended by MSDN, like we already
do with GetNameInfoW.
2014-08-09 11:18:26 +02:00
Jameson Nash
837c62c71b windows: make uv_read_stop immediately stop reading
This implements locking around the blocking call to ReadFile to get
around a Windows kernel bug where a blocking ReadFile operation on a
stream can deadlock the thread. This allows uv_read_stop to immediately
cancel a pending IO operation, and allows uv_pipe_getsockname to
"pause" any pending read (from libuv) while it retrieves the
sockname information.

If unsupported by the OS (pre-Vista), this reverts to the old
(e.g. deadlock-prone) behavior

Closes #1313
2014-08-09 11:10:57 +02:00
Saúl Ibarra Corretgé
02e1ebd40b include: remove unneeded EADDRINFO errno
EADDRINFO is not a readl errno, it was used to signal any error that
getaddrinfo would return, but we return actual errors now.
2014-08-07 21:24:55 +02:00
Saúl Ibarra Corretgé
a9a4872c29 Now working on v0.11.29 2014-08-07 12:21:41 +02:00
Saúl Ibarra Corretgé
fc9e2a0bc4 2014.08.08, Version 0.11.28 (Unstable)
Changes since version 0.11.27:

* unix, windows: const-ify handle in uv_udp_getsockname (Rasmus
  Pedersen)

* windows: use UV_ECANCELED for aborted TCP writes (Saúl Ibarra
  Corretgé)

* windows: add more required environment variables (Jameson Nash)

* windows: sort environment variables before calling CreateProcess
  (Jameson Nash)

* unix, windows: move uv_loop_close out of assert (John Firebaugh)

* windows: fix buffer overflow on uv__getnameinfo_work() (lilohuang)

* windows: add uv_backend_timeout (Jameson Nash)

* test: disable tcp_close_accept on Windows (Saúl Ibarra Corretgé)

* windows: read the PATH env var of the child (Alex Crichton)

* include: avoid using C++ 'template' reserved word (Iñaki Baz Castillo)

* include: fix version number (Saúl Ibarra Corretgé)
2014-08-07 12:18:10 +02:00
Saúl Ibarra Corretgé
6bcb799a0d include: fix version number 2014-08-07 12:17:06 +02:00
Iñaki Baz Castillo
a1ff22cb7e include: avoid using C++ 'template' reserved word
Closes #1394
2014-08-06 12:52:46 +02:00
Alex Crichton
c7e4b31444 windows: read the PATH env var of the child
The unix and windows process implementations diverge in their behavior
when dealing with subprocesses that are spawned with a relative path.
With unix the *child's* PATH environment variable is read, whereas
with windows the *parent's* environment variable is read.

This commit brings the two implementation in line with respect to
their behavior of reading PATH by having both read the *child's* PATH
environment variable. This involves looking into the user-provided
environment on windows and extracting the PATH variable specifically
so it can be inspected later on.
2014-08-06 02:12:44 +02:00
Saúl Ibarra Corretgé
d802486232 test: disable tcp_close_accept on Windows
It always was a Unix only test
2014-08-05 00:14:26 +02:00
Jameson Nash
2e9d86e105 windows: add uv_backend_timeout 2014-08-04 23:18:38 +02:00
lilohuang
89fc7d80c4 windows: fix buffer overflow on uv__getnameinfo_work()
According to
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738531.aspx,
"NodeBufferSize" and "ServiceBufferSize" parameters of GetNameInfoW()
function are expected to represent the number of WCHAR, not the buffer size
of memory layout.
2014-08-04 09:18:51 +02:00
John Firebaugh
2cd91f9768 unix, windows: move uv_loop_close out of assert
Closes #1387
2014-08-02 09:41:09 +02:00
Jameson Nash
8db42383ad windows: sort environment variables before calling CreateProcess 2014-08-01 09:26:21 +02:00
Jameson Nash
2ce14cfab4 windows: add more required environment variables
Adds more of the undocumented-but-required environment variables for uv_spawn
2014-08-01 09:26:21 +02:00
Saúl Ibarra Corretgé
431b535a51 windows: use UV_ECANCELED for aborted TCP writes
For consistency with Unix
2014-08-01 00:23:51 +02:00
Rasmus Christian Pedersen
e72d48ddab unix, windows: const-ify handle in uv_udp_getsockname 2014-07-31 22:27:36 +02:00
Timothy J Fontaine
ff6a718dfc Now working on v0.11.28 2014-07-31 10:11:03 -07:00
Timothy J Fontaine
ffe24f9550 2014.07.32, Version 0.11.27 (Unstable)
Changes since version 0.11.26:

* unix, windows: use the same threadpool implementation (Saúl Ibarra
  Corretgé)

* unix: use struct sockaddr_storage for target UDP addr (Saúl Ibarra
  Corretgé)

* doc: add documentation to uv_udp_start_recv (Andrius Bentkus)

* common: use common uv__count_bufs code (Andrius Bentkus)

* unix, win: add send_queue_size and send_queue_count to uv_udp_t
  (Andrius Bentkus)

* unix, win: add uv_udp_try_send (Andrius Bentkus)

* unix: return UV_EAGAIN if uv_try_write cannot write any data (Saúl
  Ibarra Corretgé)

* windows: fix compatibility with cygwin pipes (Jameson Nash)

* windows: count queued bytes even if request completed immediately
  (Saúl Ibarra Corretgé)

* windows: disable CRT debug handler on MinGW32 (Saúl Ibarra Corretgé)

* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé)

* unix: try to write immediately in uv_udp_send (Saúl Ibarra Corretgé)

* unix: remove incorrect assert (Saúl Ibarra Corretgé)

* openbsd: avoid requiring privileges for uv_resident_set_memory (Aaron
  Bieber)

* unix: guarantee write queue cb execution order in streams (Andrius
  Bentkus)

* img: add logo files (Saúl Ibarra Corretgé)

* aix: improve AIX compatibility (Andrew Low)

* windows: return bind error immediately when implicitly binding (Saúl
  Ibarra Corretgé)

* windows: don't use atexit for cleaning up the threadpool (Saúl Ibarra
  Corretgé)

* windows: destroy work queue elements when colsing a loop (Saúl Ibarra
  Corretgé)

* unix, windows: add uv_fs_mkdtemp (Pavel Platto)

* build: handle platforms without multiprocessing.synchronize (Saúl
  Ibarra Corretgé)

* windows: change GENERIC_ALL to GENERIC_WRITE in fs__create_junction
  (Tony Kelman)

* windows: relay TCP bind errors via ipc (Alexis Campailla)
2014-07-31 10:11:01 -07:00
Alexis Campailla
6d3a051eb4 windows: relay TCP bind errors via ipc
This is the libuv side of the fix for Node's cluster module on Windows.
https://github.com/joyent/node/issues/7691

Windows and Unix return certain socket errors (i.e. EADDRINUSE) at
different times: bind on Windows, and listen on Unix.
In an effort to hide this difference, libuv on Windows stores such
errors in the bind_error field of uv_tcp_t, to defer raising it at
listen time.
This worked fine except for the case in which a socket is shared in
a Node cluster and a bind error occurs.

A previous attempt to fix this (
d1e6be1460
3da36fe00e
) was flawed becaused in an attempt to relay the error at the JS level
it caused the master to start accepting connections.

With this new approach, libuv itself is relaying the bind errors,
providing for a uniform behavior of uv_tcp_listen.
2014-07-31 17:24:40 +02:00
Tony Kelman
3d73d55627 windows: change GENERIC_ALL to GENERIC_WRITE in fs__create_junction
Fixes #1385

See ReactOS's mklink implementation and
http://stackoverflow.com/a/10508724
2014-07-31 14:39:26 +02:00
Saúl Ibarra Corretgé
c11a598d7c build: handle platforms without multiprocessing.synchronize 2014-07-31 10:12:58 +02:00
Pavel Platto
e99b89f2ad unix, windows: add uv_fs_mkdtemp 2014-07-31 09:43:55 +02:00
Saúl Ibarra Corretgé
beb54fe72d windows: destroy work queue elements when colsing a loop
Destroy the async handle used to notify about work being done, and the
mutex used to protect each loop's work queue.

Closes #1375
2014-07-28 09:40:23 +02:00
Saúl Ibarra Corretgé
c8abb29f68 windows: don't use atexit for cleaning up the threadpool
If libuv is loaded as a DLL and is later unloaded deadlocks can happen
when running atexit handlers, so we can't use synchronization
priomitives or join threads there.

For reference see https://github.com/saghul/pyuv/issues/171
2014-07-28 09:38:57 +02:00
Saúl Ibarra Corretgé
645e2a2855 doc: update link to pyuv in README 2014-07-27 12:33:02 +02:00
Saúl Ibarra Corretgé
1ece8fb85f windows: return bind error immediately when implicitly binding
If a TCP handle is bound automatically when calling uv_listen or
uv_connect, there is a remote possibility that it fails, return
the error if so.
2014-07-25 12:48:16 +02:00
Andrew Low
cdc979dbe0 aix: improve AIX compatibility 2014-07-22 22:57:24 +02:00
Saúl Ibarra Corretgé
06c60e9662 doc: add logo image to README 2014-07-20 19:38:46 +02:00
Saúl Ibarra Corretgé
a499b737bf img: add logo files 2014-07-20 18:24:28 +02:00
Andrius Bentkus
960eefb319 unix: guarantee write queue cb execution order in streams
The problem was that the canceled write callbacks
were being called before the already written callbacks, even
though they were queued after them.
2014-07-18 13:16:10 +02:00
Aaron Bieber
38323c9fbf openbsd: avoid requiring privileges for uv_resident_set_memory 2014-07-16 09:56:34 +02:00
Graham Lee
dc1ea27c73 doc: clarify the return value of uv_default_loop 2014-07-13 11:23:08 +02:00
Saúl Ibarra Corretgé
817c09257d unix: remove incorrect assert
After 41891222bc landed it's possible that uv__udp_sendmsg is called
even if there are no pending write nor write completed requests:

1. User calls uv_udp_send and the request is sent immediately. The
   request is the added to the completed queue and we 'feed' the uv__io
   handle so that we process the completed request in the next
   iteration.
2. User calls uv_udp_send again but the request is not completed
   immediately, so it's queued in the write_queue.
3. The uv__io handle gets a UV__POLLOUT event and uv__udp_sendmsg is
   run, which completes the send request and puts it in the
   write_completed_queue. Afterwards, uv__udp_run_completed is executed
   and the write_completed queue is drained.
4. At this point, the uv__io handle was made pending in step 3, in
   uv__udp_sendmsg, but we no longer have requests to write or to complete,
   so we skip processing.
2014-07-11 22:53:59 +02:00
Saúl Ibarra Corretgé
9e921ed1e5 doc: clarify why we don't use SO_REUSEADDR for TCP on Windows 2014-07-08 18:57:35 +02:00
Saúl Ibarra Corretgé
ad78e456e9 test: fix watcher_cross_stop
It's possible that recv_cb_called is bigger than the number of sockets,
because if all sends succeed the recv callback is called twice: once
with the actual data, and another time with 0.
2014-07-08 18:44:38 +02:00
Saúl Ibarra Corretgé
41891222bc unix: try to write immediately in uv_udp_send 2014-07-08 18:44:38 +02:00