Commit Graph

1291 Commits

Author SHA1 Message Date
reito
4a6741c53d src: format 2025-02-04 16:39:48 +08:00
reito
f7c8cd1438 src: add test for shutdown, fix format 2025-02-04 16:39:48 +08:00
reito
2baab70a48 test: bad name 2025-02-04 16:39:48 +08:00
reito
32f3e0dbae src: add comments 2025-02-04 16:39:48 +08:00
reito
2d64fe4a40 test: optimize code 2025-02-04 16:39:48 +08:00
reito
b1fbc5dbb2 test: add test for win uds 2025-02-04 16:39:48 +08:00
reito
3c56c48a2d test: add test for win uds 2025-02-04 16:39:48 +08:00
reito
a514c513e4 src: fix socket extension, uv_pipe_init_ex 2025-02-04 16:39:48 +08:00
reito
d9df97725a src: remove cond macro for should use uds pipe 2025-02-04 16:39:48 +08:00
reito
404d3787b5 src: acceptex/connectex get once at init, code review 2 2025-02-04 16:39:48 +08:00
reito
801b2476b8 src: code review 2025-02-04 16:39:48 +08:00
reito
61dd2b5b13 src: use positive words for uds. 2025-02-04 16:39:48 +08:00
reito
823a33b734 src: fix mingw 2025-02-04 16:39:48 +08:00
reito
a74298d8b6 src: refine comments 2025-02-04 16:39:48 +08:00
reito
281cf049fb src: fix mingw 2025-02-04 16:39:48 +08:00
reito
2254687ad4 src: cond disable on mingw. 2025-02-04 16:39:48 +08:00
reito
ca541f6799 src: getpeername getsockname 2025-02-04 16:39:48 +08:00
reito
260f51cb67 src: fix connectex with iocp bugm, implement end of uds stream 2025-02-04 16:39:48 +08:00
reito
c9ad1f5dee src: rename uds pipe flag. 2025-02-04 16:39:48 +08:00
reito
e75db5839f src: handle remote connection reset correctly. 2025-02-04 16:39:48 +08:00
reito
c4694e63e1 src: win pipe add unix domain socket support 2025-02-04 16:39:48 +08:00
Morten Engelhardt Olsen
23632e9104
win: check cwd length before spawning a child process
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.
2025-01-29 22:51:06 +01:00
Ben Noordhuis
82351168b3
win: lazy-load [GS]etThreadDescription symbols (#4679)
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
2025-01-24 21:53:22 +01:00
Saúl Ibarra Corretgé
f15c602bd0 win: fix leak in uv_os_tmpdir
Fixes: https://github.com/libuv/libuv/issues/4680
2025-01-24 11:46:16 +01:00
Juan José
be8eec8c5a
misc: implement uv_getrusage_thread (#4666)
Refs: https://github.com/libuv/libuv/issues/3119

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
Co-authored-by: James M Snell <jasnell@gmail.com>
2025-01-14 14:50:26 +01:00
Saúl Ibarra Corretgé
ec5a4b54f7 win: fix leak processing fs event
Fixes: https://github.com/libuv/libuv/pull/4376#issuecomment-2544728609
2024-12-16 13:58:43 +01:00
Ben Noordhuis
e8969bff6c unix,win: add uv_udp_try_send2
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.
2024-12-13 21:52:59 +01:00
amcgoogan
88201044ed
win: plug uv_fs_event_start memory leak (#4647)
Co-authored-by: Andrew McGoogan <amcgoogan@cribl.io>
Fixes: https://github.com/nodejs/node/issues/52769
2024-12-13 00:23:36 +01:00
Jameson Nash
72d9abccd7
win,fs: get (most) fstat when no permission (#4566)
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>
2024-12-12 15:05:53 -05:00
Saúl Ibarra Corretgé
16e6e84dcc
win: drop support for the legacy MinGW (#4645)
The OG MinGW has been dead for years, MinGW-w64 has taken its place.
2024-12-12 15:59:30 +01:00
Saúl Ibarra Corretgé
88baee1a35 fixup! 2024-12-12 15:55:16 +01:00
Saúl Ibarra Corretgé
264bb335af win: enable uv_thread_{get,set}name on MinGW
It supports the API: 93f3505a75/mingw-w64-headers/include/processthreadsapi.h (L358)
2024-12-12 15:55:16 +01:00
Saúl Ibarra Corretgé
6af08fb527 win: use GetQueuedCompletionStatusEx directly
It was introduced in Vista, so we can assume it's always there now.
2024-12-10 23:44:29 +01:00
Ben Noordhuis
2494c088f0
unix,win: handle nbufs=0 in uv_udp_try_send (#4641) 2024-12-09 21:14:01 +01:00
Santiago Gimeno
61c966cf0b
src: add uv_thread_set/getname() methods (#4599)
`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.
2024-11-27 12:52:18 +01:00
Juan José
556a0f1f0f
unix,win: add support for detached threads (#4621)
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>
2024-11-26 08:44:38 -05:00
Saúl Ibarra Corretgé
c6d43bea09
unix,win: harmonize buffer checking
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);
...
```
2024-11-25 15:10:47 +01:00
Jameson Nash
058c49b7ba
win,fs: match trailing slash presence in junctions to user input (#4590)
Refs: #4582
2024-10-18 21:01:07 +02:00
Jameson Nash
7e6590f31d
win: remap ERROR_NOACCESS and ERROR_BUFFER_OVERFLOW (#4567)
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.
2024-10-17 15:37:00 -04:00
Thad House
9cf0710d71
win: fix compilation against Windows 24H2 SDK (#4576)
Compilation against the 24H2 SDK is broken by #4327.

Fix that issue by only conditionally defining the new values.

Closes #4575
2024-10-17 15:36:45 -04:00
Thad House
52a9243317
win: Fix linked list logic in getaddrinfo (#4578)
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
2024-10-17 15:36:07 -04:00
Hüseyin Açacak
fbe2d85bd5 win,fs: remove trailing slash in junctions
Fixes: https://github.com/libuv/libuv/issues/3329
2024-10-15 09:48:27 +02:00
Hüseyin Açacak
1cbffcbd5d win,fs: fix bug in fs__readdir 2024-10-04 13:33:22 +02:00
Jameson Nash
f55efb2f38
win,pipe: ipc code does not support async read (#4555)
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
2024-10-03 22:12:22 +02:00
Santiago Gimeno
88b874e63c
win,fs: uv_fs_rmdir() to return ENOENT on file (#4563)
After commit 18266a6969, it changed to return `ENOTDIR`, which makes it
consistent with other platforms but it also can be considered a breaking
change.
2024-10-03 21:29:10 +02:00
Santiago Gimeno
473dafc593
win: fix WriteFile() error translation (#4562)
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
2024-10-03 18:53:39 +02:00
Rialbat
65e3735320 win: fix pNtQueryDirectoryFile check
Fixed incorrect verification of the pNtQueryDirectoryFile pointer.
2024-10-03 08:59:39 +02:00
Jameson Nash
0a00e80c36
win,pipe: fix another missing assignment to success (#4523)
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.
2024-09-05 09:46:37 -04:00
Ben Noordhuis
5ff1fc724f
win: fix uv_available_parallelism on win32 (#4525)
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
2024-09-02 11:24:11 +02:00
Jameson Nash
f00d4b6775
win,pipe: fix missing assignment to success (#4515) 2024-08-28 19:59:46 -04:00