Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v1.x' into v1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Oct 18, 2021
2 parents 406a4c5 + 1e73814 commit 7588448
Show file tree
Hide file tree
Showing 24 changed files with 140 additions and 414 deletions.
7 changes: 3 additions & 4 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 21
daysUntilStale: 28
# Number of days of inactivity before a stale issue is closed
# Set to false to disable. If disabled, issues still need to be closed
# manually, but will remain marked as stale.
daysUntilClose: 120
daysUntilClose: false
# Issues with these labels will never be considered stale
exemptLabels:
- v2
Expand All @@ -18,7 +18,6 @@ staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
recent activity. Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
49 changes: 49 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@ name: CI
on: [push, pull_request]

jobs:
build-windows:
runs-on: windows-${{ matrix.config.server }}
name: build-${{ matrix.config.toolchain}}-${{ matrix.config.arch}}
strategy:
fail-fast: false
matrix:
config:
- {toolchain: Visual Studio 15 2017, arch: Win32, server: 2016}
- {toolchain: Visual Studio 15 2017, arch: x64, server: 2016}
- {toolchain: Visual Studio 16 2019, arch: Win32, server: 2019}
- {toolchain: Visual Studio 16 2019, arch: x64, server: 2019}
- {toolchain: Visual Studio 17 2022, arch: Win32, server: 2022}
- {toolchain: Visual Studio 17 2022, arch: x64, server: 2022}
steps:
- uses: actions/checkout@v2
- name: Envinfo
run: npx envinfo
- name: Build
shell: cmd
run: |
mkdir -p build
cd build
cmake .. -DBUILD_TESTING=ON -G "${{ matrix.config.toolchain }}" -A ${{ matrix.config.arch }}
cmake --build .
- name: Test
shell: cmd
run: |
cd build
ctest -C Debug --output-on-failure
build-android:
runs-on: ubuntu-latest
container: reactnativecommunity/react-native-android:2020-5-20
Expand All @@ -17,6 +47,25 @@ jobs:
$ANDROID_HOME/cmake/3.10.2.4988404/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/20.0.5594570/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 ..
$ANDROID_HOME/cmake/3.10.2.4988404/bin/cmake --build .
build-macos:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Envinfo
run: npx envinfo
- name: Setup
run: |
brew install ninja
- name: Build
run: |
mkdir build
cd build && cmake .. -DBUILD_TESTING=ON -G Ninja
cmake --build .
ls -lh
- name: Test
run: |
cd build && ctest -V
build-cross-qemu:
runs-on: ubuntu-latest
name: build-cross-qemu-${{ matrix.config.target }}
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@ name: Sanitizer checks
on: [push, pull_request]

jobs:
asan:
sanitizers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup
run: |
sudo apt-get install ninja-build
- name: Envinfo
run: npx envinfo
- name: TSAN
run: |
mkdir build-tsan
(cd build-tsan && cmake .. -G Ninja -DBUILD_TESTING=ON -DTSAN=ON -DCMAKE_BUILD_TYPE=Release)
cmake --build build-tsan
./build-tsan/uv_run_tests_a || true # currently permit failures
- name: ASAN
run: |
mkdir build
cd build && cmake .. -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build . && ./uv_run_tests_a
mkdir build-asan
(cd build-asan && cmake .. -G Ninja -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug)
cmake --build build-asan
./build-asan/uv_run_tests_a
22 changes: 17 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,26 @@ if(QEMU)
endif()

option(ASAN "Enable AddressSanitizer (ASan)" OFF)
if(ASAN AND CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang")
option(TSAN "Enable ThreadSanitizer (TSan)" OFF)

if((ASAN OR TSAN) AND NOT (CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang"))
message(SEND_ERROR "Sanitizer support requires clang or gcc. Try again with -DCMAKE_C_COMPILER.")
endif()

if(ASAN)
add_definitions(-D__ASAN__=1)
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
endif()

if(TSAN)
add_definitions(-D__TSAN__=1)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=thread")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=thread")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=thread")
endif()

# Compiler check
string(CONCAT is-msvc $<OR:
$<C_COMPILER_ID:MSVC>,
Expand Down Expand Up @@ -418,7 +431,6 @@ if(LIBUV_BUILD_TESTS)
test/benchmark-thread.c
test/benchmark-udp-pummel.c
test/blackhole-server.c
test/dns-server.c
test/echo-server.c
test/run-benchmarks.c
test/runner.c)
Expand Down Expand Up @@ -659,6 +671,6 @@ message(STATUS "summary of build options:
Install prefix: ${CMAKE_INSTALL_PREFIX}
Target system: ${CMAKE_SYSTEM_NAME}
Compiler:
C compiler: ${CMAKE_C_COMPILER}
C compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})
CFLAGS: ${CMAKE_C_FLAGS_${_build_type}} ${CMAKE_C_FLAGS}
")
6 changes: 1 addition & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ endif

test_run_tests_LDFLAGS =
test_run_tests_SOURCES = test/blackhole-server.c \
test/dns-server.c \
test/echo-server.c \
test/run-tests.c \
test/runner.c \
Expand Down Expand Up @@ -390,10 +389,7 @@ if ANDROID
uvinclude_HEADERS += include/uv/android-ifaddrs.h
libuv_la_CFLAGS += -D_GNU_SOURCE
libuv_la_SOURCES += src/unix/android-ifaddrs.c \
src/unix/pthread-fixes.c \
src/unix/random-getrandom.c \
src/unix/random-sysctl-linux.c \
src/unix/epoll.c
src/unix/pthread-fixes.c
endif

if CYGWIN
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
libuv is a multi-platform support library with a focus on asynchronous I/O. It
was primarily developed for use by [Node.js][], but it's also
used by [Luvit](http://luvit.io/), [Julia](http://julialang.org/),
[pyuv](https://github.com/saghul/pyuv), and [others](https://github.com/libuv/libuv/blob/v1.x/LINKS.md).
[uvloop](https://github.com/MagicStack/uvloop), and [others](https://github.com/libuv/libuv/blob/v1.x/LINKS.md).

## Feature highlights

Expand Down
2 changes: 1 addition & 1 deletion SUPPORTED_PLATFORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| IBM i | Tier 2 | >= IBM i 7.2 | Maintainers: @libuv/ibmi |
| z/OS | Tier 2 | >= V2R2 | Maintainers: @libuv/zos |
| Linux with musl | Tier 2 | musl >= 1.0 | |
| SmartOS | Tier 2 | >= 14.4 | Maintainers: @libuv/smartos |
| SmartOS | Tier 3 | >= 14.4 | |
| Android | Tier 3 | NDK >= r15b | |
| MinGW | Tier 3 | MinGW32 and MinGW-w64 | |
| SunOS | Tier 3 | Solaris 121 and later | |
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Overview

libuv is a multi-platform support library with a focus on asynchronous I/O. It
was primarily developed for use by `Node.js`_, but it's also used by `Luvit`_,
`Julia`_, `pyuv`_, and `others`_.
`Julia`_, `uvloop`_, and `others`_.

.. note::
In case you find errors in this documentation you can help by sending
Expand All @@ -16,7 +16,7 @@ was primarily developed for use by `Node.js`_, but it's also used by `Luvit`_,
.. _Node.js: https://nodejs.org
.. _Luvit: https://luvit.io
.. _Julia: https://julialang.org
.. _pyuv: https://github.com/saghul/pyuv
.. _uvloop: https://github.com/MagicStack/uvloop
.. _others: https://github.com/libuv/libuv/blob/v1.x/LINKS.md


Expand Down
2 changes: 1 addition & 1 deletion docs/src/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ API
:man:`sysctl(2)`.
- FreeBSD: `getrandom(2) <https://www.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2>_`,
or `/dev/urandom` after reading from `/dev/random` once.
- NetBSD: `KERN_ARND` `sysctl(3) <https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+3+NetBSD-current>_`
- NetBSD: `KERN_ARND` `sysctl(7) <https://man.netbsd.org/sysctl.7>_`
- macOS, OpenBSD: `getentropy(2) <https://man.openbsd.org/getentropy.2>_`
if available, or `/dev/urandom` after reading from `/dev/random` once.
- AIX: `/dev/random`.
Expand Down
6 changes: 2 additions & 4 deletions include/uv/unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@
# include "uv/bsd.h"
#elif defined(__CYGWIN__) || \
defined(__MSYS__) || \
defined(__HAIKU__) || \
defined(__QNX__) || \
defined(__GNU__)
# include "uv/posix.h"
#elif defined(__HAIKU__)
# include "uv/posix.h"
#elif defined(__QNX__)
# include "uv/posix.h"
#endif

#ifndef NI_MAXHOST
Expand Down
4 changes: 1 addition & 3 deletions src/unix/bsd-proctitle.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ static void init_process_title_mutex_once(void) {


void uv__process_title_cleanup(void) {
/* TODO(bnoordhuis) uv_mutex_destroy(&process_title_mutex)
* and reset process_title_mutex_once?
*/
uv_mutex_destroy(&process_title_mutex);
}


Expand Down
18 changes: 15 additions & 3 deletions src/win/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ void fs__read_filemap(uv_fs_t* req, struct uv__fd_info_s* fd_info) {
void* view;

if (rw_flags == UV_FS_O_WRONLY) {
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
return;
}
if (fd_info->is_directory) {
Expand Down Expand Up @@ -912,6 +912,11 @@ void fs__read(uv_fs_t* req) {
SET_REQ_RESULT(req, bytes);
} else {
error = GetLastError();

if (error == ERROR_ACCESS_DENIED) {
error = ERROR_INVALID_FLAGS;
}

if (error == ERROR_HANDLE_EOF) {
SET_REQ_RESULT(req, bytes);
} else {
Expand All @@ -936,7 +941,7 @@ void fs__write_filemap(uv_fs_t* req, HANDLE file,
FILETIME ft;

if (rw_flags == UV_FS_O_RDONLY) {
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FLAGS);
return;
}
if (fd_info->is_directory) {
Expand Down Expand Up @@ -1052,6 +1057,7 @@ void fs__write(uv_fs_t* req) {
OVERLAPPED overlapped, *overlapped_ptr;
LARGE_INTEGER offset_;
DWORD bytes;
DWORD error;
int result;
unsigned int index;
LARGE_INTEGER original_position;
Expand Down Expand Up @@ -1111,7 +1117,13 @@ void fs__write(uv_fs_t* req) {
if (result || bytes > 0) {
SET_REQ_RESULT(req, bytes);
} else {
SET_REQ_WIN32_ERROR(req, GetLastError());
error = GetLastError();

if (error == ERROR_ACCESS_DENIED) {
error = ERROR_INVALID_FLAGS;
}

SET_REQ_WIN32_ERROR(req, error);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/win/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,6 @@ static DWORD WINAPI uv_pipe_writefile_thread_proc(void* parameter) {
assert(req != NULL);
assert(req->type == UV_WRITE);
assert(handle->type == UV_NAMED_PIPE);
assert(req->write_buffer.base);

result = WriteFile(handle->handle,
req->write_buffer.base,
Expand Down
1 change: 0 additions & 1 deletion test/benchmark-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ HELPER_DECLARE (tcp_pump_server)
HELPER_DECLARE (pipe_pump_server)
HELPER_DECLARE (tcp4_echo_server)
HELPER_DECLARE (pipe_echo_server)
HELPER_DECLARE (dns_server)

TASK_LIST_START
BENCHMARK_ENTRY (sizes)
Expand Down
Loading

0 comments on commit 7588448

Please sign in to comment.