Commit Graph

5368 Commits

Author SHA1 Message Date
Hüseyin Açacak
4e310d0f90
win,fs: use the new Windows fast stat API (#4327)
Windows added a new API for file information, which doesn't have to
open the file thus greatly improving performance:
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyname

The stat functions are already covered by tests, so no test was added
here. I considered comparing the result of old and new code, but that
would require exposing internal fs functions, and we would be testing
Windows functionality, not libuv.
2024-07-30 08:58:41 -04:00
Abdirahim Musse
f23037fe21
test: pipe_overlong_path handle ENAMETOOLONG 2024-07-30 08:07:52 +02:00
Andy Pan
e5cb1d3d3d
linux: eliminate a read on eventfd per wakeup (#4400)
Register the eventfd with EPOLLET to enable edge-triggered notification
where we're able to eliminate the overhead of reading the eventfd via
system call on each wakeup event.

When the eventfd counter reaches the maximum value of the unsigned 64-bit,
which may not happen for the entire lifetime of the process, we rewind the
counter and retry.

This optimization saves one system call on each event-loop wakeup,
eliminating the overhead of read(2) as well as the extra latency
for each epoll wakeup.
2024-07-29 19:59:41 -04:00
dependabot[bot]
63b22be083
ci: bump actions/checkout to 4 (#4474)
Held back one due to https://github.com/libuv/libuv/pull/4451
2024-07-29 19:54:23 -04:00
Santiago Gimeno
badecdca14
fsevents: detect watched directory removal (#4376)
Which was broken both in `windows` and `macos`.
2024-07-30 00:59:38 +02:00
Hüseyin Açacak
83306585ff
win: fix env var in uv_os_homedir and uv_os_tmpdir (#4464)
If the corresponding environment variables are empty, the
uv_us_homedir() and uv_os_tmpdir() return garbage values. The reason
for this situation is the Windows API which doesn't return an error
even if the path is empty.

This PR fixes this problem by checking the return value of the API
call. If it is not an error and the length of the value is less than 3,
uv_us_homedir() and uv_os_tmpdir() will return UV_ENOENT.

Fixes: https://github.com/libuv/libuv/issues/2328
2024-07-29 17:50:11 -04:00
Ian Butterworth
18266a6969
win,fs: use posix delete semantics, if supported (#4318)
Implements posix delete for files and dirs, with fallback to the old
method if not supported (e.g. Fat32 or Win8).

Fixes: #3839
2024-07-29 17:38:26 -04:00
Ben Noordhuis
0c36b16d1b
test,openbsd: remove superfluous ifdef guard (#4461)
The test is skipped in its entirety on OpenBSD so there is no point in
compiling out code on said platform later on, it's not run anyway.
2024-07-29 16:45:31 -04:00
Viacheslav Muravyev
e4d47c5357
misc: remove splay trees macros (#4469) 2024-07-29 16:45:12 -04:00
Ben Noordhuis
593aa3b2f6
test: handle zero-length udp datagram (#4344)
Under rare but benign circumstances (on XNU), incoming datagrams appear
to be dropped by the operating system after libuv has been notified of
their arrival but before libuv has had a chance to receive them.

Fixes: https://github.com/libuv/libuv/issues/4219
2024-07-29 16:30:08 -04:00
Jameson Nash
47c833675b
win,error: remap ERROR_NO_DATA to EAGAIN (#4471)
This was incorrectly mapped originally, which makes for confusing error
messages about an EPIPE if a program happens to (unwisely) set PIPE_WAIT
on the handle. It is unclear to me if libuv should try to handle this in
some meaningful way, and very unclear what that way would look like, but
at least expose this to the caller with the correct errno translation.
2024-07-29 16:16:49 -04:00
dependabot[bot]
372e4c645e
ci: bump KyleMayes/install-llvm-action from 1 to 2 (#4472) 2024-07-29 16:15:23 -04:00
dependabot[bot]
6ab153cf8e
ci: bump actions/setup-python from 4 to 5 (#4475) 2024-07-29 16:13:46 -04:00
dependabot[bot]
9678211c24
ci: bump upload and download-artifact versions (#4473) 2024-07-29 16:13:00 -04:00
zeertzjq
5d1ccc12c4
doc: correct names of Win32 APIs in fs.rst (#4408)
The docs there link to GetFinalPathNameByHandleA() and CreateFileA(),
but src/win/fs.c uses GetFinalPathNameByHandleW() and CreateFileW().
2024-07-25 12:29:01 -04:00
Jameson Nash
f56f21d7da
Create dependabot.yml for updating github-actions (#4450) 2024-07-25 12:22:22 -04:00
郑苏波 (Super Zheng)
ecc11611d3 darwin: fix crash on iOS(arm64)
Disable sendfile() on iOS with arm64 architecture
to avoid crashes caused by throwing SIGSYS signal.

Fixes: #3187
2024-07-25 12:52:35 +02:00
Saúl Ibarra Corretgé
f279d9e6c6 ci: use macOS 12 for macOS and iOS builds
macOS 11 is gone: https://github.com/actions/runner-images/pull/10198
2024-07-18 13:25:43 +02:00
Olivier Valentin
ae6e146775
hurd: stub uv_thread_setpriority() 2024-07-18 11:33:39 +02:00
Olivier Valentin
90648ea3e5
hurd: add includes and macro prerequisites
- ptsname() needs _XOPEN_SOURCE >= 500
- setenv needs _POSIX_C_SOURCE >= 200112
- setgroups needs grp.h
2024-07-16 22:34:02 +02:00
Ben Noordhuis
2780b87d56
unix,win: export wtf8 functions properly (#4437)
Mark them UV_EXTERN so they are visible on Windows.

Fixes: https://github.com/libuv/libuv/issues/4436
2024-07-12 10:22:26 +02:00
Ben Noordhuis
e37539a46c
build: fix android ci build (#4451)
It's complaining in the post-run step about a missing symbol:

    /__e/node20/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version
    `GLIBC_2.28' not found (required by /__e/node20/bin/node)

For now pin actions/checkout to node 16.
2024-07-11 22:22:27 +02:00
Viacheslav Muravyev
7c491bde32
unix,win: remove unused req parameter from macros (#4435)
Remove the unused `req` parameter from the uv__req_register and
uv__req_unregister macros.
2024-07-11 21:29:15 +02:00
Uilian Ries
6621fe045a
doc: add instruction how to install with Conan (#4432)
Update the README file with instructions on how
to install libuv through the Conan package manager.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
2024-07-11 21:08:48 +02:00
Hüseyin Açacak
36f0789d83
win: map ERROR_BAD_EXE_FORMAT to UV_EFTYPE (#4445)
CreateProcessW() in uv_spawn() on Windows will fail with
ERROR_BAD_EXE_FORMAT if attempting to run a file that is not
an executable.

Refs: https://github.com/libuv/libuv/issues/2348
2024-07-11 20:41:14 +02:00
Andy Pan
fedfa9893e tcpkeepalive: distinguish OS versions and use proper time units
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-06-27 12:45:51 +02:00
Andy Pan
ba24986f8d
unix: support SO_REUSEPORT with load balancing for UDP (#4419)
Signed-off-by: Andy Pan <i@andypan.me>
2024-06-20 17:17:17 +02:00
Jeffrey H. Johnson
eb5af8e3c0
aix,ibmi: fix compilation errors in fs_copyfile (#4404)
On IBM AIX (and PASE for IBM i), use st_timespec_t
when _XOPEN_SOURCE>=700 and _ALL_SOURCE is defined.

Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
2024-05-30 22:31:15 +02:00
Andy Pan
1ee1063402
test: fix the flaky test-tcp-reuseport
Start connecting to the peers after all threads
to poll for accepting connections.

Ref: #4407
2024-05-30 09:53:44 +02:00
Juan José Arboleda
541329d51f doc: add entries for extended getpw
This patch adds documentation for the introduced `uv_os_get_passwd2`,
`uv_os_get_group`, `uv_os_free_group` methods in
https://github.com/libuv/libuv/pull/3523

Fixes: https://github.com/libuv/libuv/issues/4007
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2024-05-28 17:04:30 +02:00
Andy Pan
d2d92b74a8
unix: support SO_REUSEPORT with load balancing for TCP 2024-05-21 13:36:49 +02:00
Andy Pan
c8d4a87f49
bsd: support pipe2() on *BSD (#4412)
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-05-21 10:07:38 +02:00
Andy Pan
ab3ecf6565 unix: use the presence of SOCK_* instead of OS macros for socketpair
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-05-21 09:41:03 +02:00
Andy Pan
287987b37c test: remove the obsolete HAVE_KQUEUE macro
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-05-21 09:40:07 +02:00
Andy Pan
10ccd08471
dragonfly: disable SO_REUSEPORT for UDP socket bindings (#4410)
---------

Signed-off-by: Andy Pan <i@andypan.me>
2024-05-20 12:36:41 +02:00
Juan José
bf61390769
linux,darwin: make uv_fs_copyfile behaves like cp -r (#4396)
This commit changes the timestamps in the file, the ownership and the
group.

Fixes: https://github.com/libuv/libuv/issues/3125

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2024-05-08 11:30:30 +02:00
josedelinux
520eb622f0
doc: fix some typos 2024-04-26 13:57:26 +02:00
Saúl Ibarra Corretgé
497f3168d1 win: remove no longer needed define
Windows 7 is no longer supported.
2024-04-22 20:39:20 +02:00
Saúl Ibarra Corretgé
8083ab26e0 mailmap: update saghul's main email address 2024-04-15 16:12:10 +02:00
Saúl Ibarra Corretgé
c0a61c3bb3 darwin: simplify uv_hrtime
mach_continuous_time is available since macOS 10.12, but our minimum
version is 11, so no need for a workaround.

Also, prefer that to `clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW)` which
the documentation suggests
(https://developer.apple.com/documentation/driverkit/3438077-mach_continuous_time)
since the latter calls mach_timebase_info every time, unnecessarify: 49dcc07a40/Libc/gen/clock_gettime.c (L107)
2024-04-15 16:12:10 +02:00
Brad King
f50ae53c42
unix: de-duplicate conditions for using kqueue (#4378)
Our platform-specific headers provide a dedicated indicator.
2024-04-14 11:13:21 +02:00
Ben Noordhuis
17219b8f39
test: use newer ASSERT_MEM_EQ macro (#4346)
Should hopefully make it easier to debug CI flakiness because
currently the test sometimes fails without a clear indication why.

Refs: https://github.com/libuv/libuv/issues/4106
2024-03-31 17:27:04 +02:00
Ben Noordhuis
46c0e1769b
win: robustify uv_os_getenv() error checking (#4339)
Make it less likely for the thread-local error value to get
clobbered between performing the operation and checking the result.

Refs: https://github.com/libuv/libuv/issues/4338
2024-03-31 17:25:13 +02:00
Ben Noordhuis
4fce06ec96
unix: fix fd leaks in SCM_RIGHTS error path (#4358)
The file descriptor leak in the inner path was pointed out by @theanarkh
and I subsequently spotted another one in the outer loop. Rewrite the
function to process all control messages.

Refs: https://github.com/libuv/libuv/pull/4357
2024-03-25 12:45:40 +01:00
Ben Noordhuis
77e4cd5b18
linux: don't use sendmmsg() for single datagrams (#4366)
Benchmarking shows that sendmsg() is persistently around 1% faster for
single datagrams, and that kind of stands to reason because there is
less setup overhead, and the kernel has to copy in less data.

Fixes: https://github.com/libuv/libuv/issues/4320
2024-03-25 12:45:23 +01:00
Ben Noordhuis
d05ed869bb
doc: correct udp socket options documentation (#4371)
uv_udp_init() creates the UDP socket lazily but to set socket options
there must be, well, a socket to set the options on. Document how and
when that requirement is met.

Fixes: https://github.com/libuv/libuv/issues/4370
2024-03-25 12:44:52 +01:00
Saúl Ibarra Corretgé
abc9767034
win: simplify uv_once implementation
* win: simplify uv_once implementation

InitOnceExecuteOnce is available in Windows >= Vista.

Ref: https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initonceexecuteonce
2024-03-25 11:57:52 +01:00
Saúl Ibarra Corretgé
6adeeacee7
unix,win: error on zero delay tcp keepalive
Closes: https://github.com/libuv/libuv/pull/4350
Closes: https://github.com/libuv/libuv/issues/3487
2024-03-22 22:11:23 +01:00
tgolang
f55628eed0
doc: fix typos in ChangeLog (#4355)
Signed-off-by: tgolang <seekseat@aliyun.com>
2024-03-22 20:10:41 +01:00
Ben Noordhuis
3ecce91410
linux: don't delay EPOLL_CTL_DEL operations (#4328)
Perform EPOLL_CTL_DEL immediately instead of going through
io_uring's submit queue, otherwise the file descriptor may
be closed by the time the kernel starts the operation.

Fixes: https://github.com/libuv/libuv/issues/4323
2024-03-21 09:23:08 +01:00