Commit Graph

5568 Commits

Author SHA1 Message Date
Ben Noordhuis
9a8d9c66f3
test,win: fix -Wcast-function-type warnings (#4867) 2025-08-24 20:22:04 +02:00
Ben Noordhuis
385896c388
test,win: fix -Wunused-function warnings (#4866) 2025-08-24 20:21:46 +02:00
Ben Noordhuis
3813460d57
unix: replace uv__io_t callback pointer with enum (#4854)
Rationale for changing it to an enum:

- frees up some bits that can be used for other things
- is potentially faster (direct vs. indirect call)
- is potentially more secure (makes UAF or overruns harder to exploit,
  no arbitrary function pointer to clobber)

Fixes: https://github.com/libuv/libuv/issues/4842
2025-08-23 20:41:01 +02:00
Savas Sahin
3b1ac021e3
win: fix compiler warnings (#4860) 2025-08-20 21:17:02 +02:00
Anton Kirilov
3d9d7c7ef6
unix: improve uv__cpu_relax() on arm (#4863)
The AArch64 YIELD instruction affects processors that support
symmetric multithreading, while on other implementations (which
are the majority on the market) it is equivalent to NOP, thus
failing to achieve the desired delay effect inside uv__async_spin().
Instead, use the ISB instruction, following one of Arm's
recommendations [1].

[1] https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/multi-threaded-applications-arm

Signed-off-by: Anton Kirilov <anton.kirilov@arm.com>
2025-08-20 21:15:37 +02:00
dependabot[bot]
07c8a3c4ca build(deps): bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-19 11:32:36 +02:00
Emily
8aad181416
test: use relative paths for pipes and unix sockets (#4850)
This fixes the test suite in environments where `/tmp` is not writable
or does not allow the use of Unix sockets, and matches the use of
relative paths elsewhere in the tests.
2025-08-16 22:08:55 +02:00
Ben Noordhuis
b161b1f475
doc: remove nodeuv from LINKS.md (#4859)
The original repository was deleted and the URL is now owned by someone
else.

Refs: https://hackerone.com/bugs?report_id=3295855
2025-08-13 20:56:44 +02:00
dependabot[bot]
173b763334 build(deps): bump actions/download-artifact from 4 to 5
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 15:56:07 +02:00
Lawrence Stubbs
056e180e11
doc: update link, repo name change to c-asio (#4855) 2025-08-03 22:46:00 +02:00
Ben Noordhuis
2e7c07f4d1
linux: handle cgroups cpu.max with limit < period (#4853)
This apparently manifests when one passes `--cpu=.5` to docker because
then /sys/fs/cgroup/cpu.max looks like `50000 100000`, and 50000 divided
by 100000 is zero when using integer math.

Return 1 in that case, indicating there is at least one CPU available.
Returning 0 makes no sense because there is always at least one CPU
available, otherwise the program wouldn't be running.

Fixes: https://github.com/nodejs/node/issues/59200
2025-07-31 11:54:57 +02:00
Lawrence Stubbs
e70d5e8a12
doc: add binding C framework uv_coroutine to LINKS.md 2025-07-31 11:29:46 +02:00
Ben Noordhuis
33b192c845
unix: fix udp sendmmsg fallback path (#4849)
Fix a logic bug in the fallback code for platforms that don't have a
sendmmsg-like system call. It only sent at most one packet, even when
there were more available, and that was observable through a failing
test on such systems.

Fixes: https://github.com/libuv/libuv/issues/4848
2025-07-29 01:06:40 +02:00
Sean Dewar
aee30bd8d0 doc: fix return value for uv_pipe_connect2
It was incorrectly documented as returning void since its addition, but it
returns int.
2025-07-28 11:24:47 +02:00
Keno Fischer
6cf854c11b
win: work around wine bug in uv_fs_{unlink,rmdir} (#4833)
Wine has a bug (https://bugs.winehq.org/show_bug.cgi?id=50771) where
FILE_WRITE_ATTRIBUTES will cause CreateFile to fail if the file is
read-only. The recommended work around is to instead use
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE, which we do as of #4318.
However, we were still using FILE_WRITE_ATTRIBUTES to create the
initial handle, despite this no longer being required, except for
the fallback path. As a result, libuv is still broken under wine,
even on master. Fix this by removing the `FILE_WRITE_ATTRIBUTES`
from the initial CreateFile call and re-opening the handle in the
fallback path if necessary. Note that we still have the same issue
in fs_chmod and I've requested some guidance from wine on what
to do about this, but this should at least fix unlink.

Refs: https://github.com/JuliaLang/julia/issues/58980
2025-07-24 21:15:39 +02:00
Ben Noordhuis
7484ab251f
win: use ProcessPrng (#4836)
Refs: https://github.com/libuv/libuv/pull/2762#issuecomment-3065018271
2025-07-16 20:18:29 +02:00
wisemanny
917c1ad1d1
win: add arm64 machine type to uv_os_uname (#4840)
Fixes: https://github.com/libuv/libuv/issues/4838
Co-authored-by: maxim <maxim@wiselydone.com>
2025-07-16 19:55:26 +02:00
Jameson Nash
a21e7cfaf8
test: simplify ASSERT_OK macro for static analysis (#4830)
I was testing a static analyzer on libuv's code, and it could not
understand the use of a constant variable in the condition as an assert
branch. This simplifies the code for easier static analysis. I also
removed the explicit casts, relying instead on C's casting rules to
catch some misuse.
2025-07-16 12:39:56 -04:00
Ben Noordhuis
4887c09cf2
win: fix -Wsign-compare warnings (#4835) 2025-07-15 23:01:38 +02:00
Ben Noordhuis
6f3199dd3f
win: fix -Wcast-function-type warnings in winapi.c (#4834) 2025-07-15 23:01:19 +02:00
Luca Saccarola
9424da3e46
doc: make requirements work with newer python (#4745) 2025-07-10 15:44:58 -04:00
Jameson Nash
7026ae0fe2
win,pipe: minimal fix to uv_read_cb->uv_read_start recursion bug (#4784)
Starting a new read after uv_read_cb returns causes memory corruption on
the OVERLAPPED read_req if uv_read_stop+uv_read_start was called during
the callback after the latest refactoring. This apparently also forces
the kernel to deadlock us, since it apparently cannot cancel the second
read while the first one is pending (reads apparently are not permitted
to finish out of order). Avoid that simply by not issuing another read
(set more=0) if there is already a read pending (from uv_read_start).

There are probably better things we could do here (such as bring back
`uv_active_tcp_streams_threshold`), but the current `alloc_cb` design
may not currently permit that without making breaking changes. We could
also detect in `uv_read_start` that we are inside of of the `read_cb`
for that stream, and defer the actual zero-read until the read_cb
returns, but that would likely be a larger change.

Fix #4738
2025-07-10 09:08:36 -04:00
Ben Noordhuis
454637403a
win: replace inline asm with compiler intrinsic (#4829)
Switch to __sync_fetch_and_or on x86. Libuv already uses it on other
architectures.
2025-07-08 16:33:21 +02:00
Ben Noordhuis
0070322ef2
win: move uv__insert_pending_req to core.c (#4828)
Large-ish functions with many call sites in different translation units
should not be `static inline`, that just results in lots of code
duplication which the linker may or may not deduplicate. When it does,
the linker has to do extra work; when it doesn't, binaries get bigger.

Refs: https://github.com/libuv/libuv/issues/4819
2025-07-08 16:33:02 +02:00
Ben Noordhuis
b36dc711e6
win: move uv__process_endgames to core.c (#4827)
Refs: https://github.com/libuv/libuv/issues/4819
2025-07-07 22:08:11 +02:00
Ben Noordhuis
dc117c7dec
win: dissolve atomicops-inl.h (#4826)
Commit 7fb43d3c from August 2012 moved uv__atomic_exchange_set from
async.c into a header file but in all those years, nothing except
async.c has ever used it. Move the function back again and remove
the header file.

I removed the superfluous uses of inline/INLINE but this is otherwise
a non-functional change.

Refs: https://github.com/libuv/libuv/issues/4819
2025-07-07 22:07:56 +02:00
Ben Noordhuis
aac866f399
test: skip slow process title test on asan+macos (#4825)
uv_set_process_title loads and unloads a bunch of dynamic libraries,
and that's quite slow and prone to time out when running concurrently
under AddressSanitizer.
2025-07-06 16:19:51 +02:00
Ben Noordhuis
3d12a590c1
win: remove unnecessary inlining from header file (#4824)
Refs: https://github.com/libuv/libuv/issues/4819
2025-07-06 16:19:36 +02:00
Ben Noordhuis
d67ef2e393
win: move uv__process_reqs to core.c (#4821)
Refs: https://github.com/libuv/libuv/issues/4819
2025-07-06 16:19:18 +02:00
Ben Noordhuis
25f6f84286
win: remove unnecessary inlining from fs.c (#4822)
Refs: https://github.com/libuv/libuv/issues/4819
2025-07-06 15:55:33 +02:00
Ben Noordhuis
aad85404cc
test: pass correct string type to GetModuleHandleW (#4820)
Introduced in commit 2545ffe74 from last month.
2025-07-06 15:39:37 +02:00
Juan José
55f5fce1cc
unix: deduplicate uv_free_interface_addresses (#4818)
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-07-05 13:05:46 +02:00
Juan José
db3d0ff33a
unix: handle possible ENOMEM in uv__pipe_listen (#4817)
Refs: https://github.com/libuv/libuv/issues/4755
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-07-03 21:04:46 +02:00
Ben Noordhuis
8e51d38ab6
win: remove obsolete comment (#4816)
Refs: https://github.com/libuv/libuv/security/advisories/GHSA-qf6p-jg38-9f4x#advisory-comment-131127
2025-07-02 13:58:41 +02:00
Richard Lau
49b6e4db0c mailmap: update email address for Richard Lau 2025-07-01 07:02:49 +02:00
Deep C
04fc1580d4
qnx: add qnx 8 support (#4801)
Fixes: https://github.com/libuv/libuv/issues/4710
2025-06-30 08:26:11 +02:00
chemodax
2545ffe74c
win: replace GetModuleHandleA with GetModuleHandleW (#4812) 2025-06-29 20:32:14 +02:00
Juan José Arboleda
513751e2fc unix: handle possible ENOMEM in uv__tcp_listen
Refs: https://github.com/libuv/libuv/issues/4755
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-06-24 10:50:34 +02:00
chemodax
5f3c0d3d08
win: use WSA_FLAG_NO_HANDLE_INHERIT in WSASocketW (#4810)
Resolves a potential race condition when a child process has been
created between WSASocketW() and SendHandleInformationW().
2025-06-22 23:26:24 +02:00
Ben Noordhuis
0d4f54f0f6
win: handle empty string in uv_get_process_title (#4807)
Distinguish between errors and "the console title is the empty string"
when calling GetConsoleTitle. Both are signified by a return value of
zero.

No test because I couldn't think of a succinct way to programmatically
create a new console window with an empty title.

Fixes: https://github.com/nodejs/node/issues/58695
2025-06-15 13:37:15 +02:00
Juan José
e13e80b20c
include: remove unused macro undefs from uv.h (#4790)
These macros are not defined in the public headers

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-06-14 22:38:58 +02:00
Juan José
1fbf4f7187
build: make automake link libm on bsd-likes (#4795)
This mirrors the behavior already fixed in the CMake build system.

Fixes: https://github.com/libuv/libuv/issues/4794
Refs: 4681d5d570
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-06-14 22:37:30 +02:00
jhnh204
6a0945b333
src: fix nullptr dereference in uv__print_handles (#4805) 2025-06-14 22:16:20 +02:00
Ben Noordhuis
b00c5d1a09
linux: fix -Wformat-truncation warning (#4793) 2025-05-29 22:11:40 +02:00
Andy Pan
3a9a6e3e6b
tcp: support customizing TCP_KEEPINTVL and TCP_KEEPCNT
Implement `uv_tcp_keepalive_ex` function that extends
`uv_tcp_keepalive` to support `TCP_KEEPINTVL` and `TCP_KEEPCN`
socket options in addition to TCP_KEEPIDLE.
2025-05-21 08:43:53 +02:00
Saúl Ibarra Corretgé
71ec5c0fcd
doc: update ncurses link (#4788)
The link at gnu.org is a redirect now and the docs linter breaks some times.
2025-05-16 09:31:11 -04:00
Juan José
29edf31089
build: dedup sanitizer jobs using matrix strategy (#4776)
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-05-15 09:30:00 +02:00
Ryan Liptak
2b76a4fafa
unix: fix uv_thread_{get,set}priority error codes (#4782)
pthread_getschedparam and pthread_setschedparam do not use errno but
instead return the error code directly.

https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_getschedparam.html

Also include a fix to return UV_ESRCH instead of UV_EBADF on Windows,
like Unix systems do.
2025-05-15 09:16:25 +02:00
Poul T Lomholt
a3b8cb9cc0
doc: don't mention UV_LOOP_ENABLE_IO_URING_SQPOLL (#4786)
The documentation is referring to an internal name -
UV_LOOP_ENABLE_IO_URING_SQPOLL - in several places. Fix this by using
the public UV_LOOP_USE_IO_URING_SQPOLL name instead.
2025-05-15 09:12:36 +02:00
Juan José
8d4218dcd7
test: remove unused include of <limits.h> in runner.h (#4780)
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-05-10 10:04:59 -04:00