Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Libuv 1.44.0 #585

Merged
merged 2 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ jobs:
with:
submodules: recursive
- name: Install Valgrind
run: sudo apt-get install -y valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind
- name: Build
run: make
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ endif()
project (luv C ASM)

set(LUV_VERSION_MAJOR 1)
set(LUV_VERSION_MINOR 43)
set(LUV_VERSION_MINOR 44)
set(LUV_VERSION_PATCH 0)
set(LUV_VERSION ${LUV_VERSION_MAJOR}.${LUV_VERSION_MINOR}.${LUV_VERSION_PATCH})

Expand Down
2 changes: 1 addition & 1 deletion deps/libuv
Submodule libuv updated 81 files
+1 −1 .github/workflows/CI.yml
+12 −0 AUTHORS
+17 −4 CMakeLists.txt
+143 −32 ChangeLog
+0 −4 LICENSE
+2 −0 MAINTAINERS.md
+10 −9 Makefile.am
+2 −2 SUPPORTED_PLATFORMS.md
+1 −1 configure.ac
+3 −0 docs/code/.gitignore
+82 −0 docs/code/Makefile
+12 −0 docs/code/default-loop/main.c
+1 −1 docs/src/design.rst
+19 −4 docs/src/guide/basics.rst
+20 −10 docs/src/guide/filesystem.rst
+8 −10 docs/src/guide/introduction.rst
+20 −1 docs/src/misc.rst
+30 −0 docs/src/process.rst
+3 −2 include/uv.h
+0 −54 include/uv/android-ifaddrs.h
+1 −1 include/uv/version.h
+9 −16 include/uv/win.h
+3 −2 m4/libuv-check-flags.m4
+1 −1 src/fs-poll.c
+6 −5 src/idna.c
+1 −1 src/strscpy.h
+0 −713 src/unix/android-ifaddrs.c
+4 −4 src/unix/bsd-ifaddrs.c
+1 −0 src/unix/bsd-proctitle.c
+88 −52 src/unix/core.c
+15 −0 src/unix/freebsd.c
+15 −2 src/unix/fs.c
+167 −0 src/unix/hurd.c
+17 −7 src/unix/internal.h
+10 −0 src/unix/kqueue.c
+8 −31 src/unix/linux-core.c
+1 −1 src/unix/pipe.c
+639 −114 src/unix/process.c
+19 −19 src/unix/stream.c
+1 −1 src/unix/tcp.c
+53 −33 src/unix/thread.c
+11 −8 src/unix/udp.c
+5 −5 src/win/async.c
+38 −41 src/win/core.c
+1 −1 src/win/error.c
+18 −18 src/win/fs-event.c
+12 −12 src/win/fs.c
+13 −13 src/win/handle-inl.h
+13 −13 src/win/handle.c
+66 −72 src/win/internal.h
+2 −2 src/win/loop-watcher.c
+76 −76 src/win/pipe.c
+19 −17 src/win/poll.c
+10 −10 src/win/process.c
+17 −17 src/win/req-inl.h
+6 −6 src/win/signal.c
+4 −4 src/win/stream-inl.h
+11 −11 src/win/stream.c
+66 −66 src/win/tcp.c
+21 −73 src/win/thread.c
+81 −80 src/win/tty.c
+50 −50 src/win/udp.c
+14 −92 src/win/util.c
+4 −4 src/win/winapi.c
+14 −14 src/win/winsock.c
+9 −1 test/benchmark-list.h
+7 −1 test/benchmark-ping-udp.c
+68 −0 test/benchmark-queue-work.c
+0 −5 test/run-tests.c
+2 −2 test/runner-unix.c
+6 −1 test/test-fs.c
+12 −4 test/test-get-passwd.c
+6 −6 test/test-ipc-send-recv.c
+0 −127 test/test-ipc.c
+2 −6 test/test-list.h
+15 −9 test/test-loop-time.c
+0 −4 test/test-pipe-set-non-blocking.c
+5 −0 test/test-platform-output.c
+38 −0 test/test-spawn.c
+5 −0 test/test-thread.c
+20 −13 test/test-udp-mmsg.c
12 changes: 12 additions & 0 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3316,6 +3316,18 @@ Returns the resource usage.
- `nvcsw` : `integer` (voluntary context switches)
- `nivcsw` : `integer` (involuntary context switches)

### `uv.available_parallelism()`

Returns an estimate of the default amount of parallelism a program should use. Always returns a non-zero value.

On Linux, inspects the calling thread’s CPU affinity mask to determine if it has been pinned to specific CPUs.

On Windows, the available parallelism may be underreported on systems with more than 64 logical CPUs.

On other platforms, reports the number of CPUs that the operating system considers to be online.

**Returns:** `integer`

### `uv.cpu_info()`

Returns information about the CPU(s) on the system as a table of tables for each
Expand Down
3 changes: 3 additions & 0 deletions src/luv.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ static const luaL_Reg luv_functions[] = {
{"os_homedir", luv_os_homedir},
{"os_tmpdir", luv_os_tmpdir},
{"os_get_passwd", luv_os_get_passwd},
#endif
#if LUV_UV_VERSION_GEQ(1, 44, 0)
{"available_parallelism", luv_available_parallelism},
#endif
{"cpu_info", luv_cpu_info},
{"cwd", luv_cwd},
Expand Down
7 changes: 7 additions & 0 deletions src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ static int luv_getrusage(lua_State* L) {
return 1;
}

#if LUV_UV_VERSION_GEQ(1, 44, 0)
static int luv_available_parallelism(lua_State* L) {
lua_pushinteger(L, uv_available_parallelism());
return 1;
}
#endif

static int luv_cpu_info(lua_State* L) {
uv_cpu_info_t* cpu_infos = NULL;
int count = 0, i;
Expand Down
5 changes: 5 additions & 0 deletions tests/test-misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ return require('lib/tap')(function (test)
p(rusage)
end)

test("uv.available_parallelism", function (print, p, expect, uv)
local available_parallelism = assert(uv.available_parallelism())
p(available_parallelism)
end, "1.44.0")

test("uv.cpu_info", function (print, p, expect, uv)
local info = assert(uv.cpu_info())
p(info)
Expand Down