Commit Graph

5303 Commits

Author SHA1 Message Date
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
AJ Heller
0235e150e2
build: add libuv:: namespace to libuvConfig.cmake (#3596)
This may be breaking, but is still quite new, and seems to follow cmake
best practices.
2023-01-19 16:07:29 -06:00
erw7
17ea56ee73
build: Improve build by cmake for Cygwin (#2085)
- Fix build on Cygwin.
- Simplify file name of static library.

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2023-01-19 15:33:07 -06:00
Tamás Bálint Misius
b4440f5aa2
doc: document uv_fs_cb type (#3517) 2023-01-19 14:05:07 -06:00
Jameson Nash
fe7ee4a624
unix: remove busy loop from uv_async_send (#3879)
The current fix (libuv#2231) was found to be slow in certain cases. This
change should improve scalabaility a bit by only incurring the spin loop
delay while closing an UV_ASYNC. It also is intended to slightly improve
the behavior after uv_loop_close is called, by parking all of the
pending flags as set, so that it will not access the loop at all (until
the uv_async_t memory is freed, which we leave still to the
responsibility of the user).

Note that this bug appears to still exist on Win32, though it's harder
to address without the refactoring done to this code on libuv master.

Takes some inspiration from https://github.com/libuv/libuv/pull/2654
Takes some inspiration from https://github.com/libuv/libuv/pull/2656
Refs: https://github.com/libuv/libuv/pull/2231
2023-01-19 14:03:59 -06:00
Jameson Nash
a40058dbd1
build: add CI for distcheck (#3571)
Refs: https://github.com/libuv/libuv/issues/2190#issuecomment-465974240
Refs: https://github.com/libuv/libuv/issues/2199

Co-authored-by: Richard Lau <rlau@redhat.com>
2023-01-19 14:00:45 -06:00
Jameson Nash
c70cc5832b
build,win: add mingw-w64 CI configuration (#3885)
Co-authored-by: Nicolas Noble <pixel@nobis-crew.org>
2023-01-19 14:00:15 -06: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
Ben Noordhuis
61e0bbda6b
doc: clean up license file (#3876)
GitHub gets confused by the non-standard format of the LICENSE file.
Move the extra bits into the creatively named LICENSE-extra file.

Fixes: https://github.com/libuv/libuv/issues/3875
2023-01-19 10:46:25 -06:00
Jameson Nash
a38c4dfa99
docs: update Sphinx version on RTD (#3882)
python3.9 -mvirtualenv sphinx
    . sphinx/bin/activate
    pip install Sphinx
    pip freeze > requirements.txt
2023-01-18 12:15:48 -06:00
Jameson Nash
975f685d69
docs: add CI for docs PRs (#3884) 2023-01-18 11:29:10 -06:00
Jameson Nash
4155405e60
docs: delete code Makefile (#3883)
This Makefile was a fairly poor sample, while now we have CMake for
these to use for testing.
2023-01-18 10:16:29 -06:00
Ben Noordhuis
55b5d88b01
unix,win: use static_assert when available (#3189)
Fixes: https://github.com/libuv/libuv/issues/3131
2023-01-17 22:26:41 -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
Jack·Boos·Yu
1279a20c03
docs: add vcpkg instruction step (#3747)
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
2023-01-17 20:54:36 -06:00
dundargoc
39f9189f34
build: remove unnecessary policy setting (#3873)
All cmake policies up to CMP0065 are set to NEW by default since the
minimum required version is 3.4.
2023-01-14 11:12:51 +01:00
Ben Noordhuis
434eb4b0ac
linux: handle cpu hotplugging in uv_cpu_info() (#3861)
On Linux, CPUs can come online or go offline while uv_cpu_info() is busy
gathering data. Change uv_cpu_info() in the following ways:

1. Learn online CPUs from /proc/stat

2. Get the model name from /proc/cpuinfo when it has a matching CPU,
   or default to "unknown"

3. Get speed from /sys/devices/system/cpu/cpu%u/cpufreq/scaling_cur_freq
   when it exists, or default to 0

Before this commit, libuv read the speed from /proc/cpuinfo but that
reports the base frequency, not the actual frequency. My system has
two cores running permanently at 3.6 GHz but libuv thought all 12 ran
at 2.2 GHz.

Fixes: https://github.com/libuv/libuv/issues/2351
Fixes: https://github.com/libuv/libuv/issues/3858
2023-01-14 05:08:15 +01: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
e972c6705f
build: add UndefinedBehaviorSanitizer support (#3870)
- add UBSAN build option

- turn on UBSAN CI build

Fixes: https://github.com/libuv/libuv/issues/3869
2023-01-04 23:43:50 +01:00
Zvicii
12b8c116a4
build: add define guard around UV_EXTERN (#3855)
Incidentally lets users control the definition of UV_EXTERN.
2023-01-03 22:03:37 +01:00
Ben Noordhuis
e9d91fccfc
darwin: remove unused fsevents symbol lookups (#3867)
One hasn't been in use since 2017, the other since 2013.
2022-12-22 00:51: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
Ben Noordhuis
a3de1384c3
linux: simplify uv_uptime() (#3859)
Drop support for old kernels. Assume support for CLOCK_BOOTTIME.
2022-12-15 12:57:14 +01:00
Santiago Gimeno
abf77a9eda
test: fix some unreachable code warnings (#3851) 2022-12-10 19:36:46 +01:00
Santiago Gimeno
75d9411e80
win: move child_stdio_buffer out of uv_process_t (#3850) 2022-12-09 13:27:52 +01:00
Ben Noordhuis
cc000cfb5e
build: drop qemu-alpha from ci matrix (#3848)
As of recent, the fs_partial_read and fs_partial_write tests reliably
fail on that architecture.

An upgrade from Ubuntu 20.04 to 22.04 on the CI machines is suspected,
not any changes in libuv itself.

Perhaps it's possible to work around it in the tests but as Alpha is a
dead architecture, it doesn't seem worthwhile to sink time in that.
Let's remove it from the CI matrix instead.

Fixes: https://github.com/libuv/libuv/issues/3843
2022-12-06 22:57:52 +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
Ben Noordhuis
1a91508857 win: fix -Wunused-function warning 2022-12-01 11:27:49 +01:00
Ben Noordhuis
a138041c59 win: fix -Wunused-variable warning 2022-12-01 11:27:49 +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
Sergey Rubanov
2c6858a018
Add Socket Runtime to the LINKS.md
PR-URL: https://github.com/libuv/libuv/pull/3834
2022-11-28 09:51:45 -05:00
Ben Noordhuis
8ddffeeea3
doc: bump min supported linux and freebsd versions (#3830)
The old Linux baseline was essentially RHEL 6 but that distro has been
out of support for two years now. Move to RHEL 7.

This commit also moves FreeBSD to tier 2 because it isn't actually
part of libuv's CI matrix, only Node's.

Fixes: https://github.com/libuv/libuv/issues/3822
2022-11-28 12:00:27 +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
Edward Humes
a737255791
build: don't use ifaddrs.h on solaris 10 (#3826)
Disable usage of ifaddrs.h on Solaris 10 at configuration time.
2022-11-22 21:46:55 +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
theanarkh
6f69654294
misc: fix return value of memory functions (#3818)
Specifically uv_get_free_memory and uv_get_total_memory.
2022-11-11 10:56:06 +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
Jameson Nash
3300502231
darwin: use hw.cpufrequency again for frequency info (#3679)
This reverts commit 87f0765159 and
implements a work-around instead. This has been reported to be
unnecessary, and also returns the wrong answer (off by exactly 100x),
so it is not particularly useful.

This also reverts the bugfixes to the original PR:

Revert "darwin: fix iOS compilation and functionality"
This reverts commit 1addf9b88a.

Revert "macos: fix the cfdata length in uv__get_cpu_speed (#3356)"
This reverts commit 1e7074913e.

Revert "darwin: fix -Wsometimes-uninitialized warning"
This reverts commit 6085bcef8d.

Revert "macos: fix memleaks in uv__get_cpu_speed"
This reverts commit d2482ae121.

The expected behavior on failure to read this info is to report 0 (for
example
https://github.com/libuv/libuv/blob/8975c05d199558b0cc2e98f26ce33c6090d1
d7a1/src/unix/linux.c#L834), which is which was not the case before
this PR for macos.

However hw.cpufrequency sysctl seems to be missing on darwin/arm64
(Apple Silicon), so we instead hardcode a plausible value. This value
matches what the mach kernel will report when running Rosetta apps.

Fixes: https://github.com/libuv/libuv/issues/3642
Fixes: https://github.com/libuv/libuv/issues/2911
Refs: https://github.com/libuv/libuv/pull/2912
2022-11-08 12:40:17 -05:00
Ben Noordhuis
8975c05d19
doc: document 0 return value for free/total memory (#3817)
Refs: https://github.com/libuv/libuv/discussions/3809
2022-11-08 17:33:19 +01:00
twosee
07949ce2ae
win: fix an incompatible types warning (#3798) 2022-11-08 10:24:45 +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
Qix
8a1f378f05
doc: mention close_cb can be NULL (#3810) 2022-11-08 09:57:54 +01:00
twosee
ec5130c3f9
unix,win: fix 'sprintf' is deprecated warning (#3813) 2022-11-08 09:56:14 +01:00