Commit Graph

3613 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
805391bfaa doc: update supported platforms
PR-URL: https://github.com/libuv/libuv/pull/1001
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-18 12:50:28 +02:00
Saúl Ibarra Corretgé
54a501897f Merge branch 'v1.x' into merge 2016-08-18 09:31:26 +02:00
Saúl Ibarra Corretgé
ee949df1cb build,win: remove MinGW Makefile
MSYS2 + MinGW-w64 have good support for autoconf, that should be the
preferred way of building libuv under MinGW.

PR-URL: https://github.com/libuv/libuv/pull/1000
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-18 00:02:51 +01: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é
d527ab90f4 core: switch to C99
PR-URL: https://github.com/libuv/libuv/pull/994
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-12 23:10:34 +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
Saúl Ibarra Corretgé
ea13b6a99e win: remove no longer needed define
PR-URL: https://github.com/libuv/libuv/pull/990
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-11 22:57:10 +01:00
Saúl Ibarra Corretgé
db83ffe3b4 win: fix compilation warning
-Wdeclaration-after-statement

PR-URL: https://github.com/libuv/libuv/pull/990
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-11 22:56:50 +01:00
Saúl Ibarra Corretgé
250eaf4399 Revert "win,tty: remove no longer needed workaround"
This reverts commit 7892bd6f76.

The reasoning for the original patch was flawed. On x86 systems
_InterlockedOr intrinsic must be used. MinGW also exposes the problem,
so reverting this gets rid of a warning.

PR-URL: https://github.com/libuv/libuv/pull/990
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-11 22:56:23 +01:00
Saúl Ibarra Corretgé
6947328d6b win: remove types already defined in MinGW-w64
PR-URL: https://github.com/libuv/libuv/pull/990
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-11 22:55:28 +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é
b1dadadb8e Merge branch 'v1.x' 2016-08-11 13:10:39 +01: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é
2d76ce229f Merge branch 'v1.x' 2016-08-10 13:34:39 +01:00
Saúl Ibarra Corretgé
56292929ac win: simplify uv_rwlock_t type
PR-URL: https://github.com/libuv/libuv/pull/989
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-10 13:33:17 +01:00
Saúl Ibarra Corretgé
b3c9902dfc win: simplify uv_cond_t type
PR-URL: https://github.com/libuv/libuv/pull/989
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-10 13:33:06 +01:00
Saúl Ibarra Corretgé
058d94b2d1 win: remove unneeded internal function
PR-URL: https://github.com/libuv/libuv/pull/986
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-10 11:53:48 +01:00
Saúl Ibarra Corretgé
e8ba2281f8 unix: remove support for FreeBSD < 10
PR-URL: https://github.com/libuv/libuv/pull/984
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-08-09 22:30:03 +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
Saúl Ibarra Corretgé
78a1cd167f win,async: refactor internal implementation
- Use atomic ops both to set and reset async_sent flag
- Remove the MinGW atomic ops, since Windows intrinsics are supported
- Remone thread-unsafe checks from uv_async_send

According to MSDN there are no alignment requirements. We could use
InterlockedExchange8, but that's only available on Windows >= 8.

This change is intended to make uv_async_send more resilient. It has to
be thread-safe, and that means that the handle could just have been
closed when uv_async_send was called. This case was previously not
handles (there is an inherent race condition). The new model is inspired
by the one used on the Unix side, which uses a single fd (or overlapped
in this case) to wakeup the loop and then process all pending async
handles. This makes handling those edge cases a lot simpler: when the
handle is closed it's removed from the handle queue, and then it's not
processed at all.

As a result of this change, async benchmarks work on Windows where they
previously failed with assertions.

PR-URL: https://github.com/libuv/libuv/pull/980
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-09 13:12:41 +01:00
Saúl Ibarra Corretgé
7892bd6f76 win,tty: remove no longer needed workaround
It was needed to support old MSVC versions:
https://github.com/libuv/libuv/pull/880

PR-URL: https://github.com/libuv/libuv/pull/980
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-09 13:12:27 +01:00
Saúl Ibarra Corretgé
c89ddacfa3 win: remove unused code
This code has been disabled since 2011, I guess we're ok without it.

PR-URL: https://github.com/libuv/libuv/pull/971
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-09 13:08:47 +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
Saúl Ibarra Corretgé
baac57a45f test,mingw: don't use pragma when not on MSVC
PR-URL: https://github.com/libuv/libuv/pull/969
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-05 12:52:48 +01:00
Saúl Ibarra Corretgé
4613cc916a win: drop support for old MinGW versions
MinGW (from mingw.org) is really old, so stop pretending we support it.
Just support MinGW-w64, which works also works with 32bit Windows,
despite it's misleading name.

PR-URL: https://github.com/libuv/libuv/pull/969
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-05 12:51:40 +01:00
Saúl Ibarra Corretgé
3118e5a4e4 unix,win: share loop watchers implementation
PR-URL: https://github.com/libuv/libuv/pull/974
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-05 12:49:29 +01: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
Saúl Ibarra Corretgé
de0054b6df win: use queues for idle, prepare and check handles
PR-URL: https://github.com/libuv/libuv/pull/970
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-04 15:51:07 +01: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
Saúl Ibarra Corretgé
3f21dd64d9 win: remove ABI compatibility hacks
PR-URL: https://github.com/libuv/libuv/pull/966
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-08-04 12:02:55 +01:00
Saúl Ibarra Corretgé
9329327a2a win: drop support for Windows < Vista
PR-URL: https://github.com/libuv/libuv/pull/966
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-08-04 12:02:48 +01:00
Saúl Ibarra Corretgé
9d2c77e9f6 win,build: drop support for Visual Studio < 2015
PR-URL: https://github.com/libuv/libuv/pull/966
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-08-04 12:02:38 +01:00
Saúl Ibarra Corretgé
9066c89b90 macOS: don't dynamically load pthread_setname_np
It's now present on all supported macOS and iOS versions.

PR-URL: https://github.com/libuv/libuv/pull/966
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-08-04 12:02:30 +01:00
Saúl Ibarra Corretgé
46dbdd0f97 macOS: drop support for macOS < 10.9
PR-URL: https://github.com/libuv/libuv/pull/966
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-08-04 12:01:08 +01:00
Saúl Ibarra Corretgé
d7f65293c0 core: add reserved fields to uv_loop_t
Same as we do for uv_handle_t and uv_req_t, they may come useful if we
need to get creative to keep ABI compatibility.

PR-URL: https://github.com/libuv/libuv/pull/967
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-03 13:00:27 +01:00
Saúl Ibarra Corretgé
99438cf020 Merge branch 'v1.x' 2016-08-03 10:26:12 +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
cjihrig
77c8abae33 win: compare entire filename in watch events
This commit causes Window file watching events to compare the
entire file path when filtering events. This fixes a bug where
incomplete path comparisons would cause invalid events to be
raised.

Refs: https://github.com/libuv/libuv/pull/682
PR-URL: https://github.com/libuv/libuv/pull/924
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-06-24 10:36:04 -04:00
Ben Noordhuis
34ee25734f unix: don't convert stat buffer when syscall fails
Don't call uv__to_stat() when the stat/fstat/lstat system call fails;
the stack-allocated buffer contains only garbage in that case.

Not a very serious bug it's technically undefined behavior and it made
valgrind squawk.

Introduced in commit 499c7976 ("unix, windows: nanosecond resolution
for uv_fs_[fl]stat").

PR-URL: https://github.com/libuv/libuv/pull/921
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-06-22 17:49:28 +02:00