aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* src: set a default thread name for workers (#4664)Rafael Gonzaga2025-01-08
|
* win: fix leak processing fs eventSaúl Ibarra Corretgé2024-12-16
| | | | Fixes: https://github.com/libuv/libuv/pull/4376#issuecomment-2544728609
* unix,win: add uv_udp_try_send2Ben Noordhuis2024-12-13
| | | | | | | | | Add a version of uv_udp_try_send that can send multiple datagrams. Uses sendmmsg(2) on platforms that support it (Linux, FreeBSD, macOS), falls back to a regular sendmsg(2) loop elsewhere. This work was sponsored by ISC, the Internet Systems Consortium.
* unix: refactor udp sendmsg codeBen Noordhuis2024-12-13
| | | | | | | Shuffle around and DRY the sendmsg logic in preparation for uv_udp_try_send2(). NFC barring bugs. This work was sponsored by ISC, the Internet Systems Consortium.
* win: plug uv_fs_event_start memory leak (#4647)amcgoogan2024-12-13
| | | | Co-authored-by: Andrew McGoogan <amcgoogan@cribl.io> Fixes: https://github.com/nodejs/node/issues/52769
* win,fs: get (most) fstat when no permission (#4566)Jameson Nash2024-12-12
| | | | | | | Replaces: https://github.com/libuv/libuv/pull/4504 Fixes: https://github.com/libuv/libuv/issues/1980 Fixes: https://github.com/libuv/libuv/issues/3267 Co-authored-by: Hüseyin Açacak <huseyin@janeasystems.com>
* win: drop support for the legacy MinGW (#4645)Saúl Ibarra Corretgé2024-12-12
| | | The OG MinGW has been dead for years, MinGW-w64 has taken its place.
* fixup!Saúl Ibarra Corretgé2024-12-12
|
* win: enable uv_thread_{get,set}name on MinGWSaúl Ibarra Corretgé2024-12-12
| | | | It supports the API: https://github.com/mirror/mingw-w64/blob/93f3505a758fe70e56678f00e753af3bc4f640bb/mingw-w64-headers/include/processthreadsapi.h#L358
* win: use GetQueuedCompletionStatusEx directlySaúl Ibarra Corretgé2024-12-10
| | | | It was introduced in Vista, so we can assume it's always there now.
* unix,win: handle nbufs=0 in uv_udp_try_send (#4641)Ben Noordhuis2024-12-09
|
* linux: always use io_uring for epoll batching (#4638)Ben Noordhuis2024-12-06
| | | | | | | | | | | | io_uring support was default-disabled because of numerous kernel bugs but those are all in the sqpoll (file i/o) parts of io_uring. Batching of epoll_ctl calls through io_uring works fine, is a nice optimization, and is therefore unconditionally enabled again. The UV_USE_IO_URING environment variable now only affects sqpoll, and only when the UV_LOOP_ENABLE_IO_URING_SQPOLL event loop flag is set. Fixes: https://github.com/libuv/libuv/issues/4616
* linux: fix uv_cpu_info() arm cpu model detection (#4633)Ben Noordhuis2024-12-03
| | | | | | | Libuv looks for "Processor" in /proc/cpuinfo but it's been reported that on at least some Raspberry Pi models, it's called "model name". Look for both. Fixes: https://github.com/nodejs/node/issues/56105
* src: add uv_thread_set/getname() methods (#4599)Santiago Gimeno2024-11-27
| | | | | | | | | | | | | `uv_thread_setname()` sets the name of the current thread. Different platforms define different limits on the max number of characters a thread name can be: Linux, IBMi (16), macOS (64), Windows (32767), and NetBSD (32), etc. `uv_thread_setname()` will truncate it in case `name` is larger than the limit of the platform. `uv_thread_getname()` gets the name of the thread specified by `tid`. The thread name is copied into the buffer pointed to by `name`. The `size` parameter specifies the size of the buffer pointed to by `name`. The buffer should be large enough to hold the name of the thread plus the trailing NUL, or it will be truncated to fit.
* Revert "kqueue: change EV_OOBAND to EVFILT_EXCEPT+NOTE_OOB (#4597)" (#4623)Ben Noordhuis2024-11-26
| | | | | Unsupported on FreeBSD, breaking the build. This reverts commit b1d30f9489771a295c1d9b06402e49a77b3e91e6.
* unix,win: add support for detached threads (#4621)Juan José2024-11-26
| | | | | | This commit introduces the `uv_thread_detach` for thread detaching, allowing threads to be detached state on both UNIX and Windows platforms. Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
* kqueue: change EV_OOBAND to EVFILT_EXCEPT+NOTE_OOB (#4597)Juan José2024-11-25
| | | | Fixes: https://github.com/libuv/libuv/issues/3947 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
* unix,win: harmonize buffer checkingSaúl Ibarra Corretgé2024-11-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For any API that takes a buffer and size pointer, check both pointers and the pointed-to size and return UV_EINVAL in case of error. Example: ``` int uv_foo(char* buffer, size_t* size) { if (buffer == NULL || size == NULL || *size == 0) return UV_EINVAL; ... } ``` In order to "peek" the necessary size for dynamic allocation, the following pattern can be used: ``` char *buf; char scratch[1]; size_t len = sizeof(scratch); int r; r = uv_foo(scratch, &len); assert(r == UV_ENOBUFS); buf = malloc(len); r = uv_foo(buf, &len); ... ```
* unix,pipe: fix handling null buffer in uv_pipe_get{sock,peer}nameSaúl Ibarra Corretgé2024-11-22
| | | | Fixes: https://github.com/libuv/libuv/issues/4610
* kqueue: lower overhead in uv__io_check_fd (#4617)Andy Pan2024-11-20
| | | | | Merge kevent calls along with the improvement of code simplicity. Signed-off-by: Andy Pan <i@andypan.me>
* unix: fix build breakage on haiku, openbsd, etc (#4618)Jeffrey H. Johnson2024-11-20
| | | | | | | | The compile-time detection check from commit 7b75935 ("kqueue: use EVFILT_USER for async if available") was not being used, breaking numerous operating systems. This commit hopefully unbreaks them. Fixes; https://github.com/libuv/libuv/issues/4608 Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
* unix,win: fix off-by-one in uv_wtf8_to_utf16() (#4609)Ben Noordhuis2024-11-19
| | | | | | | uv_wtf8_length_as_utf16() checks if codepoints are > 0xFFFF (to see if it should be encoded as a surrogate pair), therefore uv_wtf8_to_utf16() should too. Instead it checked > 0x1000. Harmonize the checks. Fixes: https://github.com/nodejs/node/issues/55914
* kqueue: use EVFILT_USER for async if available (#4588)Jameson Nash2024-11-18
| | | | | | | | | Establishes a user event for kqueue to eliminate the overhead of the pipe and the system call read(2) per wakeup event. Relands commit 27134547ff using VSCode merge, since it shows the conflict is just on the order of #ifdef calls. Co-authored-by: Andy Pan <panjf2000@gmail.com>
* win,fs: match trailing slash presence in junctions to user input (#4590)Jameson Nash2024-10-18
| | | Refs: #4582
* win: remap ERROR_NOACCESS and ERROR_BUFFER_OVERFLOW (#4567)Jameson Nash2024-10-17
| | | | | | | It seemed incorrect to map a segfault to EACCES, since posix would typically map this to EFAULT. The ERROR_BUFFER_OVERFLOW is literally "the filename is too long", and is not typically an invalid parameter in posix. Test originally added in #1060 to test the API, not the value.
* win: fix compilation against Windows 24H2 SDK (#4576)Thad House2024-10-17
| | | | | | | Compilation against the 24H2 SDK is broken by #4327. Fix that issue by only conditionally defining the new values. Closes #4575
* win: Fix linked list logic in getaddrinfo (#4578)Thad House2024-10-17
| | | | | | The logic in #4254 is incorrect, and results in the addrinfo linked list only having a single result. Fix this by correcting the logic. Closes #4577
* Revert "linux: eliminate a read on eventfd per wakeup (#4400)" (#4585)Ben Noordhuis2024-10-17
| | | | | | | | | | | | This reverts commit e5cb1d3d3d4ab3178ac567fb6a7f0f4b5eef3083. Reason: bisecting says it breaks dnstap. Also revert commit 27134547ff ("kqueue: use EVFILT_USER for async if available") because otherwise the first commit doesn't revert cleanly, with enough conflicts in src/unix/async.c that I'm not comfortable fixing those up manually. Fixes: https://github.com/libuv/libuv/issues/4584
* win,fs: remove trailing slash in junctionsHüseyin Açacak2024-10-15
| | | | Fixes: https://github.com/libuv/libuv/issues/3329
* unix: fix uv_getrusage ru_maxrss on solaris (#4572)Poul T Lomholt2024-10-10
|
* unix: fix uv_tcp_keepalive in smartOS (#4570)Santiago Gimeno2024-10-09
| | | | | | | | | Make sure `UV__SOLARIS_11_4` is not set for `smartOS`/`illumOS`. In our codebase is used only twice: - Detect correct implementation of `SO_REUSEPORT`, which is not even implemented on `illumOS`. - Detect the time unit used for the TCP keepalive options. If set to `0`, which was the case for `illumOS`, it chose milliseconds, which is not correct for `illumOS` either as it uses seconds.
* unix: work around arm-linux-gnueabihf-gcc bug (#4565)Ben Noordhuis2024-10-08
| | | | | | | Both gcc 11 and 12 emit wrong code for a function call pointer in one very specific context. Fixes: https://github.com/libuv/libuv/issues/4532
* unix: workaround gcc bug on armv7 (#4564)Santiago Gimeno2024-10-07
| | | | | | Disable optimization on `uv__preadv_or_pwritev`. Fixes: https://github.com/libuv/libuv/issues/4532 Fixes: https://github.com/libuv/libuv/issues/4550
* win,fs: fix bug in fs__readdirHüseyin Açacak2024-10-04
|
* netbsd: fix buildAdam2024-10-04
|
* win,pipe: ipc code does not support async read (#4555)Jameson Nash2024-10-03
| | | | | | | The implementation of IPC pipe in libuv on Windows does not properly support async reading. This means we cannot set the more parameter without likely causing hangs. Sorry this is yet another followup to #4511. Fixes #4548
* win,fs: uv_fs_rmdir() to return ENOENT on file (#4563)Santiago Gimeno2024-10-03
| | | | | After commit 18266a6969, it changed to return `ENOTDIR`, which makes it consistent with other platforms but it also can be considered a breaking change.
* win: fix WriteFile() error translation (#4562)Santiago Gimeno2024-10-03
| | | | | | Translate `ERROR_BROKEN_PIPE` and `ERROR_NO_DATA` to `UV_EPIPE` instead of their default translation, which will be used for the rest of cases. Refs: https://github.com/libuv/libuv/issues/4548#issuecomment-2383998849
* win: fix pNtQueryDirectoryFile checkRialbat2024-10-03
| | | | Fixed incorrect verification of the pNtQueryDirectoryFile pointer.
* linux: use IORING_OP_FTRUNCATE when available (#4554)Ben Noordhuis2024-09-30
| | | | | | | | | | | Route ftruncate() system calls through io_uring instead of the thread pool when the kernel is new enough to support it (linux >= 6.9). This commit harmonizes how libuv checks if the kernel is new enough. Some ops were checking against `uv__kernel_version()` directly while others stored the result of the version check as a feature flag. Because the kernel version is cached, and because it is more direct than a feature flag, I opted for the former approach.
* linux: use IORING_SETUP_NO_SQARRAY when available (#4553)Ben Noordhuis2024-09-30
| | | | | | | | | Introduced in Linux 6.6, it tells the kernel to omit the sqarray from the ring buffer. Libuv initalizes the array once to an identity mapping and then forgets about it, so not only does it save a little memory (ca. 1 KiB per ring) but it also makes things more efficient kernel-side because it removes a level of indirection.
* unix: expand uv_available_parallelism() to support more platformsOndřej Surý2024-09-24
|
* unix: work around arm-linux-gnueabihf-gcc bug (#4537)Ben Noordhuis2024-09-19
| | | | | | Both gcc 11 and 12 emit wrong code for a function call pointer in one very specific context. Fixes: https://github.com/libuv/libuv/issues/4532
* darwin: add udp mmsg support (#4527)Raihaan Shouhell2024-09-17
|
* dragonflybsd: fix compilation failure (#4534)Jeffrey H. Johnson2024-09-17
| | | | Fixes: https://github.com/libuv/libuv/issues/4533 Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
* unix: restore tty attributes on handle close (#4399)Ben Noordhuis2024-09-11
| | | | | | | | | | | | | | | | | | | | Libuv stores the `struct termios` for use inside uv_tty_reset_mode(). Node.js uses said function to restore the tty to its original mode on SIGINT or SIGTERM, when there is no opportunity to shut down the process normally. Track uv_tty_t handle closing, otherwise we might be trying to use a stale termios. The current solution is not ideal because there can be multiple handles that refer to the same tty/pty and, for various reasons, we can't really determine when we close the last handle. The last handle may not even be inside the current process. Still, all things considered, it's probably (hopefully!) an improvement over the status quo. Refs: https://github.com/libuv/libuv/issues/4398
* kqueue: disallow ill-suited file descriptor kinds (#4513)Andy Pan2024-09-09
| | | | | Follows up on https://github.com/libuv/libuv/pull/659. Signed-off-by: Andy Pan <i@andypan.me>
* win,pipe: fix another missing assignment to success (#4523)Jameson Nash2024-09-05
| | | | | | Yet another followup to #4511. The functional/legacy/increment_spec.lua test failed most of the time without this, and passes consistently with it. It seemed unexpected this code path gets reached (perhaps imply that the user wrote zero bytes?), but good to fix of course.
* win: fix uv_available_parallelism on win32 (#4525)Ben Noordhuis2024-09-02
| | | | | | | | | Fixes commit 58dfb6c89b from a few days ago. DWORD_PTR is 32 bits on x86 Windows. Use the right bit count when checking the population count. Interestingly enough, it manifested itself as double counting online processors, presumably because the compiler emits a ROR instead of SHR. Fixes: https://github.com/libuv/libuv/issues/4524
* win,pipe: fix missing assignment to success (#4515)Jameson Nash2024-08-28
|