The CreateProcess API on Windows is still not longPathAware,
even if the process itself is. So, if the cwd used for CreateProcess
is too long, then the call fails with a 'INVALID_DIRECTORY' error.
To deal with this, check the length of the cwd and shorten it if it
is longer than MAX_PATH.
Said symbols are not by default available on Windows Server 2016 but
libuv can still use them when
api-ms-win-core-processthreads-l1-1-3.dll is present.
Fixes: https://github.com/libuv/libuv/issues/4677
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.
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.
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
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
`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.
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>
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);
...
```
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>
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
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>
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.