Commit Graph

4148 Commits

Author SHA1 Message Date
Bart Robinson
d38edefc73 doc: fix confusing doc of uv_tcp_nodelay
Previous description implied enabling nodelay enabled Nagle, but it is
the other way around.

PR-URL: https://github.com/libuv/libuv/pull/1050
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-09-15 10:38:34 +02:00
Ben Noordhuis
e7bc260c42 unix: don't use alphasort in uv_fs_scandir()
alphasort() uses strcoll() in some libcs (notably glibc and musl) which
makes it locale-sensitive.

Replace it with a simple strcmp-based lexicographic comparison for
consistent behavior across platforms.

Remove the special-casing for OpenBSD.  It has been exporting function
prototypes conforming to POSIX.1-2008 since OpenBSD 5.3 and that was
released more than three years ago.

OS X 10.7 is now the only special case left.

Fixes: https://github.com/libuv/libuv/issues/1045
PR-URL: https://github.com/libuv/libuv/pull/1046
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-09-12 15:50:58 +02:00
Santiago Gimeno
29138058a5 test: fix fs_event_watch_dir flakiness on arm
Increase the time between file creations, so all the events are
emitted.

PR-URL: https://github.com/libuv/libuv/pull/1038
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-12 08:33:44 +02:00
Santiago Gimeno
6d7d57a983 test: fix test-tcp-writealot flakiness on arm
Decrease the data sent for `arm` so the test doesn't timeout in the arm
CI bots.

PR-URL: https://github.com/libuv/libuv/pull/1038
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-12 08:33:41 +02:00
Imran Iqbal
30d852f9e0
doc: update supported fields for uv_rusage_t
Fixes: https://github.com/libuv/libuv/issues/342
PR-URL: https://github.com/libuv/libuv/pull/1041
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-11 17:04:39 -04:00
Santiago Gimeno
0d7f72f219 fs: fix uv_fs_fstat on platforms using musl libc
In `musl` libc, defining `_GNU_SOURCE` doesn't automatically define the
other feature definitions, causing that `uv_fs_fstat` would not fill the
`nsec` fields. For the same reason, compile the tests on linux with
`-D_GNU_SOURCE` so the `fs_fstat` tests passes on `musl` platforms.

PR-URL: https://github.com/libuv/libuv/pull/1039
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-09-10 10:28:14 +02:00
Saúl Ibarra Corretgé
bf0301c33c doc: improve documentation on uv_alloc_cb
Refs: https://github.com/libuv/libuv/issues/1027#issuecomment-244386298
PR-URL: https://github.com/libuv/libuv/pull/1033
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-09-07 22:09:17 +02:00
Saúl Ibarra Corretgé
f046ebb409 doc: uv_buf_t members are not readonly
This is probably a reminiscent of the usage in libuv 0.x, where alloc_cb
used to return a uv_buf_t.

Refs: https://github.com/libuv/libuv/issues/1027#issuecomment-244386298
PR-URL: https://github.com/libuv/libuv/pull/1033
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-09-07 22:07:11 +02:00
Saúl Ibarra Corretgé
2112e7a67c test: fix building pty test on Android
Fixes: https://github.com/libuv/libuv/issues/1029
PR-URL: https://github.com/libuv/libuv/pull/1030
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-09-05 10:11:13 +02:00
Santiago Gimeno
4a71e7747a test: improve spawn_setuid_setgid test
Check that the child process' uid and gid are correctly set.

PR-URL: https://github.com/libuv/libuv/pull/1024
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-03 10:16:59 +02:00
Saúl Ibarra Corretgé
6938f6b0bd doc: document uv_fs_realpath caveats
Fixes: https://github.com/libuv/libuv/issues/1017
PR-URL: https://github.com/libuv/libuv/pull/1026
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
2016-09-02 09:57:25 +02:00
Imran Iqbal
a7dfee3b02
win: add disk read/write count to uv_getrusage
Refs: https://github.com/libuv/libuv/issues/342
PR-URL: https://github.com/libuv/libuv/pull/1023
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-30 16:21:44 -04:00
Santiago Gimeno
897738b160
test: use RETURN_SKIP in spawn_setuid_setgid test
PR-URL: https://github.com/libuv/libuv/pull/1021
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-30 01:32:24 -04:00
Saúl Ibarra Corretgé
5d96277834 unix: always define pthread barrier fallback pad
Fixes: https://github.com/libuv/libuv/issues/1019
PR-URL: https://github.com/libuv/libuv/pull/1020
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-27 11:06:19 +02:00
Saúl Ibarra Corretgé
0895ccfc8c win: fix typo in type name
Introduced in 58ccfd4c21, reviewed by
yours truly :-(

PR-URL: https://github.com/libuv/libuv/pull/1018
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-08-26 18:03:52 +01:00
Santiago Gimeno
ee11177006 doc: add santigimeno to maintainers
PR-URL: https://github.com/libuv/libuv/pull/1016
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-26 12:45:54 +02:00
Imran Iqbal
58ccfd4c21
win,tty: add support for ANSI codes in win10 v1511
PR-URL: https://github.com/libuv/libuv/pull/889
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-25 20:17:16 -04:00
John Barboza
afc93d1ed6 unix: unneccessary use const qualifier in container_of
The type parameter in the "container_of(ptr, type, member)" macro
which uses builtin "offsetof(type, member)" should not require cv
qualifier. Also note that for some platforms, the "offsetof" builtin
does not recognize the cv qualifier in the type.

PR-URL: https://github.com/libuv/libuv/pull/948
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-25 22:45:33 +01:00
John Barboza
9e641d251f zos: implement uv__io_check_fd
This method uses the poll syscall to determine whether POLLNVAL is
flagged or not.

PR-URL: https://github.com/libuv/libuv/pull/957
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-25 13:04:04 +01:00
Julien Gilli
ad20b96a8f test: refactor fs_event_close_in_callback
This change refactors the `fs_event_close_in_callback` test so that:

1. It creates directory entries instead of modifying them. This allows
the test to work on operating systems that use event ports to handle fs
events (e.g SmartOS and Solaris). When using event ports, watching
only a directory does not allow to receive events for files modified
within that directory, but events will be received for files _created_
within that directory.

2. it generates fs events _after_ the process entered the libuv event
loop. This is also needed to make the test work on operating systems
that use event ports to handle fs events (e.g SmartOS and Solaris),
because events are polled as part of running the event loop. That also
makes the test work on systems based on Kqueue and on AIX.

Fixes: https://github.com/libuv/libuv/pull/808
PR-URL: https://github.com/libuv/libuv/pull/1011
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-25 10:12:49 +01:00
Santiago Gimeno
282dc7bc22 test: improve tap output on test failures
Print `errmsg` on TAP output. After making the TAP output the default,
the info in `errmsg` was not being used anymore.

PR-URL: https://github.com/libuv/libuv/pull/1012
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-24 10:47:14 +01:00
John Barboza
f4ef897666 zos: track unbound handles and bind before listen
On zOS the listen call does not bind automatically if the socket
is unbound. Hence the manual binding to an arbitrary port is
required to be done manually.

PR-URL: https://github.com/libuv/libuv/pull/949
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-24 10:02:41 +01:00
John Barboza
e37f25d776 unix: expand range of values for usleep
uv_sleep uses only usleep which can only take integers in the
range [0,1000000]. Avoid using boundary parameters such as 1000000
for portability reasons. Use sleep and usleep together to expand
the acceptable range of values for uv_sleep.

PR-URL: https://github.com/libuv/libuv/pull/950
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-24 09:58:49 +01:00
John Barboza
404025721f zos: implement uv__fs_futime
We do this using __fchattr syscall to change file attributes.

PR-URL: https://github.com/libuv/libuv/pull/956
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-24 09:56:24 +01:00
John Barboza
00c0ff149d zos: use pthread helper functions
zOS does not implement some pthread_barrier functions. So we will use
the provided helper functions in src/unix/pthread*.

PR-URL: https://github.com/libuv/libuv/pull/954
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-24 09:50:54 +01:00
John Barboza
841edfcd40 zos: use PLO instruction for atomic operations
Use builtins provided that perform compare and swap operations
using the PLO instruction.

PR-URL: https://github.com/libuv/libuv/pull/1008
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-24 09:47:57 +01:00
Jeffrey Clark
0a4b51fcb4 build: GNU/kFreeBSD support
autotools support only, gvp does not support kfreebsd detection.

PR-URL: https://github.com/libuv/libuv/pull/960
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-20 08:55:30 +02:00
Matt Clarkson
e5c93a1589 build: use '${prefix}' for pkg-config 'exec_prefix'
This follows common pkg-config configuration files and allows for certain
pkg-config overrides to work. For example, when cross-compiling it is common to
have to set a different pkg-config prefix through either '--define-prefix' or a
'PKG_CONFIG_LIBUV_PREFIX' environment variable. If the 'exec_prefix' is
hardcoded to '@prefix@' then it will not pick up those pkg-config overrides.

PR-URL: https://github.com/libuv/libuv/pull/993
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-19 02:00:16 +02:00
Saúl Ibarra Corretgé
e994000834 test: make tcp_close_while_connecting more resilient
It's not impossible for connect() to succeed before the handle is fully
closed, so handle that case too.

PR-URL: https://github.com/libuv/libuv/pull/1005
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-19 00:54:42 +01:00
John Barboza
1cff5b7557 zos: add support for new platform
- zos: disable test cases not applicable
- zos: build options
- zos: semaphore implementation
- zos: use compare and swap builtins
- zos: struct rusage not the same as other platforms
- zos: backlog<=0 produces undefined behaviour
    Will redefine backlog in the following way
    * if backlog == 0, set it to 1
    * if backlog < 0, set it to SOMAXCONN
- zos: define IMAXBEL as empty flag and implement uv__tty_make_raw
- zos: use udp multicast operations from aix
- zos: ESC in ebcdic
- zos: use LIBPATH for dynamic linker path
- zos: uv_udp_set_ttl only works for ipv6
- zos: increase pthread stack size by factor of 4
- zos: return ENODEV instead of ENXIO errors for setsockopt
- zos: use uv_cond_init the same way as aix
- test: enable oob test for zos
- zos: return EINVAL for zos error code EOPNOTSUPP

PR-URL: https://github.com/libuv/libuv/pull/937
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-19 01:34:29 +02:00
Saúl Ibarra Corretgé
d796bedf5b unix,win: make on_alloc_cb failures more resilient
Treat both the base being NULL or the length being 0 as ENOBUFS.

PR-URL: https://github.com/libuv/libuv/pull/997
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-17 09:57:55 +02:00
Jason Ginchereau
7ae4b1ad7f win: fix lstat reparse point without link data
Fixes: https://github.com/libuv/libuv/issues/995
Fixes: https://github.com/nodejs/node/issues/5160
PR-URL: https://github.com/libuv/libuv/pull/996
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-16 09:58:58 +01:00
Saúl Ibarra Corretgé
be0e24c1e8 doc: add supported platforms description
Closes: https://github.com/libuv/libuv/issues/983
PR-URL: https://github.com/libuv/libuv/pull/991
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-12 22:48:06 +01:00
Bartosz Sosnowski
6fa3524ea7 win: evaluate timers when system wakes up
When Windows resumes after sleep GetQueuedCompletionStatus timeout is
not updated. This commit adds a method for signaling all loops to
wake up and update their timers.

Fixes: https://github.com/nodejs/node/issues/6763
PR-URL: https://github.com/libuv/libuv/pull/962
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-12 11:27:37 +01:00
sunjin.lee
791c817891 test: fix android build error.
Do not compile 'tty_pty' test for android.

PR-URL: https://github.com/libuv/libuv/pull/975
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-11 10:39:43 -04:00
Saúl Ibarra Corretgé
63ab64144e test: don't close CRT fd handed off to uv_pipe_t
After 4ed29c2498 got fixed, when a CRT fd
is handed off to a pipe handle using uv_pipe_open libuv will close it
properly, so it's an error to do so ourselves.

PR-URL: https://github.com/libuv/libuv/pull/992
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-11 09:33:43 +01:00
Saúl Ibarra Corretgé
a6acc82245 test: fix OOB buffer access
The test uses an annonymous pipe, which means the returned length will
be 0.

Fixes: https://github.com/libuv/libuv/issues/376
Fixes: https://github.com/libuv/libuv/issues/529
Refs: https://github.com/libuv/libuv/issues/264
PR-URL: https://github.com/libuv/libuv/pull/981
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-09 13:14:45 +01:00
Ben Noordhuis
39ee4121a1 darwin: handle EINTR in /dev/tty workaround
On OS X, special files like /dev/null and /dev/tty don't work with
kqueue.  Libuv falls back to select() in that case but the initial
probe didn't handle EINTR.

Introduced in August 2012 in commit 731adaca ("unix: use select()
for specific fds on OS X"), this bug was only ten days away from
celebrating its fourth birthday.

PR-URL: https://github.com/libuv/libuv/pull/979
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-06 10:27:26 +02:00
Matej Knopp
7b07d18ad9 win: ensure 32-bit printf precision
This commit removes a printf warning by casting a 64-bit
value to 32 bits.

Fixes: https://github.com/libuv/libuv/issues/955
PR-URL: https://github.com/libuv/libuv/pull/963
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-04 11:31:22 -04:00
Bartosz Sosnowski
fc8cc42e8f win: fix compilation on mingw
Adds missing define for UNLEN.

PR-URL: https://github.com/libuv/libuv/pull/968
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-04 12:33:06 +01:00
Ben Noordhuis
f614b43a69 win: simplify memory copy logic in fs.c
Hopefully shuts up a -Wmaybe-uninitialized warning about the path_len
variable.

Fixes: https://github.com/libuv/libuv/issues/941
PR-URL: https://github.com/libuv/libuv/pull/942
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-07-30 10:51:07 +02:00
Ben Noordhuis
ef6f3e8e8d win: return UV_EINVAL on bad uv_tty_mode mode arg
Fixes: https://github.com/libuv/libuv/issues/941
PR-URL: https://github.com/libuv/libuv/pull/942
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-07-30 10:50:29 +02:00
Ben Noordhuis
ff0ae10496 unix: preserve loop->data across loop init/done
Libuv leaves loop->data unchanged in uv_loop_init() and uv_loop_done()
on Windows but it clobbered it on UNIX platforms.  This commit fixes
that inconsistency.

PR-URL: https://github.com/libuv/libuv/pull/951
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-07-30 10:49:19 +02:00
Michele Caini
f001a67e1d doc: add missing entry in uv_fs_type enum
PR-URL: https://github.com/libuv/libuv/pull/958
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-07-28 12:47:56 +01:00
liuxiaobo
3a4f2d3155 unix: fix errno and retval conflict
We not only check the return value, but also check the errno != 0.
Because in rare cases connect() will return -1 but the errno
is 0 (for example, on Android 4.3, OnePlus phone A0001_12_150227)
and actually the tcp three-way handshake is completed.

PR-URL: https://github.com/libuv/libuv/pull/936
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-07-18 10:28:48 +01:00
John Barboza
00dab91ce5 test: account for multiple handles in one ipc read
PR-URL: https://github.com/libuv/libuv/pull/940
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-07-18 10:26:04 +01:00
John Barboza
4b58985370 test: close server before initiating new connection
PR-URL: https://github.com/libuv/libuv/pull/944
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-07-18 10:22:36 +01:00
cjihrig
840a8c599e unix,win: make uv_get_process_title() stricter
This commit causes uv_get_process_title() to:
 - return EINVAL if the buffer is null or size is 0
 - return ENOBUFS if the title is too big for the buffer
 - null terminate the buffer on success

Fixes: https://github.com/libuv/libuv/issues/315
PR-URL: https://github.com/libuv/libuv/pull/928
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-07-14 09:47:23 -04:00
Ben Noordhuis
70002c80bf linux: fix potential event loop stall
It was pointed out[0] that libuv could effectively enter an infinite
loop (but not a busy loop) under certain conditions when polling for
events:

1. When the architecture is 32 bits, and
2. When timeout > 0, i.e., finite, and
3. When timeout > max_safe_timeout (~30 minutes), and
4. When epoll_wait(timeout) returns 0, then
5. timeout was not properly updated on the next call to epoll_wait().

Inspection of the code uncovered a secondary bug where under a similar
set of circumstances the timeout could drift when the epoll_wait()
system call returned late.

[0] https://github.com/libuv/libuv/pull/354#discussion_r67837112

PR-URL: https://github.com/libuv/libuv/pull/922
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-07-04 19:10:12 +02:00
neevek
1d27bbbb8d doc: add a note on safe reuse of uv_write_t
uv_write_t can be reused safely only after the callback passed to
uv_write is fired.

PR-URL: https://github.com/libuv/libuv/pull/927
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-06-28 10:15:13 -04:00