Commit Graph

5019 Commits

Author SHA1 Message Date
自发对称破缺
fb85db1d3e
build: enable MSVC_RUNTIME_LIBRARY setting (#3624) 2022-07-18 15:49:17 -04:00
Ben Noordhuis
06948c6ee5
android: remove pthread-fixes.c (#3674)
This was a kludge for a bug in old versions (API level <= 16) of the
Android SDK.

The os390 port had a build dependency on the file but does not actually
use it so that too has been removed.
2022-07-15 11:18:38 +02:00
Ben Noordhuis
495ffca2c2
win: remove stdint-msvc2008.h (#3673)
Support for VS 2008 was removed two years ago in commit a779fccfd so
this file can safely be deleted.
2022-07-15 10:39:14 +02:00
Jameson Nash
e81cc74ca2 Now working on version 1.44.3
Fixes: https://github.com/libuv/libuv/issues/3586
2022-07-12 12:22:04 -04:00
Jameson Nash
57a9a7196f Add SHA to ChangeLog 2022-07-12 12:17:13 -04:00
Jameson Nash
0c1fa696aa 2022.07.12, Version 1.44.2 (Stable)
Changes since version 1.44.1:

* Add SHA to ChangeLog (Jameson Nash)

* aix, ibmi: handle server hang when remote sends TCP RST (V-for-Vasili)

* build: make CI a bit noisier (Jameson Nash)

* process: reset the signal mask if the fork fails (Jameson Nash)

* zos: implement cmpxchgi() using assembly (Shuowang (Wayne) Zhang)

* build: AC_SUBST for AM_CFLAGS (Claes Nästén)

* ibmi: Implement UDP disconnect (V-for-Vasili)

* doc: update active maintainers list (Ben Noordhuis)

* build: fix kFreeBSD build (James McCoy)

* build: remove Windows 2016 workflows (Darshan Sen)

* Revert "win,errors: remap ERROR_ACCESS_DENIED to UV_EACCES" (Darshan
  Sen)

* unix: simplify getpwuid call (Jameson Nash)

* build: filter CI by paths and branches (Jameson Nash)

* build: add iOS to macos CI (Jameson Nash)

* build: re-enable CI for windows changes (Jameson Nash)

* process,iOS: fix build breakage in process.c (Denny C. Dai)

* test: remove unused declarations in tcp_rst test (V-for-Vasili)

* core: add thread-safe strtok implementation (Guilherme Íscaro)

* win: fix incompatible-types warning (twosee)

* test: fix flaky file watcher test (Ben Noordhuis)

* build: fix AIX xlc autotools build (V-for-Vasili)

* unix,win: fix UV_RUN_ONCE + uv_idle_stop loop hang (Ben Noordhuis)

* win: fix unexpected ECONNRESET error on TCP socket (twosee)

* doc: make sample cross-platform build (gengjiawen)

* test: separate some static variables by test cases (Hannah Shi)

* sunos: fs-event callback can be called after uv_close() (Andy
  Fiddaman)

* uv: re-register interest in a file after change (Shuowang (Wayne)
  Zhang)

* uv: register UV_RENAME event for _RFIM_UNLINK (Shuowang (Wayne) Zhang)

* uv: register __rfim_event 156 as UV_RENAME (Shuowang (Wayne) Zhang)

* doc: remove smartos from supported platforms (Ben Noordhuis)

* macos: avoid posix_spawnp() cwd bug (Jameson Nash)

* release: check versions of autogen scripts are newer (Jameson Nash)

* test: rewrite embed test (Ben Noordhuis)

* openbsd: use utimensat instead of lutimes (tuftedocelot)

* doc: fix link to uvwget example main() function (blogdaren)

* unix: use MSG_CMSG_CLOEXEC where supported (Ben Noordhuis)

* test: remove disabled callback_order test (Ben Noordhuis)

* win,pipe: fix bugs with pipe resource lifetime management (Jameson
  Nash)

* loop: better align order-of-events behavior between platforms (Jameson
  Nash)

* aix,test: uv_backend_fd is not supported by poll (V-for-Vasili)

* kqueue: skip EVFILT_PROC when invalidating fds (chucksilvers)

* darwin: fix atomic-ops.h ppc64 build (Sergey Fedorov)

* zos: don't err when killing a zombie process (Shuowang (Wayne) Zhang)

* zos: avoid fs event callbacks after uv_close() (Shuowang (Wayne)
  Zhang)

* zos: correctly format interface addresses names (Shuowang (Wayne)
  Zhang)

* zos: add uv_interface_addresses() netmask support (Shuowang (Wayne)
  Zhang)

* zos: improve memory management of ip addresses (Shuowang (Wayne)
  Zhang)

* tcp,pipe: fail `bind` or `listen` after `close` (theanarkh)

* zos: implement uv_available_parallelism() (Shuowang (Wayne) Zhang)

* udp,win: fix UDP compiler warning (Jameson Nash)

* zos: fix early exit of epoll_wait() (Shuowang (Wayne) Zhang)

* unix,tcp: fix errno handling in uv__tcp_bind() (Samuel Cabrero)

* shutdown,unix: reduce code duplication (Jameson Nash)

* unix: fix c99 comments (Ben Noordhuis)

* unix: retry tcgetattr/tcsetattr() on EINTR (Ben Noordhuis)

* docs: update introduction.rst (Ikko Ashimine)

* unix,stream: optimize uv_shutdown() codepath (Jameson Nash)

* zos: delay signal handling until after normal i/o (Shuowang (Wayne)
  Zhang)

* stream: uv__drain() always needs to stop POLLOUT (Jameson Nash)

* unix,tcp: allow EINVAL errno from setsockopt in uv_tcp_close_reset()
  (Stacey Marshall)

* win,shutdown: improve how shutdown is dispatched (Jameson Nash)
2022-07-12 12:16:33 -04:00
Jameson Nash
ee970e38a6
win,shutdown: improve how shutdown is dispatched (#3649)
Split this off from endgame, so that it can be handled separately and
earlier, rather than trying to detect inside endgame which case we are
in. There appear to be some race conditions on the `handle` field still
however, which this does not yet attempt to address.
2022-07-11 12:30:20 -04:00
Stacey Marshall
f5e4d85cd2
unix,tcp: allow EINVAL errno from setsockopt in uv_tcp_close_reset() (#3662)
Some setsockopt() implememantations may return with errno of EINVAL
when the socket has been shut down already, as documented in the
Open Group Specifications Issue 7, 2018.

When this happens, reset errno and continue to mark the socket closed
and handle any callback.
2022-07-11 12:29:25 -04:00
Jameson Nash
47e95602c4
stream: uv__drain() always needs to stop POLLOUT (#3675)
Regression caused by 1a91b51976 mistake.

Refs: https://github.com/libuv/libuv/pull/3648
Fixes: https://github.com/libuv/libuv/pull/3648/3671
2022-07-11 12:24:49 -04:00
Wayne Zhang
c4d73c306b
zos: delay signal handling until after normal i/o (#3643)
Port the changes made to AIX and other unix systems in #611 to z/OS.

Defers the signal watcher that is used for process management until
after the dispatch of regular i/o watchers.

Refs: https://github.com/libuv/libuv/pull/611
Co-authored-by: Igor Todorovski <itodorov@ca.ibm.com>
2022-07-07 18:21:37 -04:00
Jameson Nash
6999994def
unix,stream: optimize uv_shutdown() codepath (#3646)
Once the write queue is empty, we can fire the event immediately,
without needing a lot of syscalls and then waiting for the kernel to
feed us the event on the next tick. This also makes it more similar to
how it would behave if there was a write still in the queue also, which
we dispatch later in the same event loop iteration, then drain.
2022-07-07 15:24:35 -04:00
Ikko Ashimine
f1635257cb
docs: update introduction.rst (#3664)
Github -> GitHub
2022-07-07 14:07:29 -04:00
Ben Noordhuis
7ca20a2679
unix: retry tcgetattr/tcsetattr() on EINTR (#3669)
EINTR is explicitly documented as a possible error code of tcsetattr().

The documentation for tcgetattr() is silent on the subject but better
safe than sorry.

Fixes: https://github.com/libuv/libuv/issues/3645
2022-07-06 07:41:51 +02:00
Ben Noordhuis
3136561cd0
unix: fix c99 comments (#3667)
Causes compilation errors for people that build libuv with a C89
compiler.

Refs: https://github.com/libuv/libuv/discussions/3666
2022-07-06 07:02:05 +02:00
Jameson Nash
1a91b51976
shutdown,unix: reduce code duplication (#3648)
The UV_ECANCELED codepath had an incorrect comment, and the
implementation was generally less robust (for example, not checking if
`cb` was NULL), so we can merge these codepaths for cleaner code.
2022-06-28 23:44:03 -04:00
Samuel Cabrero
2108309302
unix,tcp: fix errno handling in uv__tcp_bind() (#3652)
The errno value is only meaningful if bind() fails and returns -1.

Some bind() implementations may return success but modify errno value
internally, like the socket_wrapper library used by the Samba testsuite.
2022-06-28 23:42:52 -04:00
Wayne Zhang
27eec099d6
zos: fix early exit of epoll_wait() (#3653)
This fixes an early exit bug in z/OS implementation of epoll_wait(),
resulting in some file events not being correctly captured.

The problem is that reventcount should only be incremented by 1, because
_NFDS counts as 1 even for fds with multiple revents set.

Also makes a few minor improvements to remove redundant checks.

Co-authored-by: Igor Todorovski <itodorov@ca.ibm.com>
2022-06-28 23:42:11 -04:00
Jameson Nash
e3aaff185f
udp,win: fix UDP compiler warning (#3647)
Previously it would pass a pointer to uninitialized memory to WSASendTo,
which triggered a compiler warning. However, `addrlen` will be 0, so it
seems unlikely to trigger an error or uninitialized memory access.

Refs: https://github.com/libuv/leps/pull/10
Refs: https://github.com/libuv/libuv/pull/1872
Refs: https://github.com/libuv/libuv/pull/2217
2022-06-17 16:06:15 -04:00
Wayne Zhang
0b1c752b5c
zos: implement uv_available_parallelism() (#3650)
Implement uv_available_parallelism() for z/OS by reporting the number of
online cpu using __get_num_online_cpus() from ZOSLIB.
2022-06-17 11:55:44 +01:00
theanarkh
8bcd689c04
tcp,pipe: fail bind or listen after close (#3641)
Return `UV_EINVAL` in `bind` and `listen` when `handle` is
`UV_HANDLE_CLOSING` or `UV_HANDLE_CLOSED`.

Fixes: https://github.com/libuv/libuv/issues/3503
2022-06-11 00:32:08 -04:00
Wayne Zhang
d938c104e1 zos: improve memory management of ip addresses (#3640 3/3)
Fixes an issue where under certain conditions, dynamically allocated
ip addresses, strings, and buffers were either leaking memory, being
incorrectly freed, or not performing error checks.

Also fixes an issue where the uv_interface_address_t struct was not
correctly initialized to 0, so use calloc() instead of malloc().

Co-authored-by: Igor Todorovski <itodorov@ca.ibm.com>
2022-06-11 00:26:43 -04:00
Wayne Zhang
524c5ed87d zos: add uv_interface_addresses() netmask support (#3640 2/3)
Use SIOCGIFNETMASK ioctl to retrieve the netmask for IPv4. However, this
approach is not supported for IPv6.

For IPv6 netmask, z/OS currently only provides the prefix length through
the __nif6e_prefixlen in __net_ifconf6entry_t struct, but this can be
used to calculate the IPv6 netmask similar to android implementation.

Co-authored-by: Igor Todorovski <itodorov@ca.ibm.com>
2022-06-11 00:26:33 -04:00
Wayne Zhang
75ad046bfb zos: correctly format interface addresses names (#3640 1/3)
On z/OS, the interface address name contains EBCDIC and may be padded
with whitespaces. The whitespace padding needs to be trimmed, and the
interface address name needs to be converted from EBCDIC to ASCII.

Co-authored-by: John Barboza <jbarboza@ca.ibm.com>
Co-authored-by: Igor Todorovski <itodorov@ca.ibm.com>
2022-06-11 00:26:21 -04:00
Wayne Zhang
77c8e993ec
zos: avoid fs event callbacks after uv_close() (#3620)
On z/OS, fs events are implemented by registering file interest. When
closing a fs event handle, it's possible that a change notification has
already been generated. In that case, the attempt to unregister file
interest will fail with EALREADY. This will result in the fs event being
delivered even though the handle is closing, which should not happen.

Fixes: https://github.com/libuv/libuv/issues/3601
2022-06-11 00:22:06 -04:00
Wayne Zhang
51dcac5da7
zos: don't err when killing a zombie process (#3625)
On z/OS, EPERM is returned if the process being killed is a zombie.
However, this shouldn't be treated as an error, so return 0 instead.

Co-authored-by: Muntasir Mallick <mmallick@ca.ibm.com>
Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com>
2022-05-25 09:12:57 -04:00
Sergey Fedorov
99ab53e998
darwin: fix atomic-ops.h ppc64 build (#3634) 2022-05-24 17:04:47 +02:00
chucksilvers
730e07e2f7
kqueue: skip EVFILT_PROC when invalidating fds (#3629)
On NetBSD with libuv 1.44.1 we see that cmake occasionally hangs
waiting for a child process to exit, with libuv waiting forever for
`kevent` to deliver more events that never come. The child process has
already exited and is waiting to be collected with `waitpid`.

The hang occurs when the batch of events returned by one call to
`kevent` contains both a EVFILT_READ event for an fd and a later
EVFILT_PROC record for the PID with the same value as the earlier fd.
What happens is that `uv__platform_invalidate_fd` is called to
invalidate events later in the same batch for the fd, but
`uv__platform_invalidate_fd` invalidates the later EVFILT_PROC event
too because it sees the same "ident" value and does not check the
"filter" value to differentiate "ident" values that refer to fds vs.
"ident" values that refer to PIDs.

Add a check for the "filter" value to avoid confusing these two
different kinds of event "ident" values.
2022-05-17 13:43:52 +02:00
V-for-Vasili
1b8cc56194
aix,test: uv_backend_fd is not supported by poll (#3621)
Fixes: https://github.com/libuv/libuv/issues/3614
Co-authored-by: Vasili Skurydzin <vasili.skurydzin@ibm.com>
2022-05-13 12:43:28 +02:00
Jameson Nash
ee3718dd71
loop: better align order-of-events behavior between platforms (#3598)
Previously, Windows would always defer event processing to the loop
after they were received. This could cause confusion for users who were
using prepare and idle callbacks, as seen from this bug in nodejs[^1] and
this discussion in libuv[^2], and even some discrepancies in the libuv
tests too[^3].

[^1]: https://github.com/nodejs/node/pull/42340
[^2]: https://github.com/libuv/libuv/discussions/3550
[^3]: See change to test-spawn.c in this PR

So rather than declare those usages to be wrong, we change libuv to meet
those users expectations.

Replaces: https://github.com/libuv/libuv/pull/3585
2022-05-13 12:41:33 +02:00
Jameson Nash
ec67735412
win,pipe: fix bugs with pipe resource lifetime management (#3611)
If `uv_close` was called while a connect was pending, we would fail to
release the resources for the connection, since we had not yet set the
type of the struct.

Fix a thread data-race on slow connect path code: only permitted to
write to `req` on threads, as anything else causes data race
corruption.

There seemed be a small variety of other resource management bugs in
edge cases, which turned out to make this a lot larger than initially
expected.

Refs: https://github.com/libuv/libuv/pull/3598#issuecomment-1111513567
2022-05-13 12:40:02 +02:00
Ben Noordhuis
7825bfb49d
test: remove disabled callback_order test (#3619)
This test has always been disabled for the 10 years of its existence and
there are other tests that exercise "what happens when" event ordering.

Fixes: https://github.com/libuv/libuv/issues/3618
2022-05-09 09:17:35 +02:00
Ben Noordhuis
03a698b9c6
unix: use MSG_CMSG_CLOEXEC where supported (#3609)
Use MSG_CMSG_CLOEXEC on Unix-y platforms that support it (all except
macOS and SunOS spawn.)

Remove the feature test for Linux. Libuv's kernel baseline is 2.6.32
and MSG_CMSG_CLOEXEC was added in 2.6.23.
2022-04-27 22:44:00 +02:00
blogdaren
e0680d3061
doc: fix link to uvwget example main() function (#3605) 2022-04-27 10:23:28 +02:00
tuftedocelot
4e63e48879
openbsd: use utimensat instead of lutimes (#3607)
OpenBSD doesn't have lutimes so utimensat should be used instead.
2022-04-27 10:19:28 +02:00
Ben Noordhuis
a302ad427d
test: rewrite embed test (#3608)
- fix busy loop
- fix multi-thread race conditions
- reduce amount of platform-specific code

Fixes: https://github.com/libuv/libuv/issues/3606
2022-04-27 10:18:40 +02:00
Jameson Nash
9e59aa1bc8
release: check versions of autogen scripts are newer (#3554)
Use libtoolize --force to ensure it updates m4 directory with the
latest files. Add an option "release" to the autogen.sh script that
checks the versions of the input tools, so that we know they are always
using the latest version for each release.
2022-04-19 11:16:25 -04:00
Jameson Nash
7c9b3938df
macos: avoid posix_spawnp() cwd bug (#3597)
macOS 10.15 has a bug where configuring the working directory with
posix_spawn_file_actions_addchdir_np() makes posix_spawnp() fail with
ENOENT even though the executable is spawned successfully.

Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
2022-04-15 14:10:27 -04:00
Ben Noordhuis
6dfcdb9878
doc: remove smartos from supported platforms (#3594)
Commit 3af55129 from 2017 distinguished between smartos and other sunos
spawn but [0] makes it clear ("a new chapter" - barf) that smartos is
dead.

Stop mentioning smartos and put everything under the sunos umbrella.

[0] https://www.joyent.com/blog/a-new-chapter-begins-for-triton-and-smartos
2022-04-12 12:18:01 +02:00
Wayne Zhang
6d9275e412 uv: register __rfim_event 156 as UV_RENAME (#3540 3/3)
When the watched file is moved or removed, or an editor (e.g. vim)
renames then creates the file, the __rfim_event 156 occurs. This is an
undocumented event that should not happen, but register it as UV_RENAME
for now since it is functionally equivalent.

Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com>
2022-04-11 11:31:57 -04:00
Wayne Zhang
571f898192 uv: register UV_RENAME event for _RFIM_UNLINK (#3540 2/3)
`rename()` can be used to rename a file path via _RFIM_UNLINK. So
register it as a UV_RENAME event.

Co-authored-by: Igor Todorovski <itodorov@ca.ibm.com>
2022-04-11 11:31:38 -04:00
Wayne Zhang
07c4cacb58 uv: re-register interest in a file after change (#3540 1/3)
The file is implicitly unregistered when the change notification is
sent, only one notification is sent per registration. So we need to
re-register interest in a file after each change notification we
receive.

Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com>
2022-04-11 11:30:13 -04:00
Andy Fiddaman
612c28b89f
sunos: fs-event callback can be called after uv_close() (#3542)
On illumos and Solaris, fs events are implemented with
PORT_SOURCE_FILE type event ports. These are one-shot so
need re-arming each time they fire. Once they are armed
and an event occurs, the kernel removes them from the current
cache list and puts them on an event queue to be read by
the application.

There's a window in closing one of these ports when it could
have triggered and be pending delivery. In that case, the
attempt to disarm (dissociate) the event will fail with ENOENT
but libuv still goes ahead and closes down the handle. In
particular, the close callback (uv_close() argument) will be
called but then the event will subsequently be delivered if
the loop is still active; this should not happen.
2022-04-11 11:25:59 -04:00
Hannah Shi
b51e940dfa
test: separate some static variables by test cases (#3567) 2022-04-11 11:22:37 -04:00
Jiawen Geng
a78671543b
doc: make sample cross-platform build (#3592)
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
2022-04-11 09:52:28 +08:00
twosee
69ebb2d720
win: fix unexpected ECONNRESET error on TCP socket (#3584) 2022-04-07 21:44:45 -04:00
Ben Noordhuis
1fe609ea05
unix,win: fix UV_RUN_ONCE + uv_idle_stop loop hang (#3590)
Wrong accounting of idle handles in uv_run() made it sleep when there
was nothing left to do. Do a non-blocking poll for I/O instead.
2022-04-06 15:49:21 +02:00
V-for-Vasili
7233c428ec
build: fix AIX xlc autotools build (#3588) 2022-04-06 13:07:05 +01:00
Ben Noordhuis
223e526f27
test: fix flaky file watcher test (#3591)
FSEvents on macOS sometimes sends one change event, sometimes two.
Make the test more lenient.

Fixes #3589.
2022-04-06 13:40:51 +02:00
twosee
e6c67bf803
win: fix incompatible-types warning (#3581)
Introduced by https://github.com/libuv/libuv/pull/3350.
2022-03-31 13:53:41 -04:00
Guilherme Íscaro
2a31fe8552
core: add thread-safe strtok implementation (#3553)
This commit adds the support for a custom strtok implementation, which
is reentrant. On some systems strtok_r or strstep is available for that
purpose; however, since these are an extension, it is difficult to
control if it will be available on every supported system.
2022-03-22 15:15:00 -04:00