Commit Graph

119 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Jameson Nash
1de43a1a17
build: support AddressSanitizer on MSVC (#3692)
Fixes: https://github.com/libuv/libuv/issues/3682
2022-10-21 09:10:19 -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
cd1a510d16
linux: merge files back into single file (#3778)
I split up linux.c around 2012 for no real reason and now I'm merging
it back together, again for no real reason.

I half-jest. I like the idea of having everything together because I
practically forgot linux-inotify.c existed. It also makes io_uring
experiments a little easier.

Last but not least, it removes about 100 lines of license boilerplate.
2022-10-02 14:09:42 +02:00
Christian Clason
f610339f74
build: add LIBUV_BUILD_SHARED cmake option (#3762)
Co-authored-by: Tim Tavlintsev <ttavlintsev@enttec.com>
Fixes: https://github.com/libuv/libuv/issues/3637
2022-10-01 19:51:09 +02:00
Ben Noordhuis
d651403b47 linux: move epoll.c back into linux-core.c
epoll.c is only used on Android and Linux after commit 5fe59726 ("sunos:
restore use of event ports") so move it back into linux-core.c

This commit removes a workaround for pre-2.6.27 kernels that don't have
the epoll_create1() system call.
2022-09-19 00:24:24 +02:00
自发对称破缺
fb85db1d3e
build: enable MSVC_RUNTIME_LIBRARY setting (#3624) 2022-07-18 15:49:17 -04:00
Ben Noordhuis
06948c6ee5
android: remove pthread-fixes.c (#3674)
This was a kludge for a bug in old versions (API level <= 16) of the
Android SDK.

The os390 port had a build dependency on the file but does not actually
use it so that too has been removed.
2022-07-15 11:18:38 +02:00
Ben Noordhuis
7825bfb49d
test: remove disabled callback_order test (#3619)
This test has always been disabled for the 10 years of its existence and
there are other tests that exercise "what happens when" event ordering.

Fixes: https://github.com/libuv/libuv/issues/3618
2022-05-09 09:17:35 +02:00
twosee
69ebb2d720
win: fix unexpected ECONNRESET error on TCP socket (#3584) 2022-04-07 21:44:45 -04:00
Guilherme Íscaro
2a31fe8552
core: add thread-safe strtok implementation (#3553)
This commit adds the support for a custom strtok implementation, which
is reentrant. On some systems strtok_r or strstep is available for that
purpose; however, since these are an extension, it is difficult to
control if it will be available on every supported system.
2022-03-22 15:15:00 -04:00
James McCoy
0b23a1ee7e
build: fix kFreeBSD build (#3566)
Define _GNU_SOURCE and link against libdl for dlopen.

Link to freebsd-glue for cmake builds.

This was previously fixed for Makefile builds in
c5d2bf12f7
2022-03-19 11:30:36 +01:00
V-for-Vasili
5ec89b8c50
aix, ibmi: handle server hang when remote sends TCP RST (#3482)
Workaround getsockname() not working for a TCP handle that has
received RST from the remote.

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2022-03-10 23:53:04 +00:00
Vittore F. Scolari
7ae0c9543d
hurd: unbreak build on GNU/Hurd (#3450)
The GNU/Hurd platform does not define IP_ADD_SOURCE_MEMBERSHIP,
IP_DROP_SOURCE_MEMBERSHIP, MCAST_JOIN_SOURCE_GROUP and 
MCAST_LEAVE_SOURCE_GROUP.

Implement a few functions for the GNU/Hurd. Specifically:

* uv_resident_set_memory (from Linux)
* uv_get_free_memory (from Linux)
* uv_get_total_memory (from Linux)
* uv_cpu_info (from cygwin)
* uv__process_title_cleanup (void)
* uv_get_constrained_memory (stub)
* Leave proctitle unimplemented on Hurd for now
* Implement hurdish uv_exepath
* Enable ifaddrs api
* Unbreak udp basics
* Unbreak futime and lutime on Hurd
2022-02-23 12:04:18 -05:00
Momtchil Momtchev
636cb8633b
bench: add uv_queue_work ping-pong measurement (#3425) 2022-02-13 00:40:35 -05:00
WenTao Ou
7a68f5ab4b
build: export uv_a for cmake (#3373) 2022-02-08 11:43:19 -05:00
Jameson Nash
125da33f82
build: fix cmake install locations (#3415)
Adds static libraries and DLL import libraries, as well as making sure
the DLLs go to the correct folder.

Closes #3414
2022-01-31 16:25:20 -05:00
Ben Noordhuis
c8cbdbd2c4
android: use libc getifaddrs() (#3412)
Fixes: https://github.com/libuv/libuv/issues/3411
2022-01-13 05:55:25 +01:00
deal
a865f78124
bsd,windows,zos: fix udp disconnect EINVAL (#3350)
Fixes: https://github.com/libuv/libuv/issues/3344
2022-01-03 11:31:29 +01:00
Campbell He
c7843ecfbc
unix,win: add uv_ip_name to get name from sockaddr (#3368)
uv_ip_name is a kind of wrapper of uv_ip4_name and uv_ip6_name
which can be used after getaddrinfo to get the IP name directly
from addrinfo.ai_addr.
2021-11-25 10:05:15 +01:00
Jameson Nash
b2614a10a5
stream: permit read after seeing EOF (#3361)
On some streams (notably TTYs), it is permitted to continue reading
after getting EOF. So still stop reading on EOF, but allow the user to
reset the stream and try to read again (which may just get EOF).

This relaxes the constraint added in ce15b8405e.
Refs: https://github.com/libuv/libuv/pull/3006
2021-11-24 19:25:47 -05:00
AJ Heller
77e6bd4874
build: fix win build with cmake versions before v3.14 (#3343)
Before v3.14, cmake throws the following error:

```
CMake Error at third_party/libuv/CMakeLists.txt:663 (install):
  install Library TARGETS given no DESTINATION!
```

I confirmed on Windows 7 and Windows Server 2016, with about a dozen
cmake versions between 3.7 and 3.22. I also confirmed that the
DESTINATION `${CMAKE_INSTALL_LIBDIR}` is populated with a valid path.

PR-URL: https://github.com/libuv/libuv/pull/3343
2021-11-02 13:58:25 -04:00
Petr Menšík
172d64bc67
build: install cmake package module
If installed into correct location, libuv can be reused in
CMakeLists.txt by:

find_package(libuv)

PR-URL: https://github.com/libuv/libuv/pull/3293
2021-11-01 13:51:06 -04:00
Jameson Nash
22d6223928
build: add experimental TSAN configuration (#3328) 2021-10-16 12:13:29 +02:00
Jameson Nash
6564ccc900
asan: fix some tests (#3323)
Previously they were just being run incorrectly, but nothing wrong with
the test itself. We were also interpreting an ASAN failure as TEST_SKIP,
so test failures would not actually be reported as CI failures.
2021-10-10 00:57:43 +02:00
Darshan Sen
c852be467e
test: remove dns-server.c as it is not used anywhere (#3313)
Signed-off-by: Darshan Sen <darshan.sen@postman.com>
2021-10-09 14:32:31 +02:00
Sylvain Corlay
66a3053e70
cmake: use standard installation layout always
Fixes: https://github.com/libuv/libuv/issues/3074
PR-URL: https://github.com/libuv/libuv/pull/3084
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-09-08 10:37:12 -04:00
Andy Fiddaman
7b18d0aa15
sunos,cmake: use thread-safe errno
On illumos, the global errno variable is not thread-safe by default,
requiring that the application be built with gcc's -pthread option, or
that it defines -D_REENTRANT.

This was done already for the autotools build, but not for CMake.

PR-URL: https://github.com/libuv/libuv/pull/3243
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-07-19 22:27:40 -04:00
Andy Fiddaman
5fe597268e
sunos: restore use of event ports
The sunos platform currently covers at least the Solaris and illumos
operating systems. Although these diverged 11 years ago they still share
some common features such as support for event ports.

illumos also has a compatibility wrapper for epoll but this is not
recommended for use over event ports. From the NOTES section of
https://illumos.org/man/5/epoll:

	The epoll facility is implemented for purposes of offering
	compatibility to and portability of Linux-borne
	applications; native applications should continue to prefer
	using event ports... In particular, use of epoll in a
	multithreaded environment is fraught with peril...

Restore the event ports code so that libuv can continue to be used
on Solaris, and to avoid the problems that come with using epoll()
on illumos. The separation of epoll into src/unix/epoll.c has been
retained.

Fixes: https://github.com/libuv/libuv/issues/3241
PR-URL: https://github.com/libuv/libuv/pull/3242
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-07-19 22:19:24 -04:00
Jameson Nash
03f1a6979c
unix,stream: fix loop hang after uv_shutdown
While most users will likely typically call uv_close in their
uv_shutdown callback, some callers (notable nodejs) do not always do
so. This can result in libuv keeping the loop active, even though there
are no outstanding reqs left to handle.

This bug was added in 80f2f826bf, where
the premise of that commit appears to have simply been incorrect, as
demonstrated by the added test.

Refs: https://github.com/libuv/libuv/issues/3202
PR-URL: https://github.com/libuv/libuv/pull/3233
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2021-07-13 10:54:02 -04:00
tjarlama
caf22ddbf5
illumos: event ports to epoll
Sunos has added epoll wrappers to offer compatability for binaries
build specifically for linux (https://illumos.org/man/5/epoll). With
this, it's now possible to develop epoll as a generic interface and
share between Linux and SUNOS, similar to kqueue.

Fixes: https://github.com/libuv/libuv/issues/3008
PR-URL: https://github.com/libuv/libuv/pull/3046
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2021-07-02 15:00:37 -04:00
Jameson Nash
ce15b8405e
Re-merge "unix,stream: clear read/write states on close/eof"
This reverts commit 46f36e3df1.

PR-URL: https://github.com/libuv/libuv/pull/3006
Refs: https://github.com/libuv/libuv/pull/2967
Refs: https://github.com/libuv/libuv/pull/2409
Refs: https://github.com/libuv/libuv/issues/2943
Refs: https://github.com/libuv/libuv/pull/2968
Refs: https://github.com/nodejs/node/pull/36111
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2021-05-21 16:20:07 -04:00
Jameson Nash
ac5b21a2c9
Revert "win,build: Add cmake -DSTATIC_VCRT=ON option"
This reverts commit b94934f012.

The required version of cmake (3.15) is newer than we are currently 
using in Android CI (3.10).

PR-URL: https://github.com/libuv/libuv/pull/3172
Refs: https://github.com/libuv/libuv/pull/3085
2021-05-13 23:07:14 -04:00
Romain Roffé
b94934f012
win,build: Add cmake -DSTATIC_VCRT=ON option
PR-URL: https://github.com/libuv/libuv/pull/3085
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-05-13 11:06:22 -04:00
Zhao Zhili
67994c68fe
cmake: fix linker flags
There is no CMAKE_LINKER_FLAGS_DEBUG.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
PR-URL: https://github.com/libuv/libuv/pull/3137
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2021-04-04 17:29:27 +02:00
Shuowang (Wayne) Zhang
c2589424f9
zos: use custom proctitle implementation
ZOSLIB uses `argv[0]` to determine the exepath. So it is necessary to
use an implementation of proctitle that does not modify `argv[0]`. Since
there is currently no support for process titles on z/OS, the custom
proctitle implementation simply stores the desired title in memory.

This resolves failure in tests `get_currentexe` and `process_title` on
z/OS.

PR-URL: https://github.com/libuv/libuv/pull/3060
Reviewed-By: Richard Lau <rlau@redhat.com>
2021-02-15 17:18:59 +00:00
Shuowang (Wayne) Zhang
bf1aea0d5b
zos: introduce zoslib
This commit introduces ZOSLIB for z/OS, which is a C/C++ library that
implements additional POSIX APIs not available in the LE C Runtime
Library, and provides API for EBCDIC <-> ASCII conversion. This library
requires the linker to be set to CXX when building for z/OS. ZOSLIB is
designed to be installed separately, and then linked to libuv with the
`-DZOSLIB_DIR` option.

PR-URL: https://github.com/libuv/libuv/pull/3060
Reviewed-By: Richard Lau <rlau@redhat.com>
2021-02-15 17:18:16 +00:00
Shuowang (Wayne) Zhang
1073ceaea4
zos: build in ascii code page
PR-URL: https://github.com/libuv/libuv/pull/3060
Reviewed-By: Richard Lau <rlau@redhat.com>
2021-02-15 17:17:52 +00:00
Bob Weinand
c9406ba0e3
poll,unix: ensure safety of rapid fd reuse
Consider the following scenario:

uv_poll_init(loop, poll, fd);
uv_poll_start(poll, UV_READABLE, cb);
// the cb gets invoked etc.
uv_poll_stop(poll);

close(fd);
fd = allocate_new_socket(); // allocate_new_socket() is assigned the same fd by "bad luck" from the OS

// some time later:
uv_poll_init(loop, otherpoll, fd);
uv_poll_start(otherpoll, UV_READABLE, cb);

uv_close(poll); // uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed.

According to documentation, "however the fd can be safely closed
immediately after a call to uv_poll_stop() or uv_close()."
Though, in this scenario, we close()'d our file descriptor, and by
bad luck we got the same file descriptor again and register a new
handle for it and start polling.

Previously that would lead to an assertion failure, if we were to
properly free the original handle via uv_close().

This commit fixes that by moving the check whether a only a single
poll handle is active to uv_poll_start() instead of the stopping
routines.

Fixes: https://github.com/libuv/libuv/issues/1172
Fixes: https://github.com/bwoebi/php-uv/issues/81
Fixes: https://github.com/b2wdigital/aiologger/issues/82
Fixes: https://github.com/invenia/LibPQ.jl/issues/140
PR-URL: https://github.com/libuv/libuv/pull/2686
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2020-12-28 11:51:23 -05:00
Ben Noordhuis
a779fccfd1
win: bump minimum supported version to windows 8
* Windows 7 went out of support earlier this year.

* As did Python 2.7. We no longer have to worry about MSVC 2008.
  Python 3.5 and up use VS 2015.

PR-URL: https://github.com/libuv/libuv/pull/2821
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Joao Reis <reis@janeasystems.com>
2020-12-28 12:44:29 +01:00