Commit Graph

1589 Commits

Author SHA1 Message Date
Thomas Walter
6b56200cc8
linux: fix uv_available_parallelism using cgroup (#4278)
uv_available_parallelism does not handle container cpu limit
set by systems like Docker or Kubernetes. This patch fixes
this limitation by comparing the amount of available cpus
returned by syscall with the quota of cpus available defined
in the cgroup.

Fixes: https://github.com/libuv/libuv/issues/4146
2024-02-28 12:23:23 +01:00
Ben Noordhuis
009d7414bc
test: fix -Wpointer-to-int-cast on 32 bits systems (#4309)
The return value from signal(2) is a pointer. Use the right macro.
2024-02-09 19:17:20 +01:00
Santiago Gimeno
e0327e1d50
test: empty strings are not valid IDNA
Fixes: https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
2024-02-07 20:50:13 +01:00
Ben Noordhuis
3530bcc303
fix: reject zero-length idna inputs
Fixes: https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
2024-02-07 20:50:04 +01:00
Ben Noordhuis
0f2d7e784a
fix: always zero-terminate idna output
Fixes: https://github.com/libuv/libuv/security/advisories/GHSA-f74f-cvh7-c6q6
2024-02-07 20:49:53 +01:00
Brad King
3f7191e5c2
win/spawn: optionally run executable paths with no file extension (#4292)
Add a process options flag to enable the optional behavior. Most users
are likely recommended to set this flag by default, but it was deemed
potentially breaking to set it by default in libuv.

Co-authored-by: Kyle Edwards <kyle.edwards@kitware.com>
2024-02-05 11:04:05 -05:00
Santiago Gimeno
1dd0ab1315
linux: fix bind/connect for abstract sockets (#4266)
The `\0` character has no special significance in abstract sockets, so
the addrlen field in both `bind()` and `connect()` should take that into
account.
2023-12-25 23:35:14 +01:00
Matheus Izvekov
51a22f60d6
unix,win: fix busy loop with zero timeout timers (#4250)
Calling `uv_timer_start(h, cb, 0, 0)` from a timer callback resulted in
the timer running immediately because it was inserted at the front of
the timer heap.

If the callback did that every time, libuv would effectively busy-loop
in `uv__run_timers()` and never make forward progress.

Work around that by collecting all expired timers into a queue and only
running their callback afterwards.

Fixes: https://github.com/libuv/libuv/issues/4245
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
2023-12-22 12:40:50 +01:00
Matheus Izvekov
8a499e1331
win: stop using deprecated names (#4253) 2023-12-22 12:30:48 +01:00
Abdirahim Musse
1479b76310
test: skip tcp-write-in-a-row on IBM i (#4197)
On IBM i this test fails asserting the write queue size.
The test expects the queue size to be greater than 0 but
the queue size is 0 on IBM i.

66160d6973/test/test-tcp-write-in-a-row.c (L75)

The test expects the write to get queued because the size of the data
is larger than the send and receive buffers.

66160d6973/test/test-tcp-write-in-a-row.c (L39-L40)

For some reason the request does not seem to get queued on IBM i.
The root cause of the issue will need further investigation.

Part of #4143
2023-12-12 15:19:02 -05:00
Stephen Gallagher
de43f42735
test_fs.c: Fix issue on 32-bit systems using btrfs (#4227)
On Fedora's build system, the build environment runs on btrfs. This
revealed a bug in the test on i686 systems, where this comparison was
being performed as a comparison of two signed integers, but the
filesystem type of btrfs happens to use the higher-order bits, resulting
in it appearing as a negative value.

BTRFS_SUPER_MAGIC     0x9123683e

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-11-24 11:18:51 +01:00
Ben Noordhuis
6be130e1b8
unix,win: fix read past end of pipe name buffer (#4209)
Passing a socket name without a trailing nul byte to uv_pipe_bind2() or
(on Windows) uv_pipe_connect2() resulted in reading beyond the end of
the name buffer when copying or converting it.

Fix that by copying the socket name to temporary storage first and add
the trailing nul byte explicitly.

Add a check for embedded nul bytes in the socket name.

Fix a small memory leak in the Windows error path of uv_pipe_bind2().
2023-11-16 09:05:51 +01:00
Jameson Nash
35da5ded3b
win: remove check for UV_PIPE_NO_TRUNCATE (#4221)
There is no length at which this gets truncated on Windows. The
underlying file system will just not successfully connect to a longer
path (in WTF-16 characters), which will return an error asynchronously
with the existing API.

Refs: #4040
2023-11-15 15:08:49 +01:00
Ben Noordhuis
54d8364c24
test: check if ipv6 link-local traffic is routable (#4220)
Fixes: https://github.com/libuv/libuv/issues/4211
2023-11-14 22:09:30 +01:00
Jameson Nash
d843b7cf7f
pipe: add back error handling to connect / bind (#4202)
This was incorrectly dropped by #4030, where previously connecting to ""
might fail eventually, now instead it would return EINVAL and then fail
to initialize the struct or call the callback.
2023-11-14 09:26:53 -05:00
Hao Hu
e135dfe183
unix,win: utility for setting priority for thread (#4075)
Add uv_thread_setpriority for setting priority for threads created by
uv_thread_create. Add uv_thread_getpriority for getting thread priority.

For Linux by default, if the scheduling policy is SCHED_OTHER and the
priority is 0, we need to set the nice value.

Fixes: https://github.com/libuv/libuv/issues/4051
2023-11-14 11:30:46 +01:00
Ben Noordhuis
f01219dfb7
test: don't run tcp_writealot under msan (#4214)
The test is prone to time out at the best of times, never mind when
running under MemorySanitizer.
2023-11-10 20:17:31 +01:00
Matheus Izvekov
93efccf4ee
build: add windows ubsan and clang ci (#4138)
Fixes a detected error: incompatible pointer to integer conversion
passing 'uv_os_fd_t' (aka 'void *') to parameter of type 'SOCKET' (aka
'unsigned long long').

Use upstream llvm to work-around broken VS2022 clang unable to link.
2023-10-30 15:16:57 -04:00
Jameson Nash
f388908593
misc: export WTF8 conversion utilities (#4021)
As promised in #2970, this attempts to migrate code to a common set of
utilities in a common place in the code and use them everywhere. This
also exports the functionality, since the Windows API with
WideCharToMultiByte is fairly verbose relative to what libuv and
libuv's clients typically need, so it is useful not to require clients
to reimplement this conversion logic unnecessarily (and because Windows
is not 64-bit ready here, but this implementation is.)
2023-10-28 21:04:57 -04:00
Ben Noordhuis
56fca44a4b
build: run sanitizers on macos ci (#4189)
Skip three fs_event tests that time out under Thread Sanitizer.
2023-10-28 15:05:42 +02:00
prubel
815dd8a25c
test: 192.0.2.0/24 is the actual -TEST-NET-1 (#4133)
Section 3 of rfc 5737 lists 192.0.2.0/24 as TEST-NET-1,
fix confusion about /8 and /24.
2023-10-18 00:24:34 +02:00
Pleuvens
d8669609d8
test: switch from ASSERT_* to ASSERT_PTR_* (#4163)
Also introduce a new ASSERT_PTR_LT macro.
2023-10-12 20:47:44 +02:00
Abdirahim Musse
75f7de4010
test: fix get_passwd2 on IBM i (#4154)
uid 0 is `qsecofr` on IBM i.

Refs: https://github.com/libuv/libuv/issues/4143
2023-10-06 18:25:40 +00:00
Pleuvens
011a1ac1a3
test: switch to new-style ASSERT_EQ macros (#4159)
Switch from old-style ASSERT macro to new-style ASSERT_EQ,... macros.

Using new-style macros makes it easier to debug test failures

Fixes: https://github.com/libuv/libuv/issues/2974
2023-10-06 19:50:15 +02:00
SmorkalovG
2a4cab70ef
unix: reset signal counters after fork (#3485)
If a signal was received but was not dispatched before fork then
caught_signals counter should be reset. Closing of signal pipe makes
impossible to receive the signal that was counted.
There is no need in this signal because it was sent to parent process

Fixes: https://github.com/libuv/libuv/issues/3483
2023-09-29 12:54:35 +02:00
Santiago Gimeno
d277f71333
test: skip tests when ipv6 is not available (#4151) 2023-09-26 21:55:32 +02:00
Kyle Edwards
c97017dd1d
win,spawn: allow %PATH% to be unset (#4116)
Fix: https://github.com/libuv/libuv/issues/4115
2023-08-14 15:25:11 -04:00
Ben Noordhuis
e893cd6826
unix: set ipv6 scope id for link-local addresses (#4107)
Link-local addresses (prefix fe80::/64) don't route unless you specify
the network interface to use so make libuv do that.

Fixes: https://github.com/nodejs/node/issues/48846
2023-08-03 22:18:50 +02:00
Ben Noordhuis
55376b044b
test: enable disabled spawn_same_stdout_stderr (#4105)
This test was added in commit e403a2c486 from 2014 but its author forgot
to enable it.
2023-07-25 16:48:22 +02:00
Ben Noordhuis
9c1de6e93f
test: enable disabled fs_link (#4104)
This test was added in commit 060026ced from 2011 but its author forgot
to actually enable it.
2023-07-25 16:48:04 +02:00
Ben Noordhuis
49d83c0301
test: enable disabled tcp_connect6_error_fault (#4103)
The test was added in commit e3f2631127 from 2011 but it appears the
author forgot to add it to the test list.

The other test from that commit was enabled by yours truly in 2012 in
7447048981 but apparently I overlooked the second test as well.
2023-07-25 15:58:08 +02:00
Ben Noordhuis
2f87d5c114
test: fix license blurb (#4085)
Fixes: https://github.com/libuv/libuv/issues/4080
2023-07-10 10:37:38 +02:00
小明
ca544ed6fc
unix: skip prohibited syscalls on tvOS and watchOS (#4043) 2023-06-23 11:09:53 +02:00
Trevor Norris
6df5a72151
test: add uv_cancel test for threadpool (#4065 2/2)
Check that uv_cancel() returns UV_EBUSY when called while the uv_work_cb
is being executed.
2023-06-21 11:31:44 -06:00
Trevor Norris
3e0b846bdb
bench: add bench to check uv_loop_alive (#4065 1/2) 2023-06-21 11:31:25 -06:00
Ben Noordhuis
2bf97f123f test,win: fix -Wformat warning 2023-06-19 21:41:06 +02:00
Ben Noordhuis
9179888c2b test,win: fix -Wunused-variable warning 2023-06-19 21:41:06 +02:00
Trevor Norris
24d1d0802d
src: don't run timers if loop is stopped/unref'd (#4048)
The initial run of timers shouldn't happen if uv_stop() has been run
before uv_run() was called, and for backwards compatibility they also
shouldn't run if they have been unref'd before calling uv_run().
2023-06-16 11:00:06 -06:00
Ben Noordhuis
2f1614b128
unix,win: add UV_PIPE_NO_TRUNCATE flag (#4040)
Libuv's default behavior is to truncate long Unix socket paths. The flag
tells it to return an error instead.

Fixes: https://github.com/libuv/libuv/issues/4036
2023-06-06 17:08:36 +02:00
Ben Noordhuis
b9b6db052b
linux: support abstract unix sockets (#4030)
Add two new APIs for binding and connecting to abstract UNIX sockets.

Fixes: https://github.com/libuv/libuv/issues/4028
2023-06-04 22:43:14 +02:00
Ben Noordhuis
1b01b786c0
unix,win: replace QUEUE with struct uv__queue (#4022)
Recent versions of gcc have started emitting warnings about the liberal
type casting inside the QUEUE macros. Although the warnings are false
positives, let's use them as the impetus to switch to a type-safer and
arguably cleaner approach.

Fixes: https://github.com/libuv/libuv/issues/4019
2023-05-25 00:04:30 +02:00
Stefan Karpinski
8f32a14afa
fs: use WTF-8 on Windows (#2970)
This allows working with valid filenames that are not well-formed
UTF-16. This is a superset of UTF-8, which does not error when it
encounters an unpaired surrogate but simply allows it.

Fixes: https://github.com/libuv/libuv/issues/2048
Refs: https://simonsapin.github.io/wtf-8/
Replaces: https://github.com/libuv/libuv/pull/2192 by Nikolai Vavilov <vvnicholas@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2023-05-23 10:25:38 -04:00
Santiago Gimeno
962b8e626c
linux: add some more iouring backed fs ops (#4012)
Specifically: `link`, `mkdir`, `rename`, `symlink` and `unlink`.
2023-05-23 10:42:20 +02:00
Ben Noordhuis
5bf18a6e88
test: remove erroneous RETURN_SKIP (#4015)
The threadpool_multiple_event_loops test already calls RETURN_SKIP when
needed. Remove it from the callback function where it isn't needed work
(nor works) and generates a build warning when compiling for qemu.

Fixes: https://github.com/libuv/libuv/issues/4014
2023-05-23 00:24:39 +02:00
Santiago Gimeno
07261493a7 Revert "win: implement uv_try_write() for pipes(#3825 1/2)"
This reverts commit 244e0e2059.

For some reason this is breaking node.js IPC. I plan to investigate it
but we can let this for the next release.t

PR-URL: https://github.com/libuv/libuv/pull/4003
2023-05-19 11:08:49 +02:00
Santiago Gimeno
03bb703741 Revert "win: fixes in uv__pipe_try_write() (#3825 2/2)"
This reverts commit e1143f1265.

For some reason this is breaking node.js IPC. I plan to investigate it
but we can let this for the next release.

PR-URL: https://github.com/libuv/libuv/pull/4003
2023-05-19 11:08:49 +02:00
Ben Noordhuis
1a56f68451
test: fix -Wbool-compare compiler warning (#3996)
Fixes: https://github.com/libuv/libuv/issues/3995
2023-05-16 10:56:41 +02:00
Santiago Gimeno
30fc896cc1
unix: handle CQ overflow in iou ring (#3991)
When there are more than 128 concurrent cq completions the CQ ring
overflows as signaled via the `UV__IORING_SQ_CQ_OVERFLOW`. If this
happens we have to enter the kernel to get the remaining items.
2023-05-15 10:42:14 +02:00
Mohammed Keyvanzadeh
8a5b0955de
test: add additional assert (#3983)
Add a missing assert that checks whether `uv_pipe_init()`
succeeded or not.
2023-05-12 14:13:23 -04:00
cui fliter
3990fcad62
docs: fix some typos (#3984) 2023-05-12 14:12:01 -04:00
Ben Noordhuis
c8a1e6132b
unix,win: add uv_clock_gettime() (#3971)
Fixes: https://github.com/libuv/libuv/issues/1674
2023-04-27 22:13:46 +02:00
Trevor Norris
e02642cf3b src: fix events/events_waiting metrics counter (#3957)
The worker pool calls all callbacks locally within the queue. So the
value of nevents doesn't properly reflect that case. Increase the number
of events directly from the worker pool's callback to correct this.

In order to properly determine if the events_waiting counter needs to be
incremented, store the timeout value at the time the event provider was
called.
2023-04-24 15:29:14 -06:00
Trevor Norris
b60f08e782 test: add ASSERT_OK (#3957)
The majority of uses for ASSERT_EQ are to check if the return value is
0. So make a macro specifically for this and make things easier to read.
2023-04-24 15:29:14 -06:00
Ben Noordhuis
dfae365f84
linux: add IORING_OP_CLOSE support (#3964) 2023-04-20 10:44:16 +02:00
Ben Noordhuis
5ca5e475bb
linux: add IORING_OP_OPENAT support (#3963) 2023-04-20 10:17:06 +02:00
Ben Noordhuis
3ba75f1300
test: disable signal test under ASan and MSan (#3961)
The signal_multiple_loops test is flaky when run under AddressSanitizer
and MemorySanitizer. Sometimes thread creation fails, other times it
simply times out.

Fixes: https://github.com/libuv/libuv/issues/3956
2023-04-19 07:40:18 +02:00
Ben Noordhuis
d2c31f429b
linux: introduce io_uring support (#3952)
Add io_uring support for several asynchronous file operations:

- read, write
- fsync, fdatasync
- stat, fstat, lstat

io_uring is used when the kernel is new enough, otherwise libuv simply
falls back to the thread pool.

Performance looks great; an 8x increase in throughput has been observed.

This work was sponsored by ISC, the Internet Systems Consortium.

Fixes: https://github.com/libuv/libuv/issues/1947
2023-04-18 12:32:08 +02:00
Ben Noordhuis
cb5da59226
test: don't use static buffer for formatting (#3953)
Don't use a static buffer to hold human-readable "big" numbers.

The buffer isn't big enough for benchmarks like fs_stat that print a
large number of them. Have the caller pass in a buffer instead.
2023-04-14 16:54:28 +02:00
Trevor Norris
6600954906
win,unix: change execution order of timers (#3927)
The maximum number of times timers should run when uv_run() is called
with UV_RUN_ONCE and UV_RUN_NOWAIT is 1. Do that by conditionally
calling timers before entering the while loop when called with
UV_RUN_DEFAULT.

The reason to always run timers at the end of the while loop, instead of
at the beginning, is to help enforce the conceptual event loop model.
Which starts when entering the event provider (e.g. calling poll).

Other than only allowing timers to be processed once per uv_run()
execution, the only other noticeable change this will show is if all the
following are true:
* uv_run() is called with UV_RUN_NOWAIT or UV_RUN_ONCE.
* An event is waiting to be received when poll is called.
* Execution time between the call to uv_timer_start() and entering the
  while loop is longer than the timeout.

If all these are true, then timers that would have executed before
entering the event provider will now be executed afterward.

Fixes: https://github.com/libuv/libuv/issues/3686
Co-authored-by: Momtchil Momtchev <momtchil@momtchev.com>
2023-03-20 10:04:57 -06:00
Trevor Norris
91a7e49846
test: silence more valgrind warnings (#3917)
Pass the loop to MAKE_VALGRIND_HAPPY() so it's explicit on which loop
needs to be cleaned up. Since it asserts on uv_loop_close(), need to
remove a couple of those that were being done before the call.

Cleanup where loop was assigned, so the entire test either uses loop or
uv_default_loop(). Not both.

Also take care of any reqs that may have been left uncleaned.
2023-03-12 14:59:00 +01:00
Ben Noordhuis
9581e3df0c
test: fix visual studio 2015 build error (#3918) 2023-03-10 11:41:35 +01:00
Jameson Nash
964f79f7c8
barrier: wait for prior out before next in (#3905)
This code would previously get confused between rounds of the barrier
being called and a thread might incorrectly get stuck (deadlock) if the
next round started before that thread had exited the current round.

Avoid that by not starting the next round in++ before out-- has reached
zero indicating that all threads have left the prior round.

And fix it that on Windows by replacing the implementation with the one
from unix. There are some awkward platform-specific redirection here
with an extra malloc that is not needed on Win32, but that will be fixed
in libuv v2.

Fixes: https://github.com/libuv/libuv/issue/3872
2023-03-06 17:57:25 -05:00
Trevor Norris
460accf9be
test: make valgrind happy (#3916)
Missing a call to MAKE_VALGRIND_HAPPY() to silence valgrind output.
2023-03-03 15:52:31 -05:00
Ben Noordhuis
84525b26fe
test: remove timing-sensitive check (#3899)
Remove expectations around uv_cond_timedwait() maximum sleep time.

The OpenBSD buildbot sleeps more than 5x longer than requested. It no
longer makes sense to expect some reasonable upper bound because at that
point we've moved well beyond reasonable.

Fixes: https://github.com/libuv/libuv/issues/3896
2023-02-07 11:15:59 -05:00
Ben Noordhuis
f1b4c76648
test: remove bad tty window size assumption (#3895)
Fixes: https://github.com/libuv/libuv/issues/3894
2023-01-31 18:35:18 +01:00
Jameson Nash
ee206367d4
build,test: fix distcheck errors (#3886)
When run under distcheck, the libuv source permissions are read-only,
which makes this test copyfile fail without explicit correction to the
permissions.
2023-01-22 15:26:22 -06:00
James McCoy
2638237e1f
build: add CI for OpenBSD and FreeBSD (#3548)
Fixes: https://github.com/libuv/libuv/issues/3510
2023-01-21 13:52:36 +01:00
Ben Noordhuis
a3b7dfcfca test: cond-skip tcp_writealot
Too slow to run under ThreadSanitizer.

Refs: https://github.com/libuv/libuv/issues/3681
2023-01-20 22:38:59 +01:00
Ben Noordhuis
bcbaf671a9 test: cond-skip signal_multiple_loops
ThreadSanitizer's complaints about data races are likely legitimate but
they are pre-existing and not straightforward to fix with the current
design. Something for later.

Refs: https://github.com/libuv/libuv/issues/3681
2023-01-20 22:38:59 +01:00
Ben Noordhuis
c58cd28279 test: cond-skip fork_threadpool_queue_work_simple
Skip the test when ThreadSanitizer is active because the latter doesn't
support forking in multi-threaded processes.

Refs: https://github.com/libuv/libuv/issues/3681
2023-01-20 22:38:59 +01:00
Ben Noordhuis
f328457cb1 test: fix ThreadSanitizer data race warning
Legitimate if fairly benign warning: the `stop` global variable was
read and written without proper synchronization; `volatile` isn't
sufficient.

Refs: https://github.com/libuv/libuv/issues/3681
2023-01-20 22:38:59 +01:00
Ben Noordhuis
7b5a21deaa test: fix ThreadSanitizer data race warning
Refs: https://github.com/libuv/libuv/issues/3681
2023-01-20 22:38:59 +01:00
Ben Noordhuis
895a1c03be test: fix ThreadSanitizer data race warning
Refs: https://github.com/libuv/libuv/issues/3681
2023-01-20 22:38:59 +01:00
Ben Noordhuis
679d679f25 test: fix ThreadSanitizer thread leak warning
Refs: https://github.com/libuv/libuv/issues/3681
2023-01-20 22:38:59 +01:00
panran
a4ba1bd73e
test: fix some warnings when compiling tests (#3816)
```
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
note: in expansion of macro 'ASSERT_BASE'
#define ASSERT_EQ(a, b) ASSERT_BASE(a, ==, b, int64_t, PRId64)

warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but
argument 3 has type ‘uint32_t’ {aka ‘unsigned int’}
```

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2023-01-19 10:48:13 -06:00
Jameson Nash
2f110a50df
misc: extend getpw to take uid as an argument (#3523)
File system operations may return uid and gid values, which we may want
to pretty-print. We already have the code for getting information for
the current user, so just need to add a parameter to make it exposed for
every user. We expose information about groups in a similar manner also.
2023-01-17 21:51:28 -06:00
Darshan Sen
7fd7e8264f
win,fs: fix readlink errno for a non-symlink file (#3719)
In Node.js, fs.readlink() on a non-symlink file used to throw an UNKNOWN
error on Windows. This change maps ERROR_NOT_A_REPARSE_POINT to
UV_EINVAL, so that now it throws EINVAL just like other platforms.

This is handled explicitly in `fs__readlink`, since elsewhere it might
map to EPERM instead (such as in `link`).
2023-01-17 21:04:52 -06:00
Ben Noordhuis
5ee455ffc2
build: enable platform_output test on qemu (#3878)
The test was disabled because of a qemu bug that is presumed to have
since been fixed.

Refs: https://github.com/libuv/libuv/pull/3861
2023-01-12 15:22:19 +01:00
Ben Noordhuis
d5cfb89959
test: unflake fs_event_watch_dir test (#3863)
Increase the timer interval. That hopefully ameliorates the problem of
FSEvents.framework missing events on the macOS CI buildbot.

Not really a fix, more a mitigation.

Fixes: https://github.com/libuv/libuv/issues/3862
2022-12-21 07:51:50 +01:00
Santiago Gimeno
abf77a9eda
test: fix some unreachable code warnings (#3851) 2022-12-10 19:36:46 +01:00
Santiago Gimeno
e1143f1265 win: fixes in uv__pipe_try_write() (#3825 2/2)
Return `UV_EAGAIN` on `ERROR_OPERATION_ABORTED`.
Use the correct format for `overlapped.hEvent`.
Some refactoring to always wait for the overlapped result.
Modernize tests and some improvements.
2022-12-01 23:16:58 +01:00
Ben Noordhuis
244e0e2059 win: implement uv_try_write() for pipes(#3825 1/2) 2022-12-01 23:16:58 +01:00
Stefan Stojanovic
c17bd99f1c
win: fix fstat for pipes and character files (#3811)
Calling uv_fs_fstat for file types other then disk type was resulting in
error on Windows while it was retrieving data on Linux. This change
enables getting fstat for pipes and character files on Windows with data
fetched being as reasonable as possible.

A simple test is also added to check this behavior on all platforms. It
uses stdin, stdout and stderr. uv_fs_fstat needs to pass with disk files
pipes and character files (eg. console).

Refs: https://github.com/nodejs/node/issues/40006
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2022-11-29 17:46:09 -05:00
Ben Noordhuis
5102b2c093
unix: drop kfreebsd support (#3835)
Because kFreeBSD is dead. RIP.

Fixes: https://github.com/libuv/libuv/issues/3833
2022-11-28 22:45:28 +01:00
Ben Noordhuis
238ba3b625
test: fix -Wunused-but-set-variable warnings (#3829) 2022-11-26 22:30:04 +01:00
Tim Besard
988d225cf0
unix,win: add uv_get_available_memory() (#3754) 2022-11-24 22:09:32 +01:00
daomingq
64669fdd8d
thread: add uv_thread_getcpu() (#3803)
Add uv_thread_getcpu() api to get the cpu number on which the calling
thread is running.
2022-11-15 18:01:29 +01:00
Trevor Norris
e141586053
src: add new metrics APIs (#3749)
The following metrics are now always recorded and available via the new
uv_metrics_info() API.

* loop_count: Number of event loop iterations.
* events: Total number of events processed by the event handler.
* events_waiting: Total number of events waiting in the event queue when
  the event provider request was made.

Benchmarking has shown no noticeable impact recording these metrics.

PR-URL: https://github.com/libuv/libuv/pull/3749
2022-11-11 16:21:58 +01:00
Santiago Gimeno
3706c4f855 win,pipe: fixes in uv_pipe_connect()
Make unices and windows consistent when closing a pipe while it's
connecting so they all return `UV_ECANCELED`.

Avoid race condition between `pipe_connect_thread_proc()` and `uv_close()` when
accessing `handle->name`.

Fixes: https://github.com/libuv/libuv/issues/3578
2022-11-11 10:44:34 +01:00
Santiago Gimeno
96637d032f win,test: change format of TEST_PIPENAME's
So `WaitNamedPipe()` doesn't fail. Increase the number of clients in
`pipe_connect_multiple` so `CreateFile()` returns `ERROR_PIPE_BUSY` and
the codepath leading to `WaitNamedPipe()` is exercised.
2022-11-11 10:44:34 +01:00
ywave620
dff3f8ccab
win: optimize udp receive performance (#3807)
Do at most 32 nonblocking udp receive in a row.

Fixes: https://github.com/libuv/libuv/issues/3704
2022-11-08 10:23:40 +01:00
Saúl Ibarra Corretgé
a7b16bfb33 win: drop code checking for Windows XP / Server 2k3
Our minimum requirements are Windows 8 now.
2022-11-08 06:51:07 +01:00
daomingq
e900006642
thread: add support for affinity (#3774)
Backported thread affinity feature and related dependency commits
from master. It will add support for those APIs: uv_cpumask_size,
uv_thread_setaffinity, uv_thread_getaffinity.
The supported platforms are Linux, Freebsd, and Windows.
Empty implementations (returning UV_ENOTSUP) on non-supported platforms
(such as OS X and AIX).
2022-10-21 09:18:10 -04:00
Ben Noordhuis
acfe668ecb
build: add MemorySanitizer (MSAN) support (#3788)
- unpoison results from linux system call wrappers

- unpoison results from stat/fstat/lstat to pacify clang 14
  (fixed in later versions)

- add MSAN build option

- turn on MSAN CI build
2022-10-18 23:21:42 +02:00
ywave620
3e7d2a6492
stream: process more than one write req per loop tick (#3728)
Fixes: https://github.com/libuv/libuv/issues/3668
2022-10-08 10:23:01 +02:00
Ben Noordhuis
b00d1bd225
unix,win: fix memory leak in uv_fs_scandir() (#3760)
uv_fs_scandir() leaked an entry when you called it on a directory with
a single entry _and_ you didn't run the iterator until UV_EOF.

Fixes: https://github.com/libuv/libuv/issues/3748
2022-09-22 09:25:55 +02:00
Ben Noordhuis
48c90d3781 build: upgrade qemu-user-static package
4.2 is three years old by now. The linux/alpha emulator in that version
doesn't support the epoll_create1() system call.
2022-09-19 00:24:24 +02:00
Ben Noordhuis
9d898acc56
test: fix musl libc.a dlerror() test expectation (#3735)
Dynamic loading with musl only works with libc.so because it is
is implemented in musl's dynamic linker, not in libc proper.

libc.a contains just a stub dlopen() that always fails with a "Dynamic
loading not supported" error message. Update the test to handle that.

Fix: https://github.com/libuv/libuv/issues/3706
2022-09-07 11:21:24 -04: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
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