Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
edde98d7
提交
edde98d7
authored
7月 08, 2021
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update libuv to 1.41.0
上级
bd0ba233
隐藏空白字符变更
内嵌
并排
正在显示
70 个修改的文件
包含
1544 行增加
和
578 行删除
+1544
-578
CHANGELOG.md
CHANGELOG.md
+5
-0
sanitizer.yml
worker/deps/libuv/libuv/.github/workflows/sanitizer.yml
+17
-0
.mailmap
worker/deps/libuv/libuv/.mailmap
+2
-0
AUTHORS
worker/deps/libuv/libuv/AUTHORS
+12
-1
CMakeLists.txt
worker/deps/libuv/libuv/CMakeLists.txt
+12
-2
ChangeLog
worker/deps/libuv/libuv/ChangeLog
+80
-1
Makefile.am
worker/deps/libuv/libuv/Makefile.am
+2
-5
README.md
worker/deps/libuv/libuv/README.md
+10
-0
SUPPORTED_PLATFORMS.md
worker/deps/libuv/libuv/SUPPORTED_PLATFORMS.md
+2
-2
configure.ac
worker/deps/libuv/libuv/configure.ac
+2
-1
pipe.rst
worker/deps/libuv/libuv/docs/src/pipe.rst
+18
-0
poll.rst
worker/deps/libuv/libuv/docs/src/poll.rst
+44
-17
process.rst
worker/deps/libuv/libuv/docs/src/process.rst
+7
-5
stream.rst
worker/deps/libuv/libuv/docs/src/stream.rst
+5
-0
tcp.rst
worker/deps/libuv/libuv/docs/src/tcp.rst
+20
-4
udp.rst
worker/deps/libuv/libuv/docs/src/udp.rst
+7
-5
uv.h
worker/deps/libuv/libuv/include/uv.h
+12
-3
version.h
worker/deps/libuv/libuv/include/uv/version.h
+1
-1
timer.c
worker/deps/libuv/libuv/src/timer.c
+1
-0
async.c
worker/deps/libuv/libuv/src/unix/async.c
+1
-1
bsd-ifaddrs.c
worker/deps/libuv/libuv/src/unix/bsd-ifaddrs.c
+3
-3
core.c
worker/deps/libuv/libuv/src/unix/core.c
+2
-3
fs.c
worker/deps/libuv/libuv/src/unix/fs.c
+31
-13
internal.h
worker/deps/libuv/libuv/src/unix/internal.h
+0
-6
linux-core.c
worker/deps/libuv/libuv/src/unix/linux-core.c
+33
-28
linux-syscalls.c
worker/deps/libuv/libuv/src/unix/linux-syscalls.c
+17
-20
linux-syscalls.h
worker/deps/libuv/libuv/src/unix/linux-syscalls.h
+2
-2
pipe.c
worker/deps/libuv/libuv/src/unix/pipe.c
+54
-0
poll.c
worker/deps/libuv/libuv/src/unix/poll.c
+9
-0
process.c
worker/deps/libuv/libuv/src/unix/process.c
+1
-63
proctitle.c
worker/deps/libuv/libuv/src/unix/proctitle.c
+1
-0
signal.c
worker/deps/libuv/libuv/src/unix/signal.c
+1
-1
stream.c
worker/deps/libuv/libuv/src/unix/stream.c
+3
-9
tcp.c
worker/deps/libuv/libuv/src/unix/tcp.c
+51
-2
uv-common.c
worker/deps/libuv/libuv/src/uv-common.c
+19
-0
uv-common.h
worker/deps/libuv/libuv/src/uv-common.h
+4
-0
fs.c
worker/deps/libuv/libuv/src/win/fs.c
+24
-25
internal.h
worker/deps/libuv/libuv/src/win/internal.h
+2
-2
pipe.c
worker/deps/libuv/libuv/src/win/pipe.c
+213
-15
process-stdio.c
worker/deps/libuv/libuv/src/win/process-stdio.c
+0
-96
stream.c
worker/deps/libuv/libuv/src/win/stream.c
+3
-10
tcp.c
worker/deps/libuv/libuv/src/win/tcp.c
+137
-6
benchmark-pump.c
worker/deps/libuv/libuv/test/benchmark-pump.c
+2
-0
blackhole-server.c
worker/deps/libuv/libuv/test/blackhole-server.c
+1
-0
echo-server.c
worker/deps/libuv/libuv/test/echo-server.c
+3
-2
run-tests.c
worker/deps/libuv/libuv/test/run-tests.c
+27
-9
task.h
worker/deps/libuv/libuv/test/task.h
+22
-18
test-close-fd.c
worker/deps/libuv/libuv/test/test-close-fd.c
+17
-13
test-error.c
worker/deps/libuv/libuv/test/test-error.c
+3
-0
test-fs-copyfile.c
worker/deps/libuv/libuv/test/test-fs-copyfile.c
+3
-0
test-fs-event.c
worker/deps/libuv/libuv/test/test-fs-event.c
+3
-0
test-fs-readdir.c
worker/deps/libuv/libuv/test/test-fs-readdir.c
+3
-0
test-fs.c
worker/deps/libuv/libuv/test/test-fs.c
+108
-42
test-getaddrinfo.c
worker/deps/libuv/libuv/test/test-getaddrinfo.c
+2
-2
test-ipc.c
worker/deps/libuv/libuv/test/test-ipc.c
+6
-1
test-list.h
worker/deps/libuv/libuv/test/test-list.h
+21
-9
test-ping-pong.c
worker/deps/libuv/libuv/test/test-ping-pong.c
+178
-43
test-pipe-connect-error.c
worker/deps/libuv/libuv/test/test-pipe-connect-error.c
+3
-0
test-pipe-getsockname.c
worker/deps/libuv/libuv/test/test-pipe-getsockname.c
+6
-2
test-pipe-set-non-blocking.c
worker/deps/libuv/libuv/test/test-pipe-set-non-blocking.c
+39
-14
test-platform-output.c
worker/deps/libuv/libuv/test/test-platform-output.c
+1
-0
test-poll-multiple-handles.c
worker/deps/libuv/libuv/test/test-poll-multiple-handles.c
+99
-0
test-shutdown-eof.c
worker/deps/libuv/libuv/test/test-shutdown-eof.c
+7
-1
test-spawn.c
worker/deps/libuv/libuv/test/test-spawn.c
+64
-60
test-tcp-bind-error.c
worker/deps/libuv/libuv/test/test-tcp-bind-error.c
+47
-2
test-tcp-connect-timeout.c
worker/deps/libuv/libuv/test/test-tcp-connect-timeout.c
+1
-1
test-tty.c
worker/deps/libuv/libuv/test/test-tty.c
+3
-0
test-udp-connect.c
worker/deps/libuv/libuv/test/test-udp-connect.c
+1
-1
make_dist_html.py
worker/deps/libuv/libuv/tools/make_dist_html.py
+3
-5
get-dep.sh
worker/scripts/get-dep.sh
+1
-1
没有找到文件。
CHANGELOG.md
浏览文件 @
edde98d7
# Changelog
# Changelog
### Unreleased
*
Update
`libuv`
to 1.41.0.
### 3.7.18
### 3.7.18
*
Support for optional fixed port on transports (PR #593 by @nazar-pc).
*
Support for optional fixed port on transports (PR #593 by @nazar-pc).
...
...
worker/deps/libuv/libuv/.github/workflows/sanitizer.yml
0 → 100644
浏览文件 @
edde98d7
name
:
Sanitizer checks
on
:
[
push
,
pull_request
]
jobs
:
asan
:
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Envinfo
run
:
npx envinfo
-
name
:
ASAN
run
:
|
mkdir build
cd build && cmake .. -DBUILD_TESTING=ON -DASAN=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build . && ./uv_run_tests_a
worker/deps/libuv/libuv/.mailmap
浏览文件 @
edde98d7
...
@@ -32,6 +32,7 @@ Nicholas Vavilov <vvnicholas@gmail.com>
...
@@ -32,6 +32,7 @@ Nicholas Vavilov <vvnicholas@gmail.com>
Nick Logan <ugexe@cpan.org> <nlogan@gmail.com>
Nick Logan <ugexe@cpan.org> <nlogan@gmail.com>
Rasmus Christian Pedersen <zerhacken@yahoo.com>
Rasmus Christian Pedersen <zerhacken@yahoo.com>
Rasmus Christian Pedersen <zerhacken@yahoo.com> <ruysch@outlook.com>
Rasmus Christian Pedersen <zerhacken@yahoo.com> <ruysch@outlook.com>
Richard Lau <rlau@redhat.com> <riclau@uk.ibm.com>
Robert Mustacchi <rm@joyent.com> <rm@fingolfin.org>
Robert Mustacchi <rm@joyent.com> <rm@fingolfin.org>
Ryan Dahl <ryan@joyent.com> <ry@tinyclouds.org>
Ryan Dahl <ryan@joyent.com> <ry@tinyclouds.org>
Ryan Emery <seebees@gmail.com>
Ryan Emery <seebees@gmail.com>
...
@@ -47,6 +48,7 @@ Timothy J. Fontaine <tjfontaine@gmail.com>
...
@@ -47,6 +48,7 @@ Timothy J. Fontaine <tjfontaine@gmail.com>
Yasuhiro Matsumoto <mattn.jp@gmail.com>
Yasuhiro Matsumoto <mattn.jp@gmail.com>
Yazhong Liu <yorkiefixer@gmail.com>
Yazhong Liu <yorkiefixer@gmail.com>
Yuki Okumura <mjt@cltn.org>
Yuki Okumura <mjt@cltn.org>
cjihrig <cjihrig@gmail.com>
gengjiawen <technicalcute@gmail.com>
gengjiawen <technicalcute@gmail.com>
jBarz <jBarz@users.noreply.github.com> <jbarboza@ca.ibm.com>
jBarz <jBarz@users.noreply.github.com> <jbarboza@ca.ibm.com>
jBarz <jBarz@users.noreply.github.com> <jbarz@users.noreply.github.com>
jBarz <jBarz@users.noreply.github.com> <jbarz@users.noreply.github.com>
...
...
worker/deps/libuv/libuv/AUTHORS
浏览文件 @
edde98d7
...
@@ -212,7 +212,7 @@ guworks <ground.up.works@gmail.com>
...
@@ -212,7 +212,7 @@ guworks <ground.up.works@gmail.com>
RossBencina <rossb@audiomulch.com>
RossBencina <rossb@audiomulch.com>
Roger A. Light <roger@atchoo.org>
Roger A. Light <roger@atchoo.org>
chenttuuvv <chenttuuvv@yahoo.com>
chenttuuvv <chenttuuvv@yahoo.com>
Richard Lau <r
iclau@uk.ibm
.com>
Richard Lau <r
lau@redhat
.com>
ronkorving <rkorving@wizcorp.jp>
ronkorving <rkorving@wizcorp.jp>
Corbin Simpson <MostAwesomeDude@gmail.com>
Corbin Simpson <MostAwesomeDude@gmail.com>
Zachary Hamm <zsh@imipolexg.org>
Zachary Hamm <zsh@imipolexg.org>
...
@@ -448,3 +448,14 @@ Aleksej Lebedev <root@zta.lk>
...
@@ -448,3 +448,14 @@ Aleksej Lebedev <root@zta.lk>
Nikolay Mitev <github@hmel.org>
Nikolay Mitev <github@hmel.org>
Ulrik Strid <ulrik.strid@outlook.com>
Ulrik Strid <ulrik.strid@outlook.com>
Elad Lahav <elahav@qnx.com>
Elad Lahav <elahav@qnx.com>
Elad Nachmias <eladn@pazam.net>
Darshan Sen <raisinten@gmail.com>
Simon Kadisch <simon.kadisch@k13-engineering.at>
Momtchil Momtchev <momtchil@momtchev.com>
Ethel Weston <66453757+ethelweston@users.noreply.github.com>
Drew DeVault <sir@cmpwn.com>
Mark Klein <klein@cscs.ch>
schamberg97 <50446906+schamberg97@users.noreply.github.com>
Bob Weinand <bobwei9@hotmail.com>
Issam E. Maghni <issam.e.maghni@mailbox.org>
Juan Pablo Canepa <jpcanepa@gmail.com>
worker/deps/libuv/libuv/CMakeLists.txt
浏览文件 @
edde98d7
...
@@ -30,6 +30,13 @@ if(QEMU)
...
@@ -30,6 +30,13 @@ if(QEMU)
add_definitions
(
-D__QEMU__=1
)
add_definitions
(
-D__QEMU__=1
)
endif
()
endif
()
option
(
ASAN
"Enable AddressSanitizer (ASan)"
OFF
)
if
(
ASAN AND CMAKE_C_COMPILER_ID MATCHES
"AppleClang|GNU|Clang"
)
add_definitions
(
-D__ASAN__=1
)
set
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS_DEBUG
}
-fno-omit-frame-pointer -fsanitize=address"
)
set
(
CMAKE_LINKER_FLAGS_DEBUG
"
${
CMAKE_LINKER_FLAGS_DEBUG
}
-fno-omit-frame-pointer -fsanitize=address"
)
endif
()
# Compiler check
# Compiler check
string
(
CONCAT is-msvc $<OR:
string
(
CONCAT is-msvc $<OR:
$<C_COMPILER_ID:MSVC>,
$<C_COMPILER_ID:MSVC>,
...
@@ -95,6 +102,9 @@ list(APPEND uv_cflags ${lint-no-conditional-assignment-msvc})
...
@@ -95,6 +102,9 @@ list(APPEND uv_cflags ${lint-no-conditional-assignment-msvc})
list
(
APPEND uv_cflags
${
lint-no-unsafe-msvc
}
)
list
(
APPEND uv_cflags
${
lint-no-unsafe-msvc
}
)
list
(
APPEND uv_cflags
${
lint-utf8-msvc
}
)
list
(
APPEND uv_cflags
${
lint-utf8-msvc
}
)
check_c_compiler_flag
(
-fno-strict-aliasing UV_F_STRICT_ALIASING
)
list
(
APPEND uv_cflags $<$<BOOL:
${
UV_F_STRICT_ALIASING
}
>:-fno-strict-aliasing>
)
set
(
uv_sources
set
(
uv_sources
src/fs-poll.c
src/fs-poll.c
src/idna.c
src/idna.c
...
@@ -108,7 +118,7 @@ set(uv_sources
...
@@ -108,7 +118,7 @@ set(uv_sources
src/version.c
)
src/version.c
)
if
(
WIN32
)
if
(
WIN32
)
list
(
APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x060
0
)
list
(
APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x060
2
)
list
(
APPEND uv_libraries
list
(
APPEND uv_libraries
psapi
psapi
user32
user32
...
@@ -318,7 +328,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
...
@@ -318,7 +328,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
src/unix/bsd-ifaddrs.c
src/unix/bsd-ifaddrs.c
src/unix/no-proctitle.c
src/unix/no-proctitle.c
src/unix/no-fsevents.c
)
src/unix/no-fsevents.c
)
list
(
APPEND uv_cflags -fno-strict-aliasing
)
list
(
APPEND uv_libraries socket
)
list
(
APPEND uv_libraries socket
)
endif
()
endif
()
...
@@ -466,6 +475,7 @@ if(LIBUV_BUILD_TESTS)
...
@@ -466,6 +475,7 @@ if(LIBUV_BUILD_TESTS)
test/test-poll-close-doesnt-corrupt-stack.c
test/test-poll-close-doesnt-corrupt-stack.c
test/test-poll-close.c
test/test-poll-close.c
test/test-poll-closesocket.c
test/test-poll-closesocket.c
test/test-poll-multiple-handles.c
test/test-poll-oob.c
test/test-poll-oob.c
test/test-poll.c
test/test-poll.c
test/test-process-priority.c
test/test-process-priority.c
...
...
worker/deps/libuv/libuv/ChangeLog
浏览文件 @
edde98d7
2020.09.26, Version 1.40.0 (Stable)
2021.02.14, Version 1.41.0 (Stable)
Changes since version 1.40.0:
* mailmap: update contact information for richardlau (Richard Lau)
* build: add asan checks (gengjiawen)
* unix: report bind error in uv_tcp_connect() (Ben Noordhuis)
* doc: uv_tcp_bind() never returns UV_EADDRINUSE (Ben Noordhuis)
* test: fix pump and tcp_write_batch benchmarks (Santiago Gimeno)
* doc: mark IBM i as Tier 2 support (Jesse Gorzinski)
* doc,poll: add notes (repeated cb & cancel pending cb) (Elad Nachmias)
* linux: fix -Wincompatible-pointer-types warning (Ben Noordhuis)
* linux: fix -Wsign-compare warning (Ben Noordhuis)
* android: add system call api guards (Ben Noordhuis)
* unix,win: harmonize uv_read_start() error handling (Ben Noordhuis)
* unix,win: more uv_read_start() argument validation (Ben Noordhuis)
* build: turn on -fno-strict-aliasing (Ben Noordhuis)
* stream: add uv_pipe and uv_socketpair to the API (Jameson Nash)
* unix,win: initialize timer `timeout` field (Ben Noordhuis)
* bsd-ifaddrs: improve comments (Darshan Sen)
* test: remove unnecessary uv_fs_stat() calls (Ben Noordhuis)
* fs: fix utime/futime timestamp rounding errors (Ben Noordhuis)
* test: ensure reliable floating point comparison (Jameson Nash)
* unix,fs: fix uv_fs_sendfile() (Santiago Gimeno)
* unix: fix uv_fs_stat when using statx (Simon Kadisch)
* linux,macos: fix uv_set_process_title regression (Momtchil Momtchev)
* doc: clarify UDP errors and recvmmsg (Ethel Weston)
* test-getaddrinfo: use example.invalid (Drew DeVault)
* Revert "build: fix android autotools build" (Bernardo Ramos)
* unix,fs: on DVS fs, statx returns EOPNOTSUPP (Mark Klein)
* win, fs: mkdir really return UV_EINVAL for invalid names (Nicholas Vavilov)
* tools: migrate tools/make_dist_html.py to python3 (Dominique Dumont)
* unix: fix uv_uptime() on linux (schamberg97)
* unix: check for partial copy_file_range support (Momtchil Momtchev)
* win: bump minimum supported version to windows 8 (Ben Noordhuis)
* poll,unix: ensure safety of rapid fd reuse (Bob Weinand)
* test: fix some warnings (Issam E. Maghni)
* unix: fix uv_uptime() regression (Santiago Gimeno)
* doc: fix versionadded metadata (cjihrig)
* test: fix 'incompatible pointer types' warnings (cjihrig)
* unix: check for EXDEV in uv__fs_sendfile() (Darshan Sen)
2020.09.26, Version 1.40.0 (Stable), 4e69e333252693bd82d6338d6124f0416538dbfc
Changes since version 1.39.0:
Changes since version 1.39.0:
...
...
worker/deps/libuv/libuv/Makefile.am
浏览文件 @
edde98d7
...
@@ -56,7 +56,7 @@ if WINNT
...
@@ -56,7 +56,7 @@ if WINNT
uvinclude_HEADERS
+=
include/uv/win.h include/uv/tree.h
uvinclude_HEADERS
+=
include/uv/win.h include/uv/tree.h
AM_CPPFLAGS
+=
-I
$(top_srcdir)
/src/win
\
AM_CPPFLAGS
+=
-I
$(top_srcdir)
/src/win
\
-DWIN32_LEAN_AND_MEAN
\
-DWIN32_LEAN_AND_MEAN
\
-D_WIN32_WINNT
=
0x060
0
-D_WIN32_WINNT
=
0x060
2
libuv_la_SOURCES
+=
src/win/async.c
\
libuv_la_SOURCES
+=
src/win/async.c
\
src/win/atomicops-inl.h
\
src/win/atomicops-inl.h
\
src/win/core.c
\
src/win/core.c
\
...
@@ -225,6 +225,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
...
@@ -225,6 +225,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
test
/test-poll-close.c
\
test
/test-poll-close.c
\
test
/test-poll-close-doesnt-corrupt-stack.c
\
test
/test-poll-close-doesnt-corrupt-stack.c
\
test
/test-poll-closesocket.c
\
test
/test-poll-closesocket.c
\
test
/test-poll-multiple-handles.c
\
test
/test-poll-oob.c
\
test
/test-poll-oob.c
\
test
/test-process-priority.c
\
test
/test-process-priority.c
\
test
/test-process-title.c
\
test
/test-process-title.c
\
...
@@ -385,10 +386,6 @@ if ANDROID
...
@@ -385,10 +386,6 @@ if ANDROID
uvinclude_HEADERS
+=
include/uv/android-ifaddrs.h
uvinclude_HEADERS
+=
include/uv/android-ifaddrs.h
libuv_la_CFLAGS
+=
-D_GNU_SOURCE
libuv_la_CFLAGS
+=
-D_GNU_SOURCE
libuv_la_SOURCES
+=
src/unix/android-ifaddrs.c
\
libuv_la_SOURCES
+=
src/unix/android-ifaddrs.c
\
src/unix/linux-core.c
\
src/unix/linux-inotify.c
\
src/unix/linux-syscalls.c
\
src/unix/procfs-exepath.c
\
src/unix/pthread-fixes.c
\
src/unix/pthread-fixes.c
\
src/unix/random-getrandom.c
\
src/unix/random-getrandom.c
\
src/unix/random-sysctl-linux.c
src/unix/random-sysctl-linux.c
...
...
worker/deps/libuv/libuv/README.md
浏览文件 @
edde98d7
...
@@ -286,6 +286,16 @@ listed in `test/benchmark-list.h`.
...
@@ -286,6 +286,16 @@ listed in `test/benchmark-list.h`.
Check the
[
SUPPORTED_PLATFORMS file
](
SUPPORTED_PLATFORMS.md
)
.
Check the
[
SUPPORTED_PLATFORMS file
](
SUPPORTED_PLATFORMS.md
)
.
### `-fno-strict-aliasing`
It is recommended to turn on the
`-fno-strict-aliasing`
compiler flag in
projects that use libuv. The use of ad hoc "inheritance" in the libuv API
may not be safe in the presence of compiler optimizations that depend on
strict aliasing.
MSVC does not have an equivalent flag but it also does not appear to need it
at the time of writing (December 2019.)
### AIX Notes
### AIX Notes
AIX compilation using IBM XL C/C++ requires version 12.1 or greater.
AIX compilation using IBM XL C/C++ requires version 12.1 or greater.
...
...
worker/deps/libuv/libuv/SUPPORTED_PLATFORMS.md
浏览文件 @
edde98d7
...
@@ -4,14 +4,14 @@
...
@@ -4,14 +4,14 @@
|---|---|---|---|
|---|---|---|---|
| GNU/Linux | Tier 1 | Linux >= 2.6.32 with glibc >= 2.12 | |
| GNU/Linux | Tier 1 | Linux >= 2.6.32 with glibc >= 2.12 | |
| macOS | Tier 1 | macOS >= 10.7 | |
| macOS | Tier 1 | macOS >= 10.7 | |
| Windows | Tier 1 | >= Windows
7 | MSVC 2008
and later are supported |
| Windows | Tier 1 | >= Windows
8 | VS 2015
and later are supported |
| FreeBSD | Tier 1 | >= 10 | |
| FreeBSD | Tier 1 | >= 10 | |
| AIX | Tier 2 | >= 6 | Maintainers: @libuv/aix |
| AIX | Tier 2 | >= 6 | Maintainers: @libuv/aix |
| IBM i | Tier 2 | >= IBM i 7.2 | Maintainers: @libuv/ibmi |
| z/OS | Tier 2 | >= V2R2 | Maintainers: @libuv/zos |
| z/OS | Tier 2 | >= V2R2 | Maintainers: @libuv/zos |
| Linux with musl | Tier 2 | musl >= 1.0 | |
| Linux with musl | Tier 2 | musl >= 1.0 | |
| SmartOS | Tier 2 | >= 14.4 | Maintainers: @libuv/smartos |
| SmartOS | Tier 2 | >= 14.4 | Maintainers: @libuv/smartos |
| Android | Tier 3 | NDK >= r15b | |
| Android | Tier 3 | NDK >= r15b | |
| IBM i | Tier 3 | >= IBM i 7.2 | Maintainers: @libuv/ibmi |
| MinGW | Tier 3 | MinGW32 and MinGW-w64 | |
| MinGW | Tier 3 | MinGW32 and MinGW-w64 | |
| SunOS | Tier 3 | Solaris 121 and later | |
| SunOS | Tier 3 | Solaris 121 and later | |
| Other | Tier 3 | N/A | |
| Other | Tier 3 | N/A | |
...
...
worker/deps/libuv/libuv/configure.ac
浏览文件 @
edde98d7
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_PREREQ(2.57)
AC_PREREQ(2.57)
AC_INIT([libuv], [1.4
0
.0], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.4
1
.0], [https://github.com/libuv/libuv/issues])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/libuv-extra-automake-flags.m4])
m4_include([m4/libuv-extra-automake-flags.m4])
m4_include([m4/as_case.m4])
m4_include([m4/as_case.m4])
...
@@ -25,6 +25,7 @@ AC_ENABLE_STATIC
...
@@ -25,6 +25,7 @@ AC_ENABLE_STATIC
AC_PROG_CC
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_CC_C_O
CC_FLAG_VISIBILITY #[-fvisibility=hidden]
CC_FLAG_VISIBILITY #[-fvisibility=hidden]
CC_CHECK_CFLAGS_APPEND([-fno-strict-aliasing])
CC_CHECK_CFLAGS_APPEND([-g])
CC_CHECK_CFLAGS_APPEND([-g])
CC_CHECK_CFLAGS_APPEND([-std=gnu89])
CC_CHECK_CFLAGS_APPEND([-std=gnu89])
CC_CHECK_CFLAGS_APPEND([-Wall])
CC_CHECK_CFLAGS_APPEND([-Wall])
...
...
worker/deps/libuv/libuv/docs/src/pipe.rst
浏览文件 @
edde98d7
...
@@ -118,3 +118,21 @@ API
...
@@ -118,3 +118,21 @@ API
function is blocking.
function is blocking.
.. versionadded:: 1.16.0
.. versionadded:: 1.16.0
.. c:function:: int uv_pipe(uv_file fds[2], int read_flags, int write_flags)
Create a pair of connected pipe handles.
Data may be written to `fds[1]` and read from `fds[0]`.
The resulting handles can be passed to `uv_pipe_open`, used with `uv_spawn`,
or for any other purpose.
Valid values for `flags` are:
- UV_NONBLOCK_PIPE: Opens the specified socket handle for `OVERLAPPED`
or `FIONBIO`/`O_NONBLOCK` I/O usage.
This is recommended for handles that will be used by libuv,
and not usually recommended otherwise.
Equivalent to :man:`pipe(2)` with the `O_CLOEXEC` flag set.
.. versionadded:: 1.41.0
worker/deps/libuv/libuv/docs/src/poll.rst
浏览文件 @
edde98d7
...
@@ -86,36 +86,63 @@ API
...
@@ -86,36 +86,63 @@ API
.. c:function:: int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb)
.. c:function:: int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb)
Starts polling the file descriptor. `events` is a bitmask made up of
Starts polling the file descriptor. `events` is a bitmask made up of
UV_READABLE, UV_WRITABLE, UV_PRIORITIZED and UV_DISCONNECT. As soon as a
n
`UV_READABLE`, `UV_WRITABLE`, `UV_PRIORITIZED` and `UV_DISCONNECT`. As soo
n
event is detected the callback will be called with `status` set to 0, and the
as an event is detected the callback will be called with `status` set to 0,
detected events set on the `events` field.
and the
detected events set on the `events` field.
The
UV_PRIORITIZED event is used to watch for sysfs interrupts or TCP out-of-band
The
`UV_PRIORITIZED` event is used to watch for sysfs interrupts or TCP
messages.
out-of-band
messages.
The
UV_DISCONNECT
event is optional in the sense that it may not be
The
`UV_DISCONNECT`
event is optional in the sense that it may not be
reported and the user is free to ignore it, but it can help optimize the
shutdown
reported and the user is free to ignore it, but it can help optimize the
path because an extra read or write call might be avoided.
shutdown
path because an extra read or write call might be avoided.
If an error happens while polling, `status` will be < 0 and corresponds
If an error happens while polling, `status` will be < 0 and corresponds
with one of the
UV_E*
error codes (see :ref:`errors`). The user should
with one of the
`UV_E*`
error codes (see :ref:`errors`). The user should
not close the socket while the handle is active. If the user does that
not close the socket while the handle is active. If the user does that
anyway, the callback *may* be called reporting an error status, but this
anyway, the callback *may* be called reporting an error status, but this
is
is
**not** guaranteed.
**not** guaranteed.
.. note::
.. note::
Calling :c:func:`uv_poll_start` on a handle that is already active is
fine. Doing so
Calling :c:func:`uv_poll_start` on a handle that is already active is
will update the events mask that is being watched for.
fine. Doing so
will update the events mask that is being watched for.
.. note::
.. note::
Though
UV_DISCONNECT can be set, it is unsupported on AIX and as such will not be set
Though
`UV_DISCONNECT` can be set, it is unsupported on AIX and as such
on the `events` field in the callback.
will not be set
on the `events` field in the callback.
.. versionchanged:: 1.9.0 Added the UV_DISCONNECT event.
.. note::
.. versionchanged:: 1.14.0 Added the UV_PRIORITIZED event.
If one of the events `UV_READABLE` or `UV_WRITABLE` are set, the
callback will be called again, as long as the given fd/socket remains
readable or writable accordingly. Particularly in each of the following
scenarios:
* The callback has been called because the socket became
readable/writable and the callback did not conduct a read/write on
this socket at all.
* The callback committed a read on the socket, and has not read all the
available data (when `UV_READABLE` is set).
* The callback committed a write on the socket, but it remained
writable afterwards (when `UV_WRITABLE` is set).
* The socket has already became readable/writable before calling
:c:func:`uv_poll_start` on a poll handle associated with this socket,
and since then the state of the socket did not changed.
In all of the above listed scenarios, the socket remains readable or
writable and hence the callback will be called again (depending on the
events set in the bitmask). This behaviour is known as level
triggering.
.. versionchanged:: 1.9.0 Added the `UV_DISCONNECT` event.
.. versionchanged:: 1.14.0 Added the `UV_PRIORITIZED` event.
.. c:function:: int uv_poll_stop(uv_poll_t* poll)
.. c:function:: int uv_poll_stop(uv_poll_t* poll)
Stop polling the file descriptor, the callback will no longer be called.
Stop polling the file descriptor, the callback will no longer be called.
.. note::
Calling :c:func:`uv_poll_stop` is effective immediately: any pending
callback is also canceled, even if the socket state change notification
was already pending.
.. seealso:: The :c:type:`uv_handle_t` API functions also apply.
.. seealso:: The :c:type:`uv_handle_t` API functions also apply.
worker/deps/libuv/libuv/docs/src/process.rst
浏览文件 @
edde98d7
...
@@ -119,12 +119,14 @@ Data types
...
@@ -119,12 +119,14 @@ Data types
* flags may be specified to create a duplex data stream.
* flags may be specified to create a duplex data stream.
*/
*/
UV_READABLE_PIPE = 0x10,
UV_READABLE_PIPE = 0x10,
UV_WRITABLE_PIPE = 0x20
UV_WRITABLE_PIPE = 0x20
,
/*
/*
* Open the child pipe handle in overlapped mode on Windows.
* When UV_CREATE_PIPE is specified, specifying UV_NONBLOCK_PIPE opens the
* On Unix it is silently ignored.
* handle in non-blocking mode in the child. This may cause loss of data,
*/
* if the child is not designed to handle to encounter this mode,
UV_OVERLAPPED_PIPE = 0x40
* but can also be significantly more efficient.
*/
UV_NONBLOCK_PIPE = 0x40
} uv_stdio_flags;
} uv_stdio_flags;
...
...
worker/deps/libuv/libuv/docs/src/stream.rst
浏览文件 @
edde98d7
...
@@ -139,6 +139,11 @@ API
...
@@ -139,6 +139,11 @@ API
be made several times until there is no more data to read or
be made several times until there is no more data to read or
:c:func:`uv_read_stop` is called.
:c:func:`uv_read_stop` is called.
.. versionchanged:: 1.38.0 :c:func:`uv_read_start()` now consistently
returns `UV_EALREADY` when called twice, and `UV_EINVAL` when the
stream is closing. With older libuv versions, it returns `UV_EALREADY`
on Windows but not UNIX, and `UV_EINVAL` on UNIX but not Windows.
.. c:function:: int uv_read_stop(uv_stream_t*)
.. c:function:: int uv_read_stop(uv_stream_t*)
Stop reading data from the stream. The :c:type:`uv_read_cb` callback will
Stop reading data from the stream. The :c:type:`uv_read_cb` callback will
...
...
worker/deps/libuv/libuv/docs/src/tcp.rst
浏览文件 @
edde98d7
...
@@ -81,10 +81,9 @@ API
...
@@ -81,10 +81,9 @@ API
initialized ``struct sockaddr_in`` or ``struct sockaddr_in6``.
initialized ``struct sockaddr_in`` or ``struct sockaddr_in6``.
When the port is already taken, you can expect to see an ``UV_EADDRINUSE``
When the port is already taken, you can expect to see an ``UV_EADDRINUSE``
error from either :c:func:`uv_tcp_bind`, :c:func:`uv_listen` or
error from :c:func:`uv_listen` or :c:func:`uv_tcp_connect`. That is,
:c:func:`uv_tcp_connect`. That is, a successful call to this function does
a successful call to this function does not guarantee that the call
not guarantee that the call to :c:func:`uv_listen` or :c:func:`uv_tcp_connect`
to :c:func:`uv_listen` or :c:func:`uv_tcp_connect` will succeed as well.
will succeed as well.
`flags` can contain ``UV_TCP_IPV6ONLY``, in which case dual-stack support
`flags` can contain ``UV_TCP_IPV6ONLY``, in which case dual-stack support
is disabled and only IPv6 is used.
is disabled and only IPv6 is used.
...
@@ -128,3 +127,20 @@ API
...
@@ -128,3 +127,20 @@ API
:c:func:`uv_tcp_close_reset` calls is not allowed.
:c:func:`uv_tcp_close_reset` calls is not allowed.
.. versionadded:: 1.32.0
.. versionadded:: 1.32.0
.. c:function:: int uv_socketpair(int type, int protocol, uv_os_sock_t socket_vector[2], int flags0, int flags1)
Create a pair of connected sockets with the specified properties.
The resulting handles can be passed to `uv_tcp_open`, used with `uv_spawn`,
or for any other purpose.
Valid values for `flags0` and `flags1` are:
- UV_NONBLOCK_PIPE: Opens the specified socket handle for `OVERLAPPED`
or `FIONBIO`/`O_NONBLOCK` I/O usage.
This is recommended for handles that will be used by libuv,
and not usually recommended otherwise.
Equivalent to :man:`socketpair(2)` with a domain of AF_UNIX.
.. versionadded:: 1.41.0
worker/deps/libuv/libuv/docs/src/udp.rst
浏览文件 @
edde98d7
...
@@ -73,7 +73,8 @@ Data types
...
@@ -73,7 +73,8 @@ Data types
* `nread`: Number of bytes that have been received.
* `nread`: Number of bytes that have been received.
0 if there is no more data to read. Note that 0 may also mean that an
0 if there is no more data to read. Note that 0 may also mean that an
empty datagram was received (in this case `addr` is not NULL). < 0 if
empty datagram was received (in this case `addr` is not NULL). < 0 if
a transmission error was detected.
a transmission error was detected; if using :man:`recvmmsg(2)` no more
chunks will be received and the buffer can be freed safely.
* `buf`: :c:type:`uv_buf_t` with the received data.
* `buf`: :c:type:`uv_buf_t` with the received data.
* `addr`: ``struct sockaddr*`` containing the address of the sender.
* `addr`: ``struct sockaddr*`` containing the address of the sender.
Can be NULL. Valid for the duration of the callback only.
Can be NULL. Valid for the duration of the callback only.
...
@@ -84,10 +85,11 @@ Data types
...
@@ -84,10 +85,11 @@ Data types
on error.
on error.
When using :man:`recvmmsg(2)`, chunks will have the `UV_UDP_MMSG_CHUNK` flag set,
When using :man:`recvmmsg(2)`, chunks will have the `UV_UDP_MMSG_CHUNK` flag set,
those must not be freed. There will be a final callback with `nread` set to 0,
those must not be freed. If no errors occur, there will be a final callback with
`addr` set to NULL and the buffer pointing at the initially allocated data with
`nread` set to 0, `addr` set to NULL and the buffer pointing at the initially
the `UV_UDP_MMSG_CHUNK` flag cleared and the `UV_UDP_MMSG_FREE` flag set.
allocated data with the `UV_UDP_MMSG_CHUNK` flag cleared and the `UV_UDP_MMSG_FREE`
The callee can now safely free the provided buffer.
flag set. If a UDP socket error occurs, `nread` will be < 0. In either scenario,
the callee can now safely free the provided buffer.
.. versionchanged:: 1.40.0 added the `UV_UDP_MMSG_FREE` flag.
.. versionchanged:: 1.40.0 added the `UV_UDP_MMSG_FREE` flag.
...
...
worker/deps/libuv/libuv/include/uv.h
浏览文件 @
edde98d7
...
@@ -475,6 +475,12 @@ UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd);
...
@@ -475,6 +475,12 @@ UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd);
UV_EXTERN
uv_buf_t
uv_buf_init
(
char
*
base
,
unsigned
int
len
);
UV_EXTERN
uv_buf_t
uv_buf_init
(
char
*
base
,
unsigned
int
len
);
UV_EXTERN
int
uv_pipe
(
uv_file
fds
[
2
],
int
read_flags
,
int
write_flags
);
UV_EXTERN
int
uv_socketpair
(
int
type
,
int
protocol
,
uv_os_sock_t
socket_vector
[
2
],
int
flags0
,
int
flags1
);
#define UV_STREAM_FIELDS \
#define UV_STREAM_FIELDS \
/* number of bytes queued for writing */
\
/* number of bytes queued for writing */
\
...
@@ -933,10 +939,13 @@ typedef enum {
...
@@ -933,10 +939,13 @@ typedef enum {
UV_WRITABLE_PIPE
=
0x20
,
UV_WRITABLE_PIPE
=
0x20
,
/*
/*
* Open the child pipe handle in overlapped mode on Windows.
* When UV_CREATE_PIPE is specified, specifying UV_NONBLOCK_PIPE opens the
* On Unix it is silently ignored.
* handle in non-blocking mode in the child. This may cause loss of data,
* if the child is not designed to handle to encounter this mode,
* but can also be significantly more efficient.
*/
*/
UV_OVERLAPPED_PIPE
=
0x40
UV_NONBLOCK_PIPE
=
0x40
,
UV_OVERLAPPED_PIPE
=
0x40
/* old name, for compatibility */
}
uv_stdio_flags
;
}
uv_stdio_flags
;
typedef
struct
uv_stdio_container_s
{
typedef
struct
uv_stdio_container_s
{
...
...
worker/deps/libuv/libuv/include/uv/version.h
浏览文件 @
edde98d7
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
*/
*/
#define UV_VERSION_MAJOR 1
#define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 4
0
#define UV_VERSION_MINOR 4
1
#define UV_VERSION_PATCH 0
#define UV_VERSION_PATCH 0
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""
#define UV_VERSION_SUFFIX ""
...
...
worker/deps/libuv/libuv/src/timer.c
浏览文件 @
edde98d7
...
@@ -58,6 +58,7 @@ static int timer_less_than(const struct heap_node* ha,
...
@@ -58,6 +58,7 @@ static int timer_less_than(const struct heap_node* ha,
int
uv_timer_init
(
uv_loop_t
*
loop
,
uv_timer_t
*
handle
)
{
int
uv_timer_init
(
uv_loop_t
*
loop
,
uv_timer_t
*
handle
)
{
uv__handle_init
(
loop
,
(
uv_handle_t
*
)
handle
,
UV_TIMER
);
uv__handle_init
(
loop
,
(
uv_handle_t
*
)
handle
,
UV_TIMER
);
handle
->
timer_cb
=
NULL
;
handle
->
timer_cb
=
NULL
;
handle
->
timeout
=
0
;
handle
->
repeat
=
0
;
handle
->
repeat
=
0
;
return
0
;
return
0
;
}
}
...
...
worker/deps/libuv/libuv/src/unix/async.c
浏览文件 @
edde98d7
...
@@ -214,7 +214,7 @@ static int uv__async_start(uv_loop_t* loop) {
...
@@ -214,7 +214,7 @@ static int uv__async_start(uv_loop_t* loop) {
pipefd
[
0
]
=
err
;
pipefd
[
0
]
=
err
;
pipefd
[
1
]
=
-
1
;
pipefd
[
1
]
=
-
1
;
#else
#else
err
=
uv__make_pipe
(
pipefd
,
UV_
_F_NONBLOCK
);
err
=
uv__make_pipe
(
pipefd
,
UV_
NONBLOCK_PIPE
);
if
(
err
<
0
)
if
(
err
<
0
)
return
err
;
return
err
;
#endif
#endif
...
...
worker/deps/libuv/libuv/src/unix/bsd-ifaddrs.c
浏览文件 @
edde98d7
...
@@ -42,8 +42,8 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
...
@@ -42,8 +42,8 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
return
1
;
return
1
;
#if !defined(__CYGWIN__) && !defined(__MSYS__)
#if !defined(__CYGWIN__) && !defined(__MSYS__)
/*
/*
* If `exclude_type` is `UV__EXCLUDE_IFPHYS`,
just see
whether `sa_family`
* If `exclude_type` is `UV__EXCLUDE_IFPHYS`,
return
whether `sa_family`
* equals
to `AF_LINK` or not. Otherwise, the result depends on the operation
* equals
`AF_LINK`. Otherwise, the result depends on the operating
* system with `AF_LINK` or `PF_INET`.
* system with `AF_LINK` or `PF_INET`.
*/
*/
if
(
exclude_type
==
UV__EXCLUDE_IFPHYS
)
if
(
exclude_type
==
UV__EXCLUDE_IFPHYS
)
...
@@ -53,7 +53,7 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
...
@@ -53,7 +53,7 @@ static int uv__ifaddr_exclude(struct ifaddrs *ent, int exclude_type) {
defined(__HAIKU__)
defined(__HAIKU__)
/*
/*
* On BSD getifaddrs returns information related to the raw underlying
* On BSD getifaddrs returns information related to the raw underlying
* devices.
We're not interested in this information.
* devices. We're not interested in this information.
*/
*/
if
(
ent
->
ifa_addr
->
sa_family
==
AF_LINK
)
if
(
ent
->
ifa_addr
->
sa_family
==
AF_LINK
)
return
1
;
return
1
;
...
...
worker/deps/libuv/libuv/src/unix/core.c
浏览文件 @
edde98d7
...
@@ -925,13 +925,12 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
...
@@ -925,13 +925,12 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
if
(
w
->
pevents
==
0
)
{
if
(
w
->
pevents
==
0
)
{
QUEUE_REMOVE
(
&
w
->
watcher_queue
);
QUEUE_REMOVE
(
&
w
->
watcher_queue
);
QUEUE_INIT
(
&
w
->
watcher_queue
);
QUEUE_INIT
(
&
w
->
watcher_queue
);
w
->
events
=
0
;
if
(
loop
->
watchers
[
w
->
fd
]
!=
NULL
)
{
if
(
w
==
loop
->
watchers
[
w
->
fd
])
{
assert
(
loop
->
watchers
[
w
->
fd
]
==
w
);
assert
(
loop
->
nfds
>
0
);
assert
(
loop
->
nfds
>
0
);
loop
->
watchers
[
w
->
fd
]
=
NULL
;
loop
->
watchers
[
w
->
fd
]
=
NULL
;
loop
->
nfds
--
;
loop
->
nfds
--
;
w
->
events
=
0
;
}
}
}
}
else
if
(
QUEUE_EMPTY
(
&
w
->
watcher_queue
))
else
if
(
QUEUE_EMPTY
(
&
w
->
watcher_queue
))
...
...
worker/deps/libuv/libuv/src/unix/fs.c
浏览文件 @
edde98d7
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
#if defined(__linux__) || defined(__sun)
#if defined(__linux__) || defined(__sun)
# include <sys/sendfile.h>
# include <sys/sendfile.h>
# include <sys/sysmacros.h>
#endif
#endif
#if defined(__APPLE__)
#if defined(__APPLE__)
...
@@ -212,14 +213,30 @@ static ssize_t uv__fs_fdatasync(uv_fs_t* req) {
...
@@ -212,14 +213,30 @@ static ssize_t uv__fs_fdatasync(uv_fs_t* req) {
UV_UNUSED
(
static
struct
timespec
uv__fs_to_timespec
(
double
time
))
{
UV_UNUSED
(
static
struct
timespec
uv__fs_to_timespec
(
double
time
))
{
struct
timespec
ts
;
struct
timespec
ts
;
ts
.
tv_sec
=
time
;
ts
.
tv_sec
=
time
;
ts
.
tv_nsec
=
(
uint64_t
)(
time
*
1000000
)
%
1000000
*
1000
;
ts
.
tv_nsec
=
(
time
-
ts
.
tv_sec
)
*
1e9
;
/* TODO(bnoordhuis) Remove this. utimesat() has nanosecond resolution but we
* stick to microsecond resolution for the sake of consistency with other
* platforms. I'm the original author of this compatibility hack but I'm
* less convinced it's useful nowadays.
*/
ts
.
tv_nsec
-=
ts
.
tv_nsec
%
1000
;
if
(
ts
.
tv_nsec
<
0
)
{
ts
.
tv_nsec
+=
1e9
;
ts
.
tv_sec
-=
1
;
}
return
ts
;
return
ts
;
}
}
UV_UNUSED
(
static
struct
timeval
uv__fs_to_timeval
(
double
time
))
{
UV_UNUSED
(
static
struct
timeval
uv__fs_to_timeval
(
double
time
))
{
struct
timeval
tv
;
struct
timeval
tv
;
tv
.
tv_sec
=
time
;
tv
.
tv_sec
=
time
;
tv
.
tv_usec
=
(
uint64_t
)(
time
*
1000000
)
%
1000000
;
tv
.
tv_usec
=
(
time
-
tv
.
tv_sec
)
*
1e6
;
if
(
tv
.
tv_usec
<
0
)
{
tv
.
tv_usec
+=
1e6
;
tv
.
tv_sec
-=
1
;
}
return
tv
;
return
tv
;
}
}
...
@@ -227,9 +244,6 @@ static ssize_t uv__fs_futime(uv_fs_t* req) {
...
@@ -227,9 +244,6 @@ static ssize_t uv__fs_futime(uv_fs_t* req) {
#if defined(__linux__) \
#if defined(__linux__) \
|| defined(_AIX71) \
|| defined(_AIX71) \
|| defined(__HAIKU__)
|| defined(__HAIKU__)
/* utimesat() has nanosecond resolution but we stick to microseconds
* for the sake of consistency with other platforms.
*/
struct
timespec
ts
[
2
];
struct
timespec
ts
[
2
];
ts
[
0
]
=
uv__fs_to_timespec
(
req
->
atime
);
ts
[
0
]
=
uv__fs_to_timespec
(
req
->
atime
);
ts
[
1
]
=
uv__fs_to_timespec
(
req
->
mtime
);
ts
[
1
]
=
uv__fs_to_timespec
(
req
->
mtime
);
...
@@ -906,11 +920,17 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
...
@@ -906,11 +920,17 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
static
int
copy_file_range_support
=
1
;
static
int
copy_file_range_support
=
1
;
if
(
copy_file_range_support
)
{
if
(
copy_file_range_support
)
{
r
=
uv__fs_copy_file_range
(
in_fd
,
NULL
,
out_fd
,
&
off
,
req
->
bufsml
[
0
].
len
,
0
);
r
=
uv__fs_copy_file_range
(
in_fd
,
&
off
,
out_fd
,
NULL
,
req
->
bufsml
[
0
].
len
,
0
);
if
(
r
==
-
1
&&
errno
==
ENOSYS
)
{
if
(
r
==
-
1
&&
errno
==
ENOSYS
)
{
/* ENOSYS - it will never work */
errno
=
0
;
errno
=
0
;
copy_file_range_support
=
0
;
copy_file_range_support
=
0
;
}
else
if
(
r
==
-
1
&&
(
errno
==
ENOTSUP
||
errno
==
EXDEV
))
{
/* ENOTSUP - it could work on another file system type */
/* EXDEV - it will not work when in_fd and out_fd are not on the same
mounted filesystem (pre Linux 5.3) */
errno
=
0
;
}
else
{
}
else
{
goto
ok
;
goto
ok
;
}
}
...
@@ -1010,9 +1030,6 @@ static ssize_t uv__fs_utime(uv_fs_t* req) {
...
@@ -1010,9 +1030,6 @@ static ssize_t uv__fs_utime(uv_fs_t* req) {
|| defined(_AIX71) \
|| defined(_AIX71) \
|| defined(__sun) \
|| defined(__sun) \
|| defined(__HAIKU__)
|| defined(__HAIKU__)
/* utimesat() has nanosecond resolution but we stick to microseconds
* for the sake of consistency with other platforms.
*/
struct
timespec
ts
[
2
];
struct
timespec
ts
[
2
];
ts
[
0
]
=
uv__fs_to_timespec
(
req
->
atime
);
ts
[
0
]
=
uv__fs_to_timespec
(
req
->
atime
);
ts
[
1
]
=
uv__fs_to_timespec
(
req
->
mtime
);
ts
[
1
]
=
uv__fs_to_timespec
(
req
->
mtime
);
...
@@ -1220,7 +1237,7 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) {
...
@@ -1220,7 +1237,7 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) {
if
(
fstatfs
(
dstfd
,
&
s
)
==
-
1
)
if
(
fstatfs
(
dstfd
,
&
s
)
==
-
1
)
goto
out
;
goto
out
;
if
(
s
.
f_type
!=
/* CIFS */
0xFF534D42u
)
if
(
(
unsigned
)
s
.
f_type
!=
/* CIFS */
0xFF534D42u
)
goto
out
;
goto
out
;
}
}
...
@@ -1420,8 +1437,9 @@ static int uv__fs_statx(int fd,
...
@@ -1420,8 +1437,9 @@ static int uv__fs_statx(int fd,
case
-
1
:
case
-
1
:
/* EPERM happens when a seccomp filter rejects the system call.
/* EPERM happens when a seccomp filter rejects the system call.
* Has been observed with libseccomp < 2.3.3 and docker < 18.04.
* Has been observed with libseccomp < 2.3.3 and docker < 18.04.
* EOPNOTSUPP is used on DVS exported filesystems
*/
*/
if
(
errno
!=
EINVAL
&&
errno
!=
EPERM
&&
errno
!=
ENOSYS
)
if
(
errno
!=
EINVAL
&&
errno
!=
EPERM
&&
errno
!=
ENOSYS
&&
errno
!=
EOPNOTSUPP
)
return
-
1
;
return
-
1
;
/* Fall through. */
/* Fall through. */
default:
default:
...
@@ -1434,12 +1452,12 @@ static int uv__fs_statx(int fd,
...
@@ -1434,12 +1452,12 @@ static int uv__fs_statx(int fd,
return
UV_ENOSYS
;
return
UV_ENOSYS
;
}
}
buf
->
st_dev
=
256
*
statxbuf
.
stx_dev_major
+
statxbuf
.
stx_dev_minor
;
buf
->
st_dev
=
makedev
(
statxbuf
.
stx_dev_major
,
statxbuf
.
stx_dev_minor
)
;
buf
->
st_mode
=
statxbuf
.
stx_mode
;
buf
->
st_mode
=
statxbuf
.
stx_mode
;
buf
->
st_nlink
=
statxbuf
.
stx_nlink
;
buf
->
st_nlink
=
statxbuf
.
stx_nlink
;
buf
->
st_uid
=
statxbuf
.
stx_uid
;
buf
->
st_uid
=
statxbuf
.
stx_uid
;
buf
->
st_gid
=
statxbuf
.
stx_gid
;
buf
->
st_gid
=
statxbuf
.
stx_gid
;
buf
->
st_rdev
=
statxbuf
.
stx_rdev_major
;
buf
->
st_rdev
=
makedev
(
statxbuf
.
stx_rdev_major
,
statxbuf
.
stx_rdev_minor
)
;
buf
->
st_ino
=
statxbuf
.
stx_ino
;
buf
->
st_ino
=
statxbuf
.
stx_ino
;
buf
->
st_size
=
statxbuf
.
stx_size
;
buf
->
st_size
=
statxbuf
.
stx_size
;
buf
->
st_blksize
=
statxbuf
.
stx_blksize
;
buf
->
st_blksize
=
statxbuf
.
stx_blksize
;
...
...
worker/deps/libuv/libuv/src/unix/internal.h
浏览文件 @
edde98d7
...
@@ -282,12 +282,6 @@ int uv___stream_fd(const uv_stream_t* handle);
...
@@ -282,12 +282,6 @@ int uv___stream_fd(const uv_stream_t* handle);
#define uv__stream_fd(handle) ((handle)->io_watcher.fd)
#define uv__stream_fd(handle) ((handle)->io_watcher.fd)
#endif
/* defined(__APPLE__) */
#endif
/* defined(__APPLE__) */
#ifdef O_NONBLOCK
# define UV__F_NONBLOCK O_NONBLOCK
#else
# define UV__F_NONBLOCK 1
#endif
int
uv__make_pipe
(
int
fds
[
2
],
int
flags
);
int
uv__make_pipe
(
int
fds
[
2
],
int
flags
);
#if defined(__APPLE__)
#if defined(__APPLE__)
...
...
worker/deps/libuv/libuv/src/unix/linux-core.c
浏览文件 @
edde98d7
...
@@ -602,22 +602,53 @@ err:
...
@@ -602,22 +602,53 @@ err:
return
UV_EINVAL
;
return
UV_EINVAL
;
}
}
static
int
uv__slurp
(
const
char
*
filename
,
char
*
buf
,
size_t
len
)
{
ssize_t
n
;
int
fd
;
assert
(
len
>
0
);
fd
=
uv__open_cloexec
(
filename
,
O_RDONLY
);
if
(
fd
<
0
)
return
fd
;
do
n
=
read
(
fd
,
buf
,
len
-
1
);
while
(
n
==
-
1
&&
errno
==
EINTR
);
if
(
uv__close_nocheckstdio
(
fd
))
abort
();
if
(
n
<
0
)
return
UV__ERR
(
errno
);
buf
[
n
]
=
'\0'
;
return
0
;
}
int
uv_uptime
(
double
*
uptime
)
{
int
uv_uptime
(
double
*
uptime
)
{
static
volatile
int
no_clock_boottime
;
static
volatile
int
no_clock_boottime
;
char
buf
[
128
];
struct
timespec
now
;
struct
timespec
now
;
int
r
;
int
r
;
/* Try /proc/uptime first, then fallback to clock_gettime(). */
if
(
0
==
uv__slurp
(
"/proc/uptime"
,
buf
,
sizeof
(
buf
)))
if
(
1
==
sscanf
(
buf
,
"%lf"
,
uptime
))
return
0
;
/* Try CLOCK_BOOTTIME first, fall back to CLOCK_MONOTONIC if not available
/* Try CLOCK_BOOTTIME first, fall back to CLOCK_MONOTONIC if not available
* (pre-2.6.39 kernels). CLOCK_MONOTONIC doesn't increase when the system
* (pre-2.6.39 kernels). CLOCK_MONOTONIC doesn't increase when the system
* is suspended.
* is suspended.
*/
*/
if
(
no_clock_boottime
)
{
if
(
no_clock_boottime
)
{
retry:
r
=
clock_gettime
(
CLOCK_MONOTONIC
,
&
now
);
retry
_clock_gettime
:
r
=
clock_gettime
(
CLOCK_MONOTONIC
,
&
now
);
}
}
else
if
((
r
=
clock_gettime
(
CLOCK_BOOTTIME
,
&
now
))
&&
errno
==
EINVAL
)
{
else
if
((
r
=
clock_gettime
(
CLOCK_BOOTTIME
,
&
now
))
&&
errno
==
EINVAL
)
{
no_clock_boottime
=
1
;
no_clock_boottime
=
1
;
goto
retry
;
goto
retry
_clock_gettime
;
}
}
if
(
r
)
if
(
r
)
...
@@ -1025,32 +1056,6 @@ void uv__set_process_title(const char* title) {
...
@@ -1025,32 +1056,6 @@ void uv__set_process_title(const char* title) {
}
}
static
int
uv__slurp
(
const
char
*
filename
,
char
*
buf
,
size_t
len
)
{
ssize_t
n
;
int
fd
;
assert
(
len
>
0
);
fd
=
uv__open_cloexec
(
filename
,
O_RDONLY
);
if
(
fd
<
0
)
return
fd
;
do
n
=
read
(
fd
,
buf
,
len
-
1
);
while
(
n
==
-
1
&&
errno
==
EINTR
);
if
(
uv__close_nocheckstdio
(
fd
))
abort
();
if
(
n
<
0
)
return
UV__ERR
(
errno
);
buf
[
n
]
=
'\0'
;
return
0
;
}
static
uint64_t
uv__read_proc_meminfo
(
const
char
*
what
)
{
static
uint64_t
uv__read_proc_meminfo
(
const
char
*
what
)
{
uint64_t
rc
;
uint64_t
rc
;
char
*
p
;
char
*
p
;
...
...
worker/deps/libuv/libuv/src/unix/linux-syscalls.c
浏览文件 @
edde98d7
...
@@ -194,37 +194,37 @@ int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
...
@@ -194,37 +194,37 @@ int uv__recvmmsg(int fd, struct uv__mmsghdr* mmsg, unsigned int vlen) {
ssize_t
uv__preadv
(
int
fd
,
const
struct
iovec
*
iov
,
int
iovcnt
,
int64_t
offset
)
{
ssize_t
uv__preadv
(
int
fd
,
const
struct
iovec
*
iov
,
int
iovcnt
,
int64_t
offset
)
{
#if defined(__NR_preadv)
#if !defined(__NR_preadv) || defined(__ANDROID_API__) && __ANDROID_API__ < 24
return
syscall
(
__NR_preadv
,
fd
,
iov
,
iovcnt
,
(
long
)
offset
,
(
long
)(
offset
>>
32
));
#else
return
errno
=
ENOSYS
,
-
1
;
return
errno
=
ENOSYS
,
-
1
;
#else
return
syscall
(
__NR_preadv
,
fd
,
iov
,
iovcnt
,
(
long
)
offset
,
(
long
)(
offset
>>
32
));
#endif
#endif
}
}
ssize_t
uv__pwritev
(
int
fd
,
const
struct
iovec
*
iov
,
int
iovcnt
,
int64_t
offset
)
{
ssize_t
uv__pwritev
(
int
fd
,
const
struct
iovec
*
iov
,
int
iovcnt
,
int64_t
offset
)
{
#if defined(__NR_pwritev)
#if !defined(__NR_pwritev) || defined(__ANDROID_API__) && __ANDROID_API__ < 24
return
syscall
(
__NR_pwritev
,
fd
,
iov
,
iovcnt
,
(
long
)
offset
,
(
long
)(
offset
>>
32
));
#else
return
errno
=
ENOSYS
,
-
1
;
return
errno
=
ENOSYS
,
-
1
;
#else
return
syscall
(
__NR_pwritev
,
fd
,
iov
,
iovcnt
,
(
long
)
offset
,
(
long
)(
offset
>>
32
));
#endif
#endif
}
}
int
uv__dup3
(
int
oldfd
,
int
newfd
,
int
flags
)
{
int
uv__dup3
(
int
oldfd
,
int
newfd
,
int
flags
)
{
#if defined(__NR_dup3)
#if !defined(__NR_dup3) || defined(__ANDROID_API__) && __ANDROID_API__ < 21
return
syscall
(
__NR_dup3
,
oldfd
,
newfd
,
flags
);
#else
return
errno
=
ENOSYS
,
-
1
;
return
errno
=
ENOSYS
,
-
1
;
#else
return
syscall
(
__NR_dup3
,
oldfd
,
newfd
,
flags
);
#endif
#endif
}
}
ssize_t
ssize_t
uv__fs_copy_file_range
(
int
fd_in
,
uv__fs_copy_file_range
(
int
fd_in
,
ssize
_t
*
off_in
,
off
_t
*
off_in
,
int
fd_out
,
int
fd_out
,
ssize
_t
*
off_out
,
off
_t
*
off_out
,
size_t
len
,
size_t
len
,
unsigned
int
flags
)
unsigned
int
flags
)
{
{
...
@@ -247,21 +247,18 @@ int uv__statx(int dirfd,
...
@@ -247,21 +247,18 @@ int uv__statx(int dirfd,
int
flags
,
int
flags
,
unsigned
int
mask
,
unsigned
int
mask
,
struct
uv__statx
*
statxbuf
)
{
struct
uv__statx
*
statxbuf
)
{
/* __NR_statx make Android box killed by SIGSYS.
#if !defined(__NR_statx) || defined(__ANDROID_API__) && __ANDROID_API__ < 30
* That looks like a seccomp2 sandbox filter rejecting the system call.
*/
#if defined(__NR_statx) && !defined(__ANDROID__)
return
syscall
(
__NR_statx
,
dirfd
,
path
,
flags
,
mask
,
statxbuf
);
#else
return
errno
=
ENOSYS
,
-
1
;
return
errno
=
ENOSYS
,
-
1
;
#else
return
syscall
(
__NR_statx
,
dirfd
,
path
,
flags
,
mask
,
statxbuf
);
#endif
#endif
}
}
ssize_t
uv__getrandom
(
void
*
buf
,
size_t
buflen
,
unsigned
flags
)
{
ssize_t
uv__getrandom
(
void
*
buf
,
size_t
buflen
,
unsigned
flags
)
{
#if defined(__NR_getrandom)
#if !defined(__NR_getrandom) || defined(__ANDROID_API__) && __ANDROID_API__ < 28
return
syscall
(
__NR_getrandom
,
buf
,
buflen
,
flags
);
#else
return
errno
=
ENOSYS
,
-
1
;
return
errno
=
ENOSYS
,
-
1
;
#else
return
syscall
(
__NR_getrandom
,
buf
,
buflen
,
flags
);
#endif
#endif
}
}
worker/deps/libuv/libuv/src/unix/linux-syscalls.h
浏览文件 @
edde98d7
...
@@ -66,9 +66,9 @@ ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset)
...
@@ -66,9 +66,9 @@ ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset)
int
uv__dup3
(
int
oldfd
,
int
newfd
,
int
flags
);
int
uv__dup3
(
int
oldfd
,
int
newfd
,
int
flags
);
ssize_t
ssize_t
uv__fs_copy_file_range
(
int
fd_in
,
uv__fs_copy_file_range
(
int
fd_in
,
ssize
_t
*
off_in
,
off
_t
*
off_in
,
int
fd_out
,
int
fd_out
,
ssize
_t
*
off_out
,
off
_t
*
off_out
,
size_t
len
,
size_t
len
,
unsigned
int
flags
);
unsigned
int
flags
);
int
uv__statx
(
int
dirfd
,
int
uv__statx
(
int
dirfd
,
...
...
worker/deps/libuv/libuv/src/unix/pipe.c
浏览文件 @
edde98d7
...
@@ -379,3 +379,57 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
...
@@ -379,3 +379,57 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
return
r
!=
-
1
?
0
:
UV__ERR
(
errno
);
return
r
!=
-
1
?
0
:
UV__ERR
(
errno
);
}
}
int
uv_pipe
(
uv_os_fd_t
fds
[
2
],
int
read_flags
,
int
write_flags
)
{
uv_os_fd_t
temp
[
2
];
int
err
;
#if defined(__FreeBSD__) || defined(__linux__)
int
flags
=
O_CLOEXEC
;
if
((
read_flags
&
UV_NONBLOCK_PIPE
)
&&
(
write_flags
&
UV_NONBLOCK_PIPE
))
flags
|=
UV_FS_O_NONBLOCK
;
if
(
pipe2
(
temp
,
flags
))
return
UV__ERR
(
errno
);
if
(
flags
&
UV_FS_O_NONBLOCK
)
{
fds
[
0
]
=
temp
[
0
];
fds
[
1
]
=
temp
[
1
];
return
0
;
}
#else
if
(
pipe
(
temp
))
return
UV__ERR
(
errno
);
if
((
err
=
uv__cloexec
(
temp
[
0
],
1
)))
goto
fail
;
if
((
err
=
uv__cloexec
(
temp
[
1
],
1
)))
goto
fail
;
#endif
if
(
read_flags
&
UV_NONBLOCK_PIPE
)
if
((
err
=
uv__nonblock
(
temp
[
0
],
1
)))
goto
fail
;
if
(
write_flags
&
UV_NONBLOCK_PIPE
)
if
((
err
=
uv__nonblock
(
temp
[
1
],
1
)))
goto
fail
;
fds
[
0
]
=
temp
[
0
];
fds
[
1
]
=
temp
[
1
];
return
0
;
fail:
uv__close
(
temp
[
0
]);
uv__close
(
temp
[
1
]);
return
err
;
}
int
uv__make_pipe
(
int
fds
[
2
],
int
flags
)
{
return
uv_pipe
(
fds
,
flags
&
UV_NONBLOCK_PIPE
,
flags
&
UV_NONBLOCK_PIPE
);
}
worker/deps/libuv/libuv/src/unix/poll.c
浏览文件 @
edde98d7
...
@@ -116,12 +116,21 @@ int uv_poll_stop(uv_poll_t* handle) {
...
@@ -116,12 +116,21 @@ int uv_poll_stop(uv_poll_t* handle) {
int
uv_poll_start
(
uv_poll_t
*
handle
,
int
pevents
,
uv_poll_cb
poll_cb
)
{
int
uv_poll_start
(
uv_poll_t
*
handle
,
int
pevents
,
uv_poll_cb
poll_cb
)
{
uv__io_t
**
watchers
;
uv__io_t
*
w
;
int
events
;
int
events
;
assert
((
pevents
&
~
(
UV_READABLE
|
UV_WRITABLE
|
UV_DISCONNECT
|
assert
((
pevents
&
~
(
UV_READABLE
|
UV_WRITABLE
|
UV_DISCONNECT
|
UV_PRIORITIZED
))
==
0
);
UV_PRIORITIZED
))
==
0
);
assert
(
!
uv__is_closing
(
handle
));
assert
(
!
uv__is_closing
(
handle
));
watchers
=
handle
->
loop
->
watchers
;
w
=
&
handle
->
io_watcher
;
if
(
uv__fd_exists
(
handle
->
loop
,
w
->
fd
))
if
(
watchers
[
w
->
fd
]
!=
w
)
return
UV_EEXIST
;
uv__poll_stop
(
handle
);
uv__poll_stop
(
handle
);
if
(
pevents
==
0
)
if
(
pevents
==
0
)
...
...
worker/deps/libuv/libuv/src/unix/process.c
浏览文件 @
edde98d7
...
@@ -111,68 +111,6 @@ static void uv__chld(uv_signal_t* handle, int signum) {
...
@@ -111,68 +111,6 @@ static void uv__chld(uv_signal_t* handle, int signum) {
assert
(
QUEUE_EMPTY
(
&
pending
));
assert
(
QUEUE_EMPTY
(
&
pending
));
}
}
static
int
uv__make_socketpair
(
int
fds
[
2
])
{
#if defined(__FreeBSD__) || defined(__linux__)
if
(
socketpair
(
AF_UNIX
,
SOCK_STREAM
|
SOCK_CLOEXEC
,
0
,
fds
))
return
UV__ERR
(
errno
);
return
0
;
#else
int
err
;
if
(
socketpair
(
AF_UNIX
,
SOCK_STREAM
,
0
,
fds
))
return
UV__ERR
(
errno
);
err
=
uv__cloexec
(
fds
[
0
],
1
);
if
(
err
==
0
)
err
=
uv__cloexec
(
fds
[
1
],
1
);
if
(
err
!=
0
)
{
uv__close
(
fds
[
0
]);
uv__close
(
fds
[
1
]);
return
UV__ERR
(
errno
);
}
return
0
;
#endif
}
int
uv__make_pipe
(
int
fds
[
2
],
int
flags
)
{
#if defined(__FreeBSD__) || defined(__linux__)
if
(
pipe2
(
fds
,
flags
|
O_CLOEXEC
))
return
UV__ERR
(
errno
);
return
0
;
#else
if
(
pipe
(
fds
))
return
UV__ERR
(
errno
);
if
(
uv__cloexec
(
fds
[
0
],
1
))
goto
fail
;
if
(
uv__cloexec
(
fds
[
1
],
1
))
goto
fail
;
if
(
flags
&
UV__F_NONBLOCK
)
{
if
(
uv__nonblock
(
fds
[
0
],
1
))
goto
fail
;
if
(
uv__nonblock
(
fds
[
1
],
1
))
goto
fail
;
}
return
0
;
fail:
uv__close
(
fds
[
0
]);
uv__close
(
fds
[
1
]);
return
UV__ERR
(
errno
);
#endif
}
/*
/*
* Used for initializing stdio streams like options.stdin_stream. Returns
* Used for initializing stdio streams like options.stdin_stream. Returns
* zero on success. See also the cleanup section in uv_spawn().
* zero on success. See also the cleanup section in uv_spawn().
...
@@ -192,7 +130,7 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
...
@@ -192,7 +130,7 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
if
(
container
->
data
.
stream
->
type
!=
UV_NAMED_PIPE
)
if
(
container
->
data
.
stream
->
type
!=
UV_NAMED_PIPE
)
return
UV_EINVAL
;
return
UV_EINVAL
;
else
else
return
uv_
_make_socketpair
(
fds
);
return
uv_
socketpair
(
SOCK_STREAM
,
0
,
fds
,
0
,
0
);
case
UV_INHERIT_FD
:
case
UV_INHERIT_FD
:
case
UV_INHERIT_STREAM
:
case
UV_INHERIT_STREAM
:
...
...
worker/deps/libuv/libuv/src/unix/proctitle.c
浏览文件 @
edde98d7
...
@@ -119,6 +119,7 @@ int uv_set_process_title(const char* title) {
...
@@ -119,6 +119,7 @@ int uv_set_process_title(const char* title) {
memcpy
(
pt
->
str
,
title
,
len
);
memcpy
(
pt
->
str
,
title
,
len
);
memset
(
pt
->
str
+
len
,
'\0'
,
pt
->
cap
-
len
);
memset
(
pt
->
str
+
len
,
'\0'
,
pt
->
cap
-
len
);
pt
->
len
=
len
;
pt
->
len
=
len
;
uv__set_process_title
(
pt
->
str
);
uv_mutex_unlock
(
&
process_title_mutex
);
uv_mutex_unlock
(
&
process_title_mutex
);
...
...
worker/deps/libuv/libuv/src/unix/signal.c
浏览文件 @
edde98d7
...
@@ -265,7 +265,7 @@ static int uv__signal_loop_once_init(uv_loop_t* loop) {
...
@@ -265,7 +265,7 @@ static int uv__signal_loop_once_init(uv_loop_t* loop) {
if
(
loop
->
signal_pipefd
[
0
]
!=
-
1
)
if
(
loop
->
signal_pipefd
[
0
]
!=
-
1
)
return
0
;
return
0
;
err
=
uv__make_pipe
(
loop
->
signal_pipefd
,
UV_
_F_NONBLOCK
);
err
=
uv__make_pipe
(
loop
->
signal_pipefd
,
UV_
NONBLOCK_PIPE
);
if
(
err
)
if
(
err
)
return
err
;
return
err
;
...
...
worker/deps/libuv/libuv/src/unix/stream.c
浏览文件 @
edde98d7
...
@@ -1552,18 +1552,12 @@ int uv_try_write(uv_stream_t* stream,
...
@@ -1552,18 +1552,12 @@ int uv_try_write(uv_stream_t* stream,
}
}
int
uv_read_start
(
uv_stream_t
*
stream
,
int
uv_
_
read_start
(
uv_stream_t
*
stream
,
uv_alloc_cb
alloc_cb
,
uv_alloc_cb
alloc_cb
,
uv_read_cb
read_cb
)
{
uv_read_cb
read_cb
)
{
assert
(
stream
->
type
==
UV_TCP
||
stream
->
type
==
UV_NAMED_PIPE
||
assert
(
stream
->
type
==
UV_TCP
||
stream
->
type
==
UV_NAMED_PIPE
||
stream
->
type
==
UV_TTY
);
stream
->
type
==
UV_TTY
);
if
(
stream
->
flags
&
UV_HANDLE_CLOSING
)
return
UV_EINVAL
;
if
(
!
(
stream
->
flags
&
UV_HANDLE_READABLE
))
return
UV_ENOTCONN
;
/* The UV_HANDLE_READING flag is irrelevant of the state of the tcp - it just
/* The UV_HANDLE_READING flag is irrelevant of the state of the tcp - it just
* expresses the desired state of the user.
* expresses the desired state of the user.
*/
*/
...
...
worker/deps/libuv/libuv/src/unix/tcp.c
浏览文件 @
edde98d7
...
@@ -214,14 +214,15 @@ int uv__tcp_connect(uv_connect_t* req,
...
@@ -214,14 +214,15 @@ int uv__tcp_connect(uv_connect_t* req,
if
(
handle
->
connect_req
!=
NULL
)
if
(
handle
->
connect_req
!=
NULL
)
return
UV_EALREADY
;
/* FIXME(bnoordhuis) UV_EINVAL or maybe UV_EBUSY. */
return
UV_EALREADY
;
/* FIXME(bnoordhuis) UV_EINVAL or maybe UV_EBUSY. */
if
(
handle
->
delayed_error
!=
0
)
goto
out
;
err
=
maybe_new_socket
(
handle
,
err
=
maybe_new_socket
(
handle
,
addr
->
sa_family
,
addr
->
sa_family
,
UV_HANDLE_READABLE
|
UV_HANDLE_WRITABLE
);
UV_HANDLE_READABLE
|
UV_HANDLE_WRITABLE
);
if
(
err
)
if
(
err
)
return
err
;
return
err
;
handle
->
delayed_error
=
0
;
do
{
do
{
errno
=
0
;
errno
=
0
;
r
=
connect
(
uv__stream_fd
(
handle
),
addr
,
addrlen
);
r
=
connect
(
uv__stream_fd
(
handle
),
addr
,
addrlen
);
...
@@ -249,6 +250,8 @@ int uv__tcp_connect(uv_connect_t* req,
...
@@ -249,6 +250,8 @@ int uv__tcp_connect(uv_connect_t* req,
return
UV__ERR
(
errno
);
return
UV__ERR
(
errno
);
}
}
out:
uv__req_init
(
handle
->
loop
,
req
,
UV_CONNECT
);
uv__req_init
(
handle
->
loop
,
req
,
UV_CONNECT
);
req
->
cb
=
cb
;
req
->
cb
=
cb
;
req
->
handle
=
(
uv_stream_t
*
)
handle
;
req
->
handle
=
(
uv_stream_t
*
)
handle
;
...
@@ -459,3 +462,49 @@ int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) {
...
@@ -459,3 +462,49 @@ int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) {
void
uv__tcp_close
(
uv_tcp_t
*
handle
)
{
void
uv__tcp_close
(
uv_tcp_t
*
handle
)
{
uv__stream_close
((
uv_stream_t
*
)
handle
);
uv__stream_close
((
uv_stream_t
*
)
handle
);
}
}
int
uv_socketpair
(
int
type
,
int
protocol
,
uv_os_sock_t
fds
[
2
],
int
flags0
,
int
flags1
)
{
uv_os_sock_t
temp
[
2
];
int
err
;
#if defined(__FreeBSD__) || defined(__linux__)
int
flags
;
flags
=
type
|
SOCK_CLOEXEC
;
if
((
flags0
&
UV_NONBLOCK_PIPE
)
&&
(
flags1
&
UV_NONBLOCK_PIPE
))
flags
|=
SOCK_NONBLOCK
;
if
(
socketpair
(
AF_UNIX
,
flags
,
protocol
,
temp
))
return
UV__ERR
(
errno
);
if
(
flags
&
UV_FS_O_NONBLOCK
)
{
fds
[
0
]
=
temp
[
0
];
fds
[
1
]
=
temp
[
1
];
return
0
;
}
#else
if
(
socketpair
(
AF_UNIX
,
type
,
protocol
,
temp
))
return
UV__ERR
(
errno
);
if
((
err
=
uv__cloexec
(
temp
[
0
],
1
)))
goto
fail
;
if
((
err
=
uv__cloexec
(
temp
[
1
],
1
)))
goto
fail
;
#endif
if
(
flags0
&
UV_NONBLOCK_PIPE
)
if
((
err
=
uv__nonblock
(
temp
[
0
],
1
)))
goto
fail
;
if
(
flags1
&
UV_NONBLOCK_PIPE
)
if
((
err
=
uv__nonblock
(
temp
[
1
],
1
)))
goto
fail
;
fds
[
0
]
=
temp
[
0
];
fds
[
1
]
=
temp
[
1
];
return
0
;
fail:
uv__close
(
temp
[
0
]);
uv__close
(
temp
[
1
]);
return
err
;
}
worker/deps/libuv/libuv/src/uv-common.c
浏览文件 @
edde98d7
...
@@ -832,6 +832,25 @@ void uv_loop_delete(uv_loop_t* loop) {
...
@@ -832,6 +832,25 @@ void uv_loop_delete(uv_loop_t* loop) {
}
}
int
uv_read_start
(
uv_stream_t
*
stream
,
uv_alloc_cb
alloc_cb
,
uv_read_cb
read_cb
)
{
if
(
stream
==
NULL
||
alloc_cb
==
NULL
||
read_cb
==
NULL
)
return
UV_EINVAL
;
if
(
stream
->
flags
&
UV_HANDLE_CLOSING
)
return
UV_EINVAL
;
if
(
stream
->
flags
&
UV_HANDLE_READING
)
return
UV_EALREADY
;
if
(
!
(
stream
->
flags
&
UV_HANDLE_READABLE
))
return
UV_ENOTCONN
;
return
uv__read_start
(
stream
,
alloc_cb
,
read_cb
);
}
void
uv_os_free_environ
(
uv_env_item_t
*
envitems
,
int
count
)
{
void
uv_os_free_environ
(
uv_env_item_t
*
envitems
,
int
count
)
{
int
i
;
int
i
;
...
...
worker/deps/libuv/libuv/src/uv-common.h
浏览文件 @
edde98d7
...
@@ -136,6 +136,10 @@ int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap);
...
@@ -136,6 +136,10 @@ int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap);
void
uv__loop_close
(
uv_loop_t
*
loop
);
void
uv__loop_close
(
uv_loop_t
*
loop
);
int
uv__read_start
(
uv_stream_t
*
stream
,
uv_alloc_cb
alloc_cb
,
uv_read_cb
read_cb
);
int
uv__tcp_bind
(
uv_tcp_t
*
tcp
,
int
uv__tcp_bind
(
uv_tcp_t
*
tcp
,
const
struct
sockaddr
*
addr
,
const
struct
sockaddr
*
addr
,
unsigned
int
addrlen
,
unsigned
int
addrlen
,
...
...
worker/deps/libuv/libuv/src/win/fs.c
浏览文件 @
edde98d7
...
@@ -92,30 +92,24 @@
...
@@ -92,30 +92,24 @@
return; \
return; \
}
}
#define MILLION
u (1000U * 1000U
)
#define MILLION
((int64_t) 1000 * 1000
)
#define BILLION
u (1000U * 1000U * 1000U
)
#define BILLION
((int64_t) 1000 * 1000 * 1000
)
#define FILETIME_TO_UINT(filetime) \
static
void
uv__filetime_to_timespec
(
uv_timespec_t
*
ts
,
int64_t
filetime
)
{
(*((uint64_t*) &(filetime)) - (uint64_t) 116444736 * BILLIONu)
filetime
-=
116444736
*
BILLION
;
ts
->
tv_sec
=
(
long
)
(
filetime
/
(
10
*
MILLION
));
#define FILETIME_TO_TIME_T(filetime) \
ts
->
tv_nsec
=
(
long
)
((
filetime
-
ts
->
tv_sec
*
10
*
MILLION
)
*
100U
);
(FILETIME_TO_UINT(filetime) / (10u * MILLIONu))
if
(
ts
->
tv_nsec
<
0
)
{
ts
->
tv_sec
-=
1
;
#define FILETIME_TO_TIME_NS(filetime, secs) \
ts
->
tv_nsec
+=
1e9
;
((FILETIME_TO_UINT(filetime) - (secs * (uint64_t) 10 * MILLIONu)) * 100U)
}
}
#define FILETIME_TO_TIMESPEC(ts, filetime) \
do { \
(ts).tv_sec = (long) FILETIME_TO_TIME_T(filetime); \
(ts).tv_nsec = (long) FILETIME_TO_TIME_NS(filetime, (ts).tv_sec); \
} while(0)
#define TIME_T_TO_FILETIME(time, filetime_ptr) \
#define TIME_T_TO_FILETIME(time, filetime_ptr) \
do { \
do { \
uint64_t bigtime = ((uint64_t) ((time) * (uint64_t) 10 * MILLIONu)) + \
int64_t bigtime = ((time) * 10 * MILLION + 116444736 * BILLION); \
(uint64_t) 116444736 * BILLIONu; \
(filetime_ptr)->dwLowDateTime = (uint64_t) bigtime & 0xFFFFFFFF; \
(filetime_ptr)->dwLowDateTime = bigtime & 0xFFFFFFFF; \
(filetime_ptr)->dwHighDateTime = (uint64_t) bigtime >> 32; \
(filetime_ptr)->dwHighDateTime = bigtime >> 32; \
} while(0)
} while(0)
#define IS_SLASH(c) ((c) == L'\\' || (c) == L'/')
#define IS_SLASH(c) ((c) == L'\\' || (c) == L'/')
...
@@ -1224,7 +1218,8 @@ void fs__mkdir(uv_fs_t* req) {
...
@@ -1224,7 +1218,8 @@ void fs__mkdir(uv_fs_t* req) {
SET_REQ_RESULT
(
req
,
0
);
SET_REQ_RESULT
(
req
,
0
);
}
else
{
}
else
{
SET_REQ_WIN32_ERROR
(
req
,
GetLastError
());
SET_REQ_WIN32_ERROR
(
req
,
GetLastError
());
if
(
req
->
sys_errno_
==
ERROR_INVALID_NAME
)
if
(
req
->
sys_errno_
==
ERROR_INVALID_NAME
||
req
->
sys_errno_
==
ERROR_DIRECTORY
)
req
->
result
=
UV_EINVAL
;
req
->
result
=
UV_EINVAL
;
}
}
}
}
...
@@ -1791,10 +1786,14 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
...
@@ -1791,10 +1786,14 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
statbuf
->
st_mode
|=
(
_S_IREAD
|
_S_IWRITE
)
|
((
_S_IREAD
|
_S_IWRITE
)
>>
3
)
|
statbuf
->
st_mode
|=
(
_S_IREAD
|
_S_IWRITE
)
|
((
_S_IREAD
|
_S_IWRITE
)
>>
3
)
|
((
_S_IREAD
|
_S_IWRITE
)
>>
6
);
((
_S_IREAD
|
_S_IWRITE
)
>>
6
);
FILETIME_TO_TIMESPEC
(
statbuf
->
st_atim
,
file_info
.
BasicInformation
.
LastAccessTime
);
uv__filetime_to_timespec
(
&
statbuf
->
st_atim
,
FILETIME_TO_TIMESPEC
(
statbuf
->
st_ctim
,
file_info
.
BasicInformation
.
ChangeTime
);
file_info
.
BasicInformation
.
LastAccessTime
.
QuadPart
);
FILETIME_TO_TIMESPEC
(
statbuf
->
st_mtim
,
file_info
.
BasicInformation
.
LastWriteTime
);
uv__filetime_to_timespec
(
&
statbuf
->
st_ctim
,
FILETIME_TO_TIMESPEC
(
statbuf
->
st_birthtim
,
file_info
.
BasicInformation
.
CreationTime
);
file_info
.
BasicInformation
.
ChangeTime
.
QuadPart
);
uv__filetime_to_timespec
(
&
statbuf
->
st_mtim
,
file_info
.
BasicInformation
.
LastWriteTime
.
QuadPart
);
uv__filetime_to_timespec
(
&
statbuf
->
st_birthtim
,
file_info
.
BasicInformation
.
CreationTime
.
QuadPart
);
statbuf
->
st_ino
=
file_info
.
InternalInformation
.
IndexNumber
.
QuadPart
;
statbuf
->
st_ino
=
file_info
.
InternalInformation
.
IndexNumber
.
QuadPart
;
...
...
worker/deps/libuv/libuv/src/win/internal.h
浏览文件 @
edde98d7
...
@@ -115,8 +115,8 @@ void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle);
...
@@ -115,8 +115,8 @@ void uv_udp_endgame(uv_loop_t* loop, uv_udp_t* handle);
/*
/*
* Pipes
* Pipes
*/
*/
int
uv_
stdio_pipe_server
(
uv_loop_t
*
loop
,
uv_pipe_t
*
handle
,
DWORD
access
,
int
uv_
_create_stdio_pipe_pair
(
uv_loop_t
*
loop
,
char
*
name
,
size_t
nameSize
);
uv_pipe_t
*
parent_pipe
,
HANDLE
*
child_pipe_ptr
,
unsigned
int
flags
);
int
uv_pipe_listen
(
uv_pipe_t
*
handle
,
int
backlog
,
uv_connection_cb
cb
);
int
uv_pipe_listen
(
uv_pipe_t
*
handle
,
int
backlog
,
uv_connection_cb
cb
);
int
uv_pipe_accept
(
uv_pipe_t
*
server
,
uv_stream_t
*
client
);
int
uv_pipe_accept
(
uv_pipe_t
*
server
,
uv_stream_t
*
client
);
...
...
worker/deps/libuv/libuv/src/win/pipe.c
浏览文件 @
edde98d7
...
@@ -202,17 +202,17 @@ static void close_pipe(uv_pipe_t* pipe) {
...
@@ -202,17 +202,17 @@ static void close_pipe(uv_pipe_t* pipe) {
}
}
int
uv_stdio_pipe_server
(
uv_loop_t
*
loop
,
uv_pipe_t
*
handle
,
DWORD
access
,
static
int
uv__pipe_server
(
char
*
name
,
size_t
nameSize
)
{
HANDLE
*
pipeHandle_ptr
,
DWORD
access
,
char
*
name
,
size_t
nameSize
,
char
*
random
)
{
HANDLE
pipeHandle
;
HANDLE
pipeHandle
;
int
err
;
int
err
;
char
*
ptr
=
(
char
*
)
handle
;
for
(;;)
{
for
(;;)
{
uv_unique_pipe_name
(
ptr
,
name
,
nameSize
);
uv_unique_pipe_name
(
random
,
name
,
nameSize
);
pipeHandle
=
CreateNamedPipeA
(
name
,
pipeHandle
=
CreateNamedPipeA
(
name
,
access
|
FILE_FLAG_
OVERLAPPED
|
FILE_FLAG_FIRST_PIPE_INSTANCE
|
WRITE_DAC
,
access
|
FILE_FLAG_
FIRST_PIPE_INSTANCE
,
PIPE_TYPE_BYTE
|
PIPE_READMODE_BYTE
|
PIPE_WAIT
,
1
,
65536
,
65536
,
0
,
PIPE_TYPE_BYTE
|
PIPE_READMODE_BYTE
|
PIPE_WAIT
,
1
,
65536
,
65536
,
0
,
NULL
);
NULL
);
...
@@ -226,26 +226,225 @@ int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access,
...
@@ -226,26 +226,225 @@ int uv_stdio_pipe_server(uv_loop_t* loop, uv_pipe_t* handle, DWORD access,
goto
error
;
goto
error
;
}
}
/* Pipe name collision. Increment the
point
er and try again. */
/* Pipe name collision. Increment the
random numb
er and try again. */
ptr
++
;
random
++
;
}
}
if
(
CreateIoCompletionPort
(
pipeHandle
,
*
pipeHandle_ptr
=
pipeHandle
;
return
0
;
error:
if
(
pipeHandle
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
pipeHandle
);
return
err
;
}
static
int
uv__create_pipe_pair
(
HANDLE
*
server_pipe_ptr
,
HANDLE
*
client_pipe_ptr
,
unsigned
int
server_flags
,
unsigned
int
client_flags
,
int
inherit_client
,
char
*
random
)
{
/* allowed flags are: UV_READABLE_PIPE | UV_WRITABLE_PIPE | UV_NONBLOCK_PIPE */
char
pipe_name
[
64
];
SECURITY_ATTRIBUTES
sa
;
DWORD
server_access
;
DWORD
client_access
;
HANDLE
server_pipe
;
HANDLE
client_pipe
;
int
err
;
server_pipe
=
INVALID_HANDLE_VALUE
;
client_pipe
=
INVALID_HANDLE_VALUE
;
server_access
=
0
;
if
(
server_flags
&
UV_READABLE_PIPE
)
server_access
|=
PIPE_ACCESS_INBOUND
;
if
(
server_flags
&
UV_WRITABLE_PIPE
)
server_access
|=
PIPE_ACCESS_OUTBOUND
;
if
(
server_flags
&
UV_NONBLOCK_PIPE
)
server_access
|=
FILE_FLAG_OVERLAPPED
;
server_access
|=
WRITE_DAC
;
client_access
=
0
;
if
(
client_flags
&
UV_READABLE_PIPE
)
client_access
|=
GENERIC_READ
;
else
client_access
|=
FILE_READ_ATTRIBUTES
;
if
(
client_flags
&
UV_WRITABLE_PIPE
)
client_access
|=
GENERIC_WRITE
;
else
client_access
|=
FILE_WRITE_ATTRIBUTES
;
client_access
|=
WRITE_DAC
;
/* Create server pipe handle. */
err
=
uv__pipe_server
(
&
server_pipe
,
server_access
,
pipe_name
,
sizeof
(
pipe_name
),
random
);
if
(
err
)
goto
error
;
/* Create client pipe handle. */
sa
.
nLength
=
sizeof
sa
;
sa
.
lpSecurityDescriptor
=
NULL
;
sa
.
bInheritHandle
=
inherit_client
;
client_pipe
=
CreateFileA
(
pipe_name
,
client_access
,
0
,
&
sa
,
OPEN_EXISTING
,
(
client_flags
&
UV_NONBLOCK_PIPE
)
?
FILE_FLAG_OVERLAPPED
:
0
,
NULL
);
if
(
client_pipe
==
INVALID_HANDLE_VALUE
)
{
err
=
GetLastError
();
goto
error
;
}
#ifndef NDEBUG
/* Validate that the pipe was opened in the right mode. */
{
DWORD
mode
;
BOOL
r
;
r
=
GetNamedPipeHandleState
(
client_pipe
,
&
mode
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
if
(
r
==
TRUE
)
{
assert
(
mode
==
(
PIPE_READMODE_BYTE
|
PIPE_WAIT
));
}
else
{
fprintf
(
stderr
,
"libuv assertion failure: GetNamedPipeHandleState failed
\n
"
);
}
}
#endif
/* Do a blocking ConnectNamedPipe. This should not block because we have
* both ends of the pipe created. */
if
(
!
ConnectNamedPipe
(
server_pipe
,
NULL
))
{
if
(
GetLastError
()
!=
ERROR_PIPE_CONNECTED
)
{
err
=
GetLastError
();
goto
error
;
}
}
*
client_pipe_ptr
=
client_pipe
;
*
server_pipe_ptr
=
server_pipe
;
return
0
;
error:
if
(
server_pipe
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
server_pipe
);
if
(
client_pipe
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
client_pipe
);
return
err
;
}
int
uv_pipe
(
uv_file
fds
[
2
],
int
read_flags
,
int
write_flags
)
{
uv_file
temp
[
2
];
int
err
;
HANDLE
readh
;
HANDLE
writeh
;
/* Make the server side the inbound (read) end, */
/* so that both ends will have FILE_READ_ATTRIBUTES permission. */
/* TODO: better source of local randomness than &fds? */
read_flags
|=
UV_READABLE_PIPE
;
write_flags
|=
UV_WRITABLE_PIPE
;
err
=
uv__create_pipe_pair
(
&
readh
,
&
writeh
,
read_flags
,
write_flags
,
0
,
(
char
*
)
&
fds
[
0
]);
if
(
err
!=
0
)
return
err
;
temp
[
0
]
=
_open_osfhandle
((
intptr_t
)
readh
,
0
);
if
(
temp
[
0
]
==
-
1
)
{
if
(
errno
==
UV_EMFILE
)
err
=
UV_EMFILE
;
else
err
=
UV_UNKNOWN
;
CloseHandle
(
readh
);
CloseHandle
(
writeh
);
return
err
;
}
temp
[
1
]
=
_open_osfhandle
((
intptr_t
)
writeh
,
0
);
if
(
temp
[
1
]
==
-
1
)
{
if
(
errno
==
UV_EMFILE
)
err
=
UV_EMFILE
;
else
err
=
UV_UNKNOWN
;
_close
(
temp
[
0
]);
CloseHandle
(
writeh
);
return
err
;
}
fds
[
0
]
=
temp
[
0
];
fds
[
1
]
=
temp
[
1
];
return
0
;
}
int
uv__create_stdio_pipe_pair
(
uv_loop_t
*
loop
,
uv_pipe_t
*
parent_pipe
,
HANDLE
*
child_pipe_ptr
,
unsigned
int
flags
)
{
/* The parent_pipe is always the server_pipe and kept by libuv.
* The child_pipe is always the client_pipe and is passed to the child.
* The flags are specified with respect to their usage in the child. */
HANDLE
server_pipe
;
HANDLE
client_pipe
;
unsigned
int
server_flags
;
unsigned
int
client_flags
;
int
err
;
server_pipe
=
INVALID_HANDLE_VALUE
;
client_pipe
=
INVALID_HANDLE_VALUE
;
server_flags
=
0
;
client_flags
=
0
;
if
(
flags
&
UV_READABLE_PIPE
)
{
/* The server needs inbound (read) access too, otherwise CreateNamedPipe()
* won't give us the FILE_READ_ATTRIBUTES permission. We need that to probe
* the state of the write buffer when we're trying to shutdown the pipe. */
server_flags
|=
UV_READABLE_PIPE
|
UV_WRITABLE_PIPE
;
client_flags
|=
UV_READABLE_PIPE
;
}
if
(
flags
&
UV_WRITABLE_PIPE
)
{
server_flags
|=
UV_READABLE_PIPE
;
client_flags
|=
UV_WRITABLE_PIPE
;
}
server_flags
|=
UV_NONBLOCK_PIPE
;
if
(
flags
&
UV_NONBLOCK_PIPE
||
parent_pipe
->
ipc
)
{
client_flags
|=
UV_NONBLOCK_PIPE
;
}
err
=
uv__create_pipe_pair
(
&
server_pipe
,
&
client_pipe
,
server_flags
,
client_flags
,
1
,
(
char
*
)
server_pipe
);
if
(
err
)
goto
error
;
if
(
CreateIoCompletionPort
(
server_pipe
,
loop
->
iocp
,
loop
->
iocp
,
(
ULONG_PTR
)
handl
e
,
(
ULONG_PTR
)
parent_pip
e
,
0
)
==
NULL
)
{
0
)
==
NULL
)
{
err
=
GetLastError
();
err
=
GetLastError
();
goto
error
;
goto
error
;
}
}
uv_pipe_connection_init
(
handle
);
uv_pipe_connection_init
(
parent_pipe
);
handle
->
handle
=
pipeHandle
;
parent_pipe
->
handle
=
server_pipe
;
*
child_pipe_ptr
=
client_pipe
;
/* The server end is now readable and/or writable. */
if
(
flags
&
UV_READABLE_PIPE
)
parent_pipe
->
flags
|=
UV_HANDLE_WRITABLE
;
if
(
flags
&
UV_WRITABLE_PIPE
)
parent_pipe
->
flags
|=
UV_HANDLE_READABLE
;
return
0
;
return
0
;
error:
error:
if
(
pipeHandle
!=
INVALID_HANDLE_VALUE
)
if
(
server_pipe
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
pipeHandle
);
CloseHandle
(
server_pipe
);
if
(
client_pipe
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
client_pipe
);
return
err
;
return
err
;
}
}
...
@@ -712,9 +911,8 @@ error:
...
@@ -712,9 +911,8 @@ error:
handle
->
name
=
NULL
;
handle
->
name
=
NULL
;
}
}
if
(
pipeHandle
!=
INVALID_HANDLE_VALUE
)
{
if
(
pipeHandle
!=
INVALID_HANDLE_VALUE
)
CloseHandle
(
pipeHandle
);
CloseHandle
(
pipeHandle
);
}
/* Make this req pending reporting an error. */
/* Make this req pending reporting an error. */
SET_REQ_ERROR
(
req
,
err
);
SET_REQ_ERROR
(
req
,
err
);
...
...
worker/deps/libuv/libuv/src/win/process-stdio.c
浏览文件 @
edde98d7
...
@@ -95,102 +95,6 @@ void uv_disable_stdio_inheritance(void) {
...
@@ -95,102 +95,6 @@ void uv_disable_stdio_inheritance(void) {
}
}
static
int
uv__create_stdio_pipe_pair
(
uv_loop_t
*
loop
,
uv_pipe_t
*
server_pipe
,
HANDLE
*
child_pipe_ptr
,
unsigned
int
flags
)
{
char
pipe_name
[
64
];
SECURITY_ATTRIBUTES
sa
;
DWORD
server_access
=
0
;
DWORD
client_access
=
0
;
HANDLE
child_pipe
=
INVALID_HANDLE_VALUE
;
int
err
;
int
overlap
;
if
(
flags
&
UV_READABLE_PIPE
)
{
/* The server needs inbound access too, otherwise CreateNamedPipe() won't
* give us the FILE_READ_ATTRIBUTES permission. We need that to probe the
* state of the write buffer when we're trying to shutdown the pipe. */
server_access
|=
PIPE_ACCESS_OUTBOUND
|
PIPE_ACCESS_INBOUND
;
client_access
|=
GENERIC_READ
|
FILE_WRITE_ATTRIBUTES
;
}
if
(
flags
&
UV_WRITABLE_PIPE
)
{
server_access
|=
PIPE_ACCESS_INBOUND
;
client_access
|=
GENERIC_WRITE
|
FILE_READ_ATTRIBUTES
;
}
/* Create server pipe handle. */
err
=
uv_stdio_pipe_server
(
loop
,
server_pipe
,
server_access
,
pipe_name
,
sizeof
(
pipe_name
));
if
(
err
)
goto
error
;
/* Create child pipe handle. */
sa
.
nLength
=
sizeof
sa
;
sa
.
lpSecurityDescriptor
=
NULL
;
sa
.
bInheritHandle
=
TRUE
;
overlap
=
server_pipe
->
ipc
||
(
flags
&
UV_OVERLAPPED_PIPE
);
child_pipe
=
CreateFileA
(
pipe_name
,
client_access
,
0
,
&
sa
,
OPEN_EXISTING
,
overlap
?
FILE_FLAG_OVERLAPPED
:
0
,
NULL
);
if
(
child_pipe
==
INVALID_HANDLE_VALUE
)
{
err
=
GetLastError
();
goto
error
;
}
#ifndef NDEBUG
/* Validate that the pipe was opened in the right mode. */
{
DWORD
mode
;
BOOL
r
=
GetNamedPipeHandleState
(
child_pipe
,
&
mode
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
assert
(
r
==
TRUE
);
assert
(
mode
==
(
PIPE_READMODE_BYTE
|
PIPE_WAIT
));
}
#endif
/* Do a blocking ConnectNamedPipe. This should not block because we have both
* ends of the pipe created. */
if
(
!
ConnectNamedPipe
(
server_pipe
->
handle
,
NULL
))
{
if
(
GetLastError
()
!=
ERROR_PIPE_CONNECTED
)
{
err
=
GetLastError
();
goto
error
;
}
}
/* The server end is now readable and/or writable. */
if
(
flags
&
UV_READABLE_PIPE
)
server_pipe
->
flags
|=
UV_HANDLE_WRITABLE
;
if
(
flags
&
UV_WRITABLE_PIPE
)
server_pipe
->
flags
|=
UV_HANDLE_READABLE
;
*
child_pipe_ptr
=
child_pipe
;
return
0
;
error:
if
(
server_pipe
->
handle
!=
INVALID_HANDLE_VALUE
)
{
uv_pipe_cleanup
(
loop
,
server_pipe
);
}
if
(
child_pipe
!=
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
child_pipe
);
}
return
err
;
}
static
int
uv__duplicate_handle
(
uv_loop_t
*
loop
,
HANDLE
handle
,
HANDLE
*
dup
)
{
static
int
uv__duplicate_handle
(
uv_loop_t
*
loop
,
HANDLE
handle
,
HANDLE
*
dup
)
{
HANDLE
current_process
;
HANDLE
current_process
;
...
...
worker/deps/libuv/libuv/src/win/stream.c
浏览文件 @
edde98d7
...
@@ -65,18 +65,11 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
...
@@ -65,18 +65,11 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
}
}
int
uv_read_start
(
uv_stream_t
*
handle
,
uv_alloc_cb
alloc_cb
,
int
uv__read_start
(
uv_stream_t
*
handle
,
uv_read_cb
read_cb
)
{
uv_alloc_cb
alloc_cb
,
uv_read_cb
read_cb
)
{
int
err
;
int
err
;
if
(
handle
->
flags
&
UV_HANDLE_READING
)
{
return
UV_EALREADY
;
}
if
(
!
(
handle
->
flags
&
UV_HANDLE_READABLE
))
{
return
UV_ENOTCONN
;
}
err
=
ERROR_INVALID_PARAMETER
;
err
=
ERROR_INVALID_PARAMETER
;
switch
(
handle
->
type
)
{
switch
(
handle
->
type
)
{
case
UV_TCP
:
case
UV_TCP
:
...
...
worker/deps/libuv/libuv/src/win/tcp.c
浏览文件 @
edde98d7
...
@@ -800,9 +800,8 @@ static int uv_tcp_try_connect(uv_connect_t* req,
...
@@ -800,9 +800,8 @@ static int uv_tcp_try_connect(uv_connect_t* req,
if
(
err
)
if
(
err
)
return
err
;
return
err
;
if
(
handle
->
delayed_error
)
{
if
(
handle
->
delayed_error
!=
0
)
return
handle
->
delayed_error
;
goto
out
;
}
if
(
!
(
handle
->
flags
&
UV_HANDLE_BOUND
))
{
if
(
!
(
handle
->
flags
&
UV_HANDLE_BOUND
))
{
if
(
addrlen
==
sizeof
(
uv_addr_ip4_any_
))
{
if
(
addrlen
==
sizeof
(
uv_addr_ip4_any_
))
{
...
@@ -815,8 +814,8 @@ static int uv_tcp_try_connect(uv_connect_t* req,
...
@@ -815,8 +814,8 @@ static int uv_tcp_try_connect(uv_connect_t* req,
err
=
uv_tcp_try_bind
(
handle
,
bind_addr
,
addrlen
,
0
);
err
=
uv_tcp_try_bind
(
handle
,
bind_addr
,
addrlen
,
0
);
if
(
err
)
if
(
err
)
return
err
;
return
err
;
if
(
handle
->
delayed_error
)
if
(
handle
->
delayed_error
!=
0
)
return
handle
->
delayed_error
;
goto
out
;
}
}
if
(
!
handle
->
tcp
.
conn
.
func_connectex
)
{
if
(
!
handle
->
tcp
.
conn
.
func_connectex
)
{
...
@@ -844,11 +843,21 @@ static int uv_tcp_try_connect(uv_connect_t* req,
...
@@ -844,11 +843,21 @@ static int uv_tcp_try_connect(uv_connect_t* req,
NULL
);
NULL
);
}
}
out:
UV_REQ_INIT
(
req
,
UV_CONNECT
);
UV_REQ_INIT
(
req
,
UV_CONNECT
);
req
->
handle
=
(
uv_stream_t
*
)
handle
;
req
->
handle
=
(
uv_stream_t
*
)
handle
;
req
->
cb
=
cb
;
req
->
cb
=
cb
;
memset
(
&
req
->
u
.
io
.
overlapped
,
0
,
sizeof
(
req
->
u
.
io
.
overlapped
));
memset
(
&
req
->
u
.
io
.
overlapped
,
0
,
sizeof
(
req
->
u
.
io
.
overlapped
));
if
(
handle
->
delayed_error
!=
0
)
{
/* Process the req without IOCP. */
handle
->
reqs_pending
++
;
REGISTER_HANDLE_REQ
(
loop
,
handle
,
req
);
uv_insert_pending_req
(
loop
,
(
uv_req_t
*
)
req
);
return
0
;
}
success
=
handle
->
tcp
.
conn
.
func_connectex
(
handle
->
socket
,
success
=
handle
->
tcp
.
conn
.
func_connectex
(
handle
->
socket
,
(
const
struct
sockaddr
*
)
&
converted
,
(
const
struct
sockaddr
*
)
&
converted
,
addrlen
,
addrlen
,
...
@@ -1215,7 +1224,14 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle,
...
@@ -1215,7 +1224,14 @@ void uv_process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle,
UNREGISTER_HANDLE_REQ
(
loop
,
handle
,
req
);
UNREGISTER_HANDLE_REQ
(
loop
,
handle
,
req
);
err
=
0
;
err
=
0
;
if
(
REQ_SUCCESS
(
req
))
{
if
(
handle
->
delayed_error
)
{
/* To smooth over the differences between unixes errors that
* were reported synchronously on the first connect can be delayed
* until the next tick--which is now.
*/
err
=
handle
->
delayed_error
;
handle
->
delayed_error
=
0
;
}
else
if
(
REQ_SUCCESS
(
req
))
{
if
(
handle
->
flags
&
UV_HANDLE_CLOSING
)
{
if
(
handle
->
flags
&
UV_HANDLE_CLOSING
)
{
/* use UV_ECANCELED for consistency with Unix */
/* use UV_ECANCELED for consistency with Unix */
err
=
ERROR_OPERATION_ABORTED
;
err
=
ERROR_OPERATION_ABORTED
;
...
@@ -1571,3 +1587,118 @@ int uv__tcp_connect(uv_connect_t* req,
...
@@ -1571,3 +1587,118 @@ int uv__tcp_connect(uv_connect_t* req,
return
0
;
return
0
;
}
}
#ifndef WSA_FLAG_NO_HANDLE_INHERIT
/* Added in Windows 7 SP1. Specify this to avoid race conditions, */
/* but also manually clear the inherit flag in case this failed. */
#define WSA_FLAG_NO_HANDLE_INHERIT 0x80
#endif
int
uv_socketpair
(
int
type
,
int
protocol
,
uv_os_sock_t
fds
[
2
],
int
flags0
,
int
flags1
)
{
SOCKET
server
=
INVALID_SOCKET
;
SOCKET
client0
=
INVALID_SOCKET
;
SOCKET
client1
=
INVALID_SOCKET
;
SOCKADDR_IN
name
;
LPFN_ACCEPTEX
func_acceptex
;
WSAOVERLAPPED
overlap
;
char
accept_buffer
[
sizeof
(
struct
sockaddr_storage
)
*
2
+
32
];
int
namelen
;
int
err
;
DWORD
bytes
;
DWORD
flags
;
DWORD
client0_flags
=
WSA_FLAG_NO_HANDLE_INHERIT
;
DWORD
client1_flags
=
WSA_FLAG_NO_HANDLE_INHERIT
;
if
(
flags0
&
UV_NONBLOCK_PIPE
)
client0_flags
|=
WSA_FLAG_OVERLAPPED
;
if
(
flags1
&
UV_NONBLOCK_PIPE
)
client1_flags
|=
WSA_FLAG_OVERLAPPED
;
server
=
WSASocketW
(
AF_INET
,
type
,
protocol
,
NULL
,
0
,
WSA_FLAG_OVERLAPPED
|
WSA_FLAG_NO_HANDLE_INHERIT
);
if
(
server
==
INVALID_SOCKET
)
goto
wsaerror
;
if
(
!
SetHandleInformation
((
HANDLE
)
server
,
HANDLE_FLAG_INHERIT
,
0
))
goto
error
;
name
.
sin_family
=
AF_INET
;
name
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
name
.
sin_port
=
0
;
if
(
bind
(
server
,
(
SOCKADDR
*
)
&
name
,
sizeof
(
name
))
!=
0
)
goto
wsaerror
;
if
(
listen
(
server
,
1
)
!=
0
)
goto
wsaerror
;
namelen
=
sizeof
(
name
);
if
(
getsockname
(
server
,
(
SOCKADDR
*
)
&
name
,
&
namelen
)
!=
0
)
goto
wsaerror
;
client0
=
WSASocketW
(
AF_INET
,
type
,
protocol
,
NULL
,
0
,
client0_flags
);
if
(
client0
==
INVALID_SOCKET
)
goto
wsaerror
;
if
(
!
SetHandleInformation
((
HANDLE
)
client0
,
HANDLE_FLAG_INHERIT
,
0
))
goto
error
;
if
(
connect
(
client0
,
(
SOCKADDR
*
)
&
name
,
sizeof
(
name
))
!=
0
)
goto
wsaerror
;
client1
=
WSASocketW
(
AF_INET
,
type
,
protocol
,
NULL
,
0
,
client1_flags
);
if
(
client1
==
INVALID_SOCKET
)
goto
wsaerror
;
if
(
!
SetHandleInformation
((
HANDLE
)
client1
,
HANDLE_FLAG_INHERIT
,
0
))
goto
error
;
if
(
!
uv_get_acceptex_function
(
server
,
&
func_acceptex
))
{
err
=
WSAEAFNOSUPPORT
;
goto
cleanup
;
}
memset
(
&
overlap
,
0
,
sizeof
(
overlap
));
if
(
!
func_acceptex
(
server
,
client1
,
accept_buffer
,
0
,
sizeof
(
struct
sockaddr_storage
),
sizeof
(
struct
sockaddr_storage
),
&
bytes
,
&
overlap
))
{
err
=
WSAGetLastError
();
if
(
err
==
ERROR_IO_PENDING
)
{
/* Result should complete immediately, since we already called connect,
* but emperically, we sometimes have to poll the kernel a couple times
* until it notices that. */
while
(
!
WSAGetOverlappedResult
(
client1
,
&
overlap
,
&
bytes
,
FALSE
,
&
flags
))
{
err
=
WSAGetLastError
();
if
(
err
!=
WSA_IO_INCOMPLETE
)
goto
cleanup
;
SwitchToThread
();
}
}
else
{
goto
cleanup
;
}
}
if
(
setsockopt
(
client1
,
SOL_SOCKET
,
SO_UPDATE_ACCEPT_CONTEXT
,
(
char
*
)
&
server
,
sizeof
(
server
))
!=
0
)
{
goto
wsaerror
;
}
closesocket
(
server
);
fds
[
0
]
=
client0
;
fds
[
1
]
=
client1
;
return
0
;
wsaerror:
err
=
WSAGetLastError
();
goto
cleanup
;
error:
err
=
GetLastError
();
goto
cleanup
;
cleanup:
if
(
server
!=
INVALID_SOCKET
)
closesocket
(
server
);
if
(
client0
!=
INVALID_SOCKET
)
closesocket
(
client0
);
if
(
client1
!=
INVALID_SOCKET
)
closesocket
(
client1
);
assert
(
err
);
return
uv_translate_sys_error
(
err
);
}
worker/deps/libuv/libuv/test/benchmark-pump.c
浏览文件 @
edde98d7
...
@@ -390,6 +390,7 @@ HELPER_IMPL(tcp_pump_server) {
...
@@ -390,6 +390,7 @@ HELPER_IMPL(tcp_pump_server) {
r
=
uv_listen
((
uv_stream_t
*
)
&
tcpServer
,
MAX_WRITE_HANDLES
,
connection_cb
);
r
=
uv_listen
((
uv_stream_t
*
)
&
tcpServer
,
MAX_WRITE_HANDLES
,
connection_cb
);
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
notify_parent_process
();
uv_run
(
loop
,
UV_RUN_DEFAULT
);
uv_run
(
loop
,
UV_RUN_DEFAULT
);
return
0
;
return
0
;
...
@@ -411,6 +412,7 @@ HELPER_IMPL(pipe_pump_server) {
...
@@ -411,6 +412,7 @@ HELPER_IMPL(pipe_pump_server) {
r
=
uv_listen
((
uv_stream_t
*
)
&
pipeServer
,
MAX_WRITE_HANDLES
,
connection_cb
);
r
=
uv_listen
((
uv_stream_t
*
)
&
pipeServer
,
MAX_WRITE_HANDLES
,
connection_cb
);
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
notify_parent_process
();
uv_run
(
loop
,
UV_RUN_DEFAULT
);
uv_run
(
loop
,
UV_RUN_DEFAULT
);
MAKE_VALGRIND_HAPPY
();
MAKE_VALGRIND_HAPPY
();
...
...
worker/deps/libuv/libuv/test/blackhole-server.c
浏览文件 @
edde98d7
...
@@ -114,6 +114,7 @@ HELPER_IMPL(tcp4_blackhole_server) {
...
@@ -114,6 +114,7 @@ HELPER_IMPL(tcp4_blackhole_server) {
r
=
uv_listen
((
uv_stream_t
*
)
&
tcp_server
,
128
,
connection_cb
);
r
=
uv_listen
((
uv_stream_t
*
)
&
tcp_server
,
128
,
connection_cb
);
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
notify_parent_process
();
r
=
uv_run
(
loop
,
UV_RUN_DEFAULT
);
r
=
uv_run
(
loop
,
UV_RUN_DEFAULT
);
ASSERT
(
0
&&
"Blackhole server dropped out of event loop."
);
ASSERT
(
0
&&
"Blackhole server dropped out of event loop."
);
...
...
worker/deps/libuv/libuv/test/echo-server.c
浏览文件 @
edde98d7
...
@@ -209,6 +209,7 @@ static void on_recv(uv_udp_t* handle,
...
@@ -209,6 +209,7 @@ static void on_recv(uv_udp_t* handle,
const
struct
sockaddr
*
addr
,
const
struct
sockaddr
*
addr
,
unsigned
flags
)
{
unsigned
flags
)
{
uv_buf_t
sndbuf
;
uv_buf_t
sndbuf
;
uv_udp_send_t
*
req
;
if
(
nread
==
0
)
{
if
(
nread
==
0
)
{
/* Everything OK, but nothing read. */
/* Everything OK, but nothing read. */
...
@@ -218,7 +219,7 @@ static void on_recv(uv_udp_t* handle,
...
@@ -218,7 +219,7 @@ static void on_recv(uv_udp_t* handle,
ASSERT
(
nread
>
0
);
ASSERT
(
nread
>
0
);
ASSERT
(
addr
->
sa_family
==
AF_INET
);
ASSERT
(
addr
->
sa_family
==
AF_INET
);
uv_udp_send_t
*
req
=
send_alloc
();
req
=
send_alloc
();
ASSERT
(
req
!=
NULL
);
ASSERT
(
req
!=
NULL
);
sndbuf
=
uv_buf_init
(
rcvbuf
->
base
,
nread
);
sndbuf
=
uv_buf_init
(
rcvbuf
->
base
,
nread
);
ASSERT
(
0
<=
uv_udp_send
(
req
,
handle
,
&
sndbuf
,
1
,
addr
,
on_send
));
ASSERT
(
0
<=
uv_udp_send
(
req
,
handle
,
&
sndbuf
,
1
,
addr
,
on_send
));
...
@@ -228,7 +229,7 @@ static int tcp4_echo_start(int port) {
...
@@ -228,7 +229,7 @@ static int tcp4_echo_start(int port) {
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
int
r
;
int
r
;
ASSERT
(
0
==
uv_ip4_addr
(
"
0.0.0.0
"
,
port
,
&
addr
));
ASSERT
(
0
==
uv_ip4_addr
(
"
127.0.0.1
"
,
port
,
&
addr
));
server
=
(
uv_handle_t
*
)
&
tcpServer
;
server
=
(
uv_handle_t
*
)
&
tcpServer
;
serverType
=
TCP
;
serverType
=
TCP
;
...
...
worker/deps/libuv/libuv/test/run-tests.c
浏览文件 @
edde98d7
...
@@ -50,6 +50,10 @@ int spawn_tcp_server_helper(void);
...
@@ -50,6 +50,10 @@ int spawn_tcp_server_helper(void);
static
int
maybe_run_test
(
int
argc
,
char
**
argv
);
static
int
maybe_run_test
(
int
argc
,
char
**
argv
);
#ifdef _WIN32
typedef
BOOL
(
WINAPI
*
sCompareObjectHandles
)(
_In_
HANDLE
,
_In_
HANDLE
);
#endif
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
#ifndef _WIN32
#ifndef _WIN32
...
@@ -202,22 +206,36 @@ static int maybe_run_test(int argc, char **argv) {
...
@@ -202,22 +206,36 @@ static int maybe_run_test(int argc, char **argv) {
return
1
;
return
1
;
}
}
#ifndef _WIN32
if
(
strcmp
(
argv
[
1
],
"spawn_helper8"
)
==
0
)
{
if
(
strcmp
(
argv
[
1
],
"spawn_helper8"
)
==
0
)
{
int
fd
;
uv_os_fd_t
closed_fd
;
uv_os_fd_t
open_fd
;
#ifdef _WIN32
DWORD
flags
;
HMODULE
kernelbase_module
;
sCompareObjectHandles
pCompareObjectHandles
;
/* function introduced in Windows 10 */
#endif
notify_parent_process
();
notify_parent_process
();
ASSERT
(
sizeof
(
fd
)
==
read
(
0
,
&
fd
,
sizeof
(
fd
)));
ASSERT
(
sizeof
(
closed_fd
)
==
read
(
0
,
&
closed_fd
,
sizeof
(
closed_fd
)));
ASSERT
(
fd
>
2
);
ASSERT
(
sizeof
(
open_fd
)
==
read
(
0
,
&
open_fd
,
sizeof
(
open_fd
)));
#ifdef _WIN32
ASSERT
((
intptr_t
)
closed_fd
>
0
);
ASSERT
((
intptr_t
)
open_fd
>
0
);
ASSERT
(
0
!=
GetHandleInformation
(
open_fd
,
&
flags
));
kernelbase_module
=
GetModuleHandleA
(
"kernelbase.dll"
);
pCompareObjectHandles
=
(
sCompareObjectHandles
)
GetProcAddress
(
kernelbase_module
,
"CompareObjectHandles"
);
ASSERT
(
pCompareObjectHandles
==
NULL
||
!
pCompareObjectHandles
(
open_fd
,
closed_fd
));
#else
ASSERT
(
open_fd
>
2
);
ASSERT
(
closed_fd
>
2
);
# if defined(__PASE__)
/* On IBMi PASE, write() returns 1 */
# if defined(__PASE__)
/* On IBMi PASE, write() returns 1 */
ASSERT
(
1
==
write
(
fd
,
"x"
,
1
));
ASSERT
(
1
==
write
(
closed_
fd
,
"x"
,
1
));
# else
# else
ASSERT
(
-
1
==
write
(
fd
,
"x"
,
1
));
ASSERT
(
-
1
==
write
(
closed_
fd
,
"x"
,
1
));
# endif
/* !__PASE__ */
# endif
/* !__PASE__ */
#endif
return
1
;
return
1
;
}
}
#endif
/* !_WIN32 */
if
(
strcmp
(
argv
[
1
],
"spawn_helper9"
)
==
0
)
{
if
(
strcmp
(
argv
[
1
],
"spawn_helper9"
)
==
0
)
{
notify_parent_process
();
notify_parent_process
();
...
...
worker/deps/libuv/libuv/test/task.h
浏览文件 @
edde98d7
...
@@ -113,8 +113,8 @@ typedef enum {
...
@@ -113,8 +113,8 @@ typedef enum {
#define ASSERT_BASE(a, operator, b, type, conv) \
#define ASSERT_BASE(a, operator, b, type, conv) \
do { \
do { \
type eval_a = (type) (a);
\
volatile type eval_a = (type) (a);
\
type eval_b = (type) (b);
\
volatile type eval_b = (type) (b);
\
if (!(eval_a operator eval_b)) { \
if (!(eval_a operator eval_b)) { \
fprintf(stderr, \
fprintf(stderr, \
"Assertion failed in %s on line %d: `%s %s %s` " \
"Assertion failed in %s on line %d: `%s %s %s` " \
...
@@ -196,22 +196,26 @@ typedef enum {
...
@@ -196,22 +196,26 @@ typedef enum {
} \
} \
} while (0)
} while (0)
#define ASSERT_INT_BASE(a, operator, b, type, conv) \
#define ASSERT_EQ(a, b) ASSERT_BASE(a, ==, b, int64_t, PRId64)
ASSERT_BASE(a, operator, b, type, conv)
#define ASSERT_GE(a, b) ASSERT_BASE(a, >=, b, int64_t, PRId64)
#define ASSERT_GT(a, b) ASSERT_BASE(a, >, b, int64_t, PRId64)
#define ASSERT_EQ(a, b) ASSERT_INT_BASE(a, ==, b, int64_t, PRId64)
#define ASSERT_LE(a, b) ASSERT_BASE(a, <=, b, int64_t, PRId64)
#define ASSERT_GE(a, b) ASSERT_INT_BASE(a, >=, b, int64_t, PRId64)
#define ASSERT_LT(a, b) ASSERT_BASE(a, <, b, int64_t, PRId64)
#define ASSERT_GT(a, b) ASSERT_INT_BASE(a, >, b, int64_t, PRId64)
#define ASSERT_NE(a, b) ASSERT_BASE(a, !=, b, int64_t, PRId64)
#define ASSERT_LE(a, b) ASSERT_INT_BASE(a, <=, b, int64_t, PRId64)
#define ASSERT_LT(a, b) ASSERT_INT_BASE(a, <, b, int64_t, PRId64)
#define ASSERT_UINT64_EQ(a, b) ASSERT_BASE(a, ==, b, uint64_t, PRIu64)
#define ASSERT_NE(a, b) ASSERT_INT_BASE(a, !=, b, int64_t, PRId64)
#define ASSERT_UINT64_GE(a, b) ASSERT_BASE(a, >=, b, uint64_t, PRIu64)
#define ASSERT_UINT64_GT(a, b) ASSERT_BASE(a, >, b, uint64_t, PRIu64)
#define ASSERT_UINT64_EQ(a, b) ASSERT_INT_BASE(a, ==, b, uint64_t, PRIu64)
#define ASSERT_UINT64_LE(a, b) ASSERT_BASE(a, <=, b, uint64_t, PRIu64)
#define ASSERT_UINT64_GE(a, b) ASSERT_INT_BASE(a, >=, b, uint64_t, PRIu64)
#define ASSERT_UINT64_LT(a, b) ASSERT_BASE(a, <, b, uint64_t, PRIu64)
#define ASSERT_UINT64_GT(a, b) ASSERT_INT_BASE(a, >, b, uint64_t, PRIu64)
#define ASSERT_UINT64_NE(a, b) ASSERT_BASE(a, !=, b, uint64_t, PRIu64)
#define ASSERT_UINT64_LE(a, b) ASSERT_INT_BASE(a, <=, b, uint64_t, PRIu64)
#define ASSERT_UINT64_LT(a, b) ASSERT_INT_BASE(a, <, b, uint64_t, PRIu64)
#define ASSERT_DOUBLE_EQ(a, b) ASSERT_BASE(a, ==, b, double, "f")
#define ASSERT_UINT64_NE(a, b) ASSERT_INT_BASE(a, !=, b, uint64_t, PRIu64)
#define ASSERT_DOUBLE_GE(a, b) ASSERT_BASE(a, >=, b, double, "f")
#define ASSERT_DOUBLE_GT(a, b) ASSERT_BASE(a, >, b, double, "f")
#define ASSERT_DOUBLE_LE(a, b) ASSERT_BASE(a, <=, b, double, "f")
#define ASSERT_DOUBLE_LT(a, b) ASSERT_BASE(a, <, b, double, "f")
#define ASSERT_DOUBLE_NE(a, b) ASSERT_BASE(a, !=, b, double, "f")
#define ASSERT_STR_EQ(a, b) \
#define ASSERT_STR_EQ(a, b) \
ASSERT_BASE_STR(strcmp(a, b) == 0, a, == , b, char*, "s")
ASSERT_BASE_STR(strcmp(a, b) == 0, a, == , b, char*, "s")
...
...
worker/deps/libuv/libuv/test/test-close-fd.c
浏览文件 @
edde98d7
...
@@ -19,12 +19,11 @@
...
@@ -19,12 +19,11 @@
* IN THE SOFTWARE.
* IN THE SOFTWARE.
*/
*/
#if !defined(_WIN32)
#include "uv.h"
#include "uv.h"
#include "task.h"
#include "task.h"
#i
nclude <fcntl.h>
#i
fndef _WIN32
#include <unistd.h>
#include <unistd.h>
#endif
static
unsigned
int
read_cb_called
;
static
unsigned
int
read_cb_called
;
...
@@ -51,14 +50,25 @@ static void read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
...
@@ -51,14 +50,25 @@ static void read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
TEST_IMPL
(
close_fd
)
{
TEST_IMPL
(
close_fd
)
{
uv_pipe_t
pipe_handle
;
uv_pipe_t
pipe_handle
;
int
fd
[
2
];
uv_fs_t
req
;
uv_buf_t
bufs
[
1
];
uv_file
fd
[
2
];
bufs
[
0
]
=
uv_buf_init
(
""
,
1
);
ASSERT
(
0
==
pipe
(
fd
));
ASSERT
(
0
==
uv_pipe
(
fd
,
0
,
0
));
ASSERT
(
0
==
uv_pipe_init
(
uv_default_loop
(),
&
pipe_handle
,
0
));
ASSERT
(
0
==
uv_pipe_init
(
uv_default_loop
(),
&
pipe_handle
,
0
));
ASSERT
(
0
==
uv_pipe_open
(
&
pipe_handle
,
fd
[
0
]));
ASSERT
(
0
==
uv_pipe_open
(
&
pipe_handle
,
fd
[
0
]));
fd
[
0
]
=
-
1
;
/* uv_pipe_open() takes ownership of the file descriptor. */
/* uv_pipe_open() takes ownership of the file descriptor. */
ASSERT
(
1
==
write
(
fd
[
1
],
""
,
1
));
fd
[
0
]
=
-
1
;
ASSERT
(
1
==
uv_fs_write
(
NULL
,
&
req
,
fd
[
1
],
bufs
,
1
,
-
1
,
NULL
));
ASSERT
(
1
==
req
.
result
);
uv_fs_req_cleanup
(
&
req
);
#ifdef _WIN32
ASSERT
(
0
==
_close
(
fd
[
1
]));
#else
ASSERT
(
0
==
close
(
fd
[
1
]));
ASSERT
(
0
==
close
(
fd
[
1
]));
#endif
fd
[
1
]
=
-
1
;
fd
[
1
]
=
-
1
;
ASSERT
(
0
==
uv_read_start
((
uv_stream_t
*
)
&
pipe_handle
,
alloc_cb
,
read_cb
));
ASSERT
(
0
==
uv_read_start
((
uv_stream_t
*
)
&
pipe_handle
,
alloc_cb
,
read_cb
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
...
@@ -72,9 +82,3 @@ TEST_IMPL(close_fd) {
...
@@ -72,9 +82,3 @@ TEST_IMPL(close_fd) {
MAKE_VALGRIND_HAPPY
();
MAKE_VALGRIND_HAPPY
();
return
0
;
return
0
;
}
}
#else
typedef
int
file_has_no_tests
;
/* ISO C forbids an empty translation unit. */
#endif
/* !_WIN32 */
worker/deps/libuv/libuv/test/test-error.c
浏览文件 @
edde98d7
...
@@ -37,6 +37,9 @@
...
@@ -37,6 +37,9 @@
* See https://github.com/joyent/libuv/issues/210
* See https://github.com/joyent/libuv/issues/210
*/
*/
TEST_IMPL
(
error_message
)
{
TEST_IMPL
(
error_message
)
{
#if defined(__ASAN__)
RETURN_SKIP
(
"Test does not currently work in ASAN"
);
#endif
char
buf
[
32
];
char
buf
[
32
];
/* Cop out. Can't do proper checks on systems with
/* Cop out. Can't do proper checks on systems with
...
...
worker/deps/libuv/libuv/test/test-fs-copyfile.c
浏览文件 @
edde98d7
...
@@ -96,6 +96,9 @@ static void touch_file(const char* name, unsigned int size) {
...
@@ -96,6 +96,9 @@ static void touch_file(const char* name, unsigned int size) {
TEST_IMPL
(
fs_copyfile
)
{
TEST_IMPL
(
fs_copyfile
)
{
#if defined(__ASAN__)
RETURN_SKIP
(
"Test does not currently work in ASAN"
);
#endif
const
char
src
[]
=
"test_file_src"
;
const
char
src
[]
=
"test_file_src"
;
uv_loop_t
*
loop
;
uv_loop_t
*
loop
;
uv_fs_t
req
;
uv_fs_t
req
;
...
...
worker/deps/libuv/libuv/test/test-fs-event.c
浏览文件 @
edde98d7
...
@@ -673,6 +673,9 @@ TEST_IMPL(fs_event_watch_file_exact_path) {
...
@@ -673,6 +673,9 @@ TEST_IMPL(fs_event_watch_file_exact_path) {
TEST_IMPL
(
fs_event_watch_file_twice
)
{
TEST_IMPL
(
fs_event_watch_file_twice
)
{
#if defined(NO_FS_EVENTS)
#if defined(NO_FS_EVENTS)
RETURN_SKIP
(
NO_FS_EVENTS
);
RETURN_SKIP
(
NO_FS_EVENTS
);
#endif
#if defined(__ASAN__)
RETURN_SKIP
(
"Test does not currently work in ASAN"
);
#endif
#endif
const
char
path
[]
=
"test/fixtures/empty_file"
;
const
char
path
[]
=
"test/fixtures/empty_file"
;
uv_fs_event_t
watchers
[
2
];
uv_fs_event_t
watchers
[
2
];
...
...
worker/deps/libuv/libuv/test/test-fs-readdir.c
浏览文件 @
edde98d7
...
@@ -230,6 +230,9 @@ static void file_opendir_cb(uv_fs_t* req) {
...
@@ -230,6 +230,9 @@ static void file_opendir_cb(uv_fs_t* req) {
}
}
TEST_IMPL
(
fs_readdir_file
)
{
TEST_IMPL
(
fs_readdir_file
)
{
#if defined(__ASAN__)
RETURN_SKIP
(
"Test does not currently work in ASAN"
);
#endif
const
char
*
path
;
const
char
*
path
;
int
r
;
int
r
;
...
...
worker/deps/libuv/libuv/test/test-fs.c
浏览文件 @
edde98d7
...
@@ -673,7 +673,7 @@ static void stat_cb(uv_fs_t* req) {
...
@@ -673,7 +673,7 @@ static void stat_cb(uv_fs_t* req) {
static
void
sendfile_cb
(
uv_fs_t
*
req
)
{
static
void
sendfile_cb
(
uv_fs_t
*
req
)
{
ASSERT
(
req
==
&
sendfile_req
);
ASSERT
(
req
==
&
sendfile_req
);
ASSERT
(
req
->
fs_type
==
UV_FS_SENDFILE
);
ASSERT
(
req
->
fs_type
==
UV_FS_SENDFILE
);
ASSERT
(
req
->
result
==
6554
6
);
ASSERT
(
req
->
result
==
6554
5
);
sendfile_cb_count
++
;
sendfile_cb_count
++
;
uv_fs_req_cleanup
(
req
);
uv_fs_req_cleanup
(
req
);
}
}
...
@@ -816,13 +816,44 @@ static void check_utime(const char* path,
...
@@ -816,13 +816,44 @@ static void check_utime(const char* path,
else
else
r
=
uv_fs_stat
(
loop
,
&
req
,
path
,
NULL
);
r
=
uv_fs_stat
(
loop
,
&
req
,
path
,
NULL
);
ASSERT
(
r
==
0
);
ASSERT
_EQ
(
r
,
0
);
ASSERT
(
req
.
result
==
0
);
ASSERT
_EQ
(
req
.
result
,
0
);
s
=
&
req
.
statbuf
;
s
=
&
req
.
statbuf
;
ASSERT
(
s
->
st_atim
.
tv_sec
+
(
s
->
st_atim
.
tv_nsec
/
1000000000
.
0
)
==
atime
);
if
(
s
->
st_atim
.
tv_nsec
==
0
&&
s
->
st_mtim
.
tv_nsec
==
0
)
{
ASSERT
(
s
->
st_mtim
.
tv_sec
+
(
s
->
st_mtim
.
tv_nsec
/
1000000000
.
0
)
==
mtime
);
/*
* Test sub-second timestamps only when supported (such as Windows with
* NTFS). Some other platforms support sub-second timestamps, but that
* support is filesystem-dependent. Notably OS X (HFS Plus) does NOT
* support sub-second timestamps. But kernels may round or truncate in
* either direction, so we may accept either possible answer.
*/
#ifdef _WIN32
ASSERT_DOUBLE_EQ
(
atime
,
(
long
)
atime
);
ASSERT_DOUBLE_EQ
(
mtime
,
(
long
)
atime
);
#endif
if
(
atime
>
0
||
(
long
)
atime
==
atime
)
ASSERT_EQ
(
s
->
st_atim
.
tv_sec
,
(
long
)
atime
);
if
(
mtime
>
0
||
(
long
)
mtime
==
mtime
)
ASSERT_EQ
(
s
->
st_mtim
.
tv_sec
,
(
long
)
mtime
);
ASSERT_GE
(
s
->
st_atim
.
tv_sec
,
(
long
)
atime
-
1
);
ASSERT_GE
(
s
->
st_mtim
.
tv_sec
,
(
long
)
mtime
-
1
);
ASSERT_LE
(
s
->
st_atim
.
tv_sec
,
(
long
)
atime
);
ASSERT_LE
(
s
->
st_mtim
.
tv_sec
,
(
long
)
mtime
);
}
else
{
double
st_atim
;
double
st_mtim
;
#ifndef __APPLE__
/* TODO(vtjnash): would it be better to normalize this? */
ASSERT_DOUBLE_GE
(
s
->
st_atim
.
tv_nsec
,
0
);
ASSERT_DOUBLE_GE
(
s
->
st_mtim
.
tv_nsec
,
0
);
#endif
st_atim
=
s
->
st_atim
.
tv_sec
+
s
->
st_atim
.
tv_nsec
/
1e9
;
st_mtim
=
s
->
st_mtim
.
tv_sec
+
s
->
st_mtim
.
tv_nsec
/
1e9
;
ASSERT_DOUBLE_EQ
(
st_atim
,
atime
);
ASSERT_DOUBLE_EQ
(
st_mtim
,
mtime
);
}
uv_fs_req_cleanup
(
&
req
);
uv_fs_req_cleanup
(
&
req
);
}
}
...
@@ -1159,6 +1190,8 @@ TEST_IMPL(fs_async_dir) {
...
@@ -1159,6 +1190,8 @@ TEST_IMPL(fs_async_dir) {
static
int
test_sendfile
(
void
(
*
setup
)(
int
),
uv_fs_cb
cb
,
off_t
expected_size
)
{
static
int
test_sendfile
(
void
(
*
setup
)(
int
),
uv_fs_cb
cb
,
off_t
expected_size
)
{
int
f
,
r
;
int
f
,
r
;
struct
stat
s1
,
s2
;
struct
stat
s1
,
s2
;
uv_fs_t
req
;
char
buf1
[
1
];
loop
=
uv_default_loop
();
loop
=
uv_default_loop
();
...
@@ -1188,7 +1221,7 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
...
@@ -1188,7 +1221,7 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
uv_fs_req_cleanup
(
&
open_req2
);
uv_fs_req_cleanup
(
&
open_req2
);
r
=
uv_fs_sendfile
(
loop
,
&
sendfile_req
,
open_req2
.
result
,
open_req1
.
result
,
r
=
uv_fs_sendfile
(
loop
,
&
sendfile_req
,
open_req2
.
result
,
open_req1
.
result
,
0
,
131072
,
cb
);
1
,
131072
,
cb
);
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
uv_run
(
loop
,
UV_RUN_DEFAULT
);
uv_run
(
loop
,
UV_RUN_DEFAULT
);
...
@@ -1203,9 +1236,26 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
...
@@ -1203,9 +1236,26 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
ASSERT
(
0
==
stat
(
"test_file"
,
&
s1
));
ASSERT
(
0
==
stat
(
"test_file"
,
&
s1
));
ASSERT
(
0
==
stat
(
"test_file2"
,
&
s2
));
ASSERT
(
0
==
stat
(
"test_file2"
,
&
s2
));
ASSERT
(
s1
.
st_size
==
s2
.
st_size
);
ASSERT
(
s2
.
st_size
==
expected_size
);
ASSERT
(
s2
.
st_size
==
expected_size
);
if
(
expected_size
>
0
)
{
ASSERT_UINT64_EQ
(
s1
.
st_size
,
s2
.
st_size
+
1
);
r
=
uv_fs_open
(
NULL
,
&
open_req1
,
"test_file2"
,
O_RDWR
,
0
,
NULL
);
ASSERT
(
r
>=
0
);
ASSERT
(
open_req1
.
result
>=
0
);
uv_fs_req_cleanup
(
&
open_req1
);
memset
(
buf1
,
0
,
sizeof
(
buf1
));
iov
=
uv_buf_init
(
buf1
,
sizeof
(
buf1
));
r
=
uv_fs_read
(
NULL
,
&
req
,
open_req1
.
result
,
&
iov
,
1
,
-
1
,
NULL
);
ASSERT
(
r
>=
0
);
ASSERT
(
req
.
result
>=
0
);
ASSERT_EQ
(
buf1
[
0
],
'e'
);
/* 'e' from begin */
uv_fs_req_cleanup
(
&
req
);
}
else
{
ASSERT_UINT64_EQ
(
s1
.
st_size
,
s2
.
st_size
);
}
/* Cleanup. */
/* Cleanup. */
unlink
(
"test_file"
);
unlink
(
"test_file"
);
unlink
(
"test_file2"
);
unlink
(
"test_file2"
);
...
@@ -1223,7 +1273,7 @@ static void sendfile_setup(int f) {
...
@@ -1223,7 +1273,7 @@ static void sendfile_setup(int f) {
TEST_IMPL
(
fs_async_sendfile
)
{
TEST_IMPL
(
fs_async_sendfile
)
{
return
test_sendfile
(
sendfile_setup
,
sendfile_cb
,
6554
6
);
return
test_sendfile
(
sendfile_setup
,
sendfile_cb
,
6554
5
);
}
}
...
@@ -2523,29 +2573,16 @@ TEST_IMPL(fs_utime) {
...
@@ -2523,29 +2573,16 @@ TEST_IMPL(fs_utime) {
uv_fs_req_cleanup
(
&
req
);
uv_fs_req_cleanup
(
&
req
);
uv_fs_close
(
loop
,
&
req
,
r
,
NULL
);
uv_fs_close
(
loop
,
&
req
,
r
,
NULL
);
atime
=
mtime
=
400497753
;
/* 1982-09-10 11:22:33 */
atime
=
mtime
=
400497753
.
25
;
/* 1982-09-10 11:22:33.25 */
/*
* Test sub-second timestamps only on Windows (assuming NTFS). Some other
* platforms support sub-second timestamps, but that support is filesystem-
* dependent. Notably OS X (HFS Plus) does NOT support sub-second timestamps.
*/
#ifdef _WIN32
mtime
+=
0
.
444
;
/* 1982-09-10 11:22:33.444 */
#endif
r
=
uv_fs_utime
(
NULL
,
&
req
,
path
,
atime
,
mtime
,
NULL
);
r
=
uv_fs_utime
(
NULL
,
&
req
,
path
,
atime
,
mtime
,
NULL
);
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
ASSERT
(
req
.
result
==
0
);
ASSERT
(
req
.
result
==
0
);
uv_fs_req_cleanup
(
&
req
);
uv_fs_req_cleanup
(
&
req
);
r
=
uv_fs_stat
(
NULL
,
&
req
,
path
,
NULL
);
ASSERT
(
r
==
0
);
ASSERT
(
req
.
result
==
0
);
check_utime
(
path
,
atime
,
mtime
,
/* test_lutime */
0
);
check_utime
(
path
,
atime
,
mtime
,
/* test_lutime */
0
);
uv_fs_req_cleanup
(
&
req
);
atime
=
mtime
=
1291404900
;
/* 2010-12-03 20:35:00
- mees <3 */
atime
=
mtime
=
1291404900
.
25
;
/* 2010-12-03 20:35:00.25
- mees <3 */
checkme
.
path
=
path
;
checkme
.
path
=
path
;
checkme
.
atime
=
atime
;
checkme
.
atime
=
atime
;
checkme
.
mtime
=
mtime
;
checkme
.
mtime
=
mtime
;
...
@@ -2565,6 +2602,45 @@ TEST_IMPL(fs_utime) {
...
@@ -2565,6 +2602,45 @@ TEST_IMPL(fs_utime) {
}
}
TEST_IMPL
(
fs_utime_round
)
{
const
char
path
[]
=
"test_file"
;
double
atime
;
double
mtime
;
uv_fs_t
req
;
int
r
;
loop
=
uv_default_loop
();
unlink
(
path
);
r
=
uv_fs_open
(
NULL
,
&
req
,
path
,
O_RDWR
|
O_CREAT
,
S_IWUSR
|
S_IRUSR
,
NULL
);
ASSERT_GE
(
r
,
0
);
ASSERT_GE
(
req
.
result
,
0
);
uv_fs_req_cleanup
(
&
req
);
ASSERT_EQ
(
0
,
uv_fs_close
(
loop
,
&
req
,
r
,
NULL
));
atime
=
mtime
=
-
14245440
.
25
;
/* 1969-07-20T02:56:00.25Z */
r
=
uv_fs_utime
(
NULL
,
&
req
,
path
,
atime
,
mtime
,
NULL
);
#if !defined(__linux__) && \
!defined(_WIN32) && \
!defined(__APPLE__) && \
!defined(__FreeBSD__) && \
!defined(__sun)
if
(
r
!=
0
)
{
ASSERT_EQ
(
r
,
UV_EINVAL
);
RETURN_SKIP
(
"utime on some OS (z/OS, IBM i PASE, AIX) or filesystems may reject pre-epoch timestamps"
);
}
#endif
ASSERT_EQ
(
0
,
r
);
ASSERT_EQ
(
0
,
req
.
result
);
uv_fs_req_cleanup
(
&
req
);
check_utime
(
path
,
atime
,
mtime
,
/* test_lutime */
0
);
unlink
(
path
);
MAKE_VALGRIND_HAPPY
();
return
0
;
}
#ifdef _WIN32
#ifdef _WIN32
TEST_IMPL
(
fs_stat_root
)
{
TEST_IMPL
(
fs_stat_root
)
{
int
r
;
int
r
;
...
@@ -2618,16 +2694,7 @@ TEST_IMPL(fs_futime) {
...
@@ -2618,16 +2694,7 @@ TEST_IMPL(fs_futime) {
uv_fs_req_cleanup
(
&
req
);
uv_fs_req_cleanup
(
&
req
);
uv_fs_close
(
loop
,
&
req
,
r
,
NULL
);
uv_fs_close
(
loop
,
&
req
,
r
,
NULL
);
atime
=
mtime
=
400497753
;
/* 1982-09-10 11:22:33 */
atime
=
mtime
=
400497753
.
25
;
/* 1982-09-10 11:22:33.25 */
/*
* Test sub-second timestamps only on Windows (assuming NTFS). Some other
* platforms support sub-second timestamps, but that support is filesystem-
* dependent. Notably OS X (HFS Plus) does NOT support sub-second timestamps.
*/
#ifdef _WIN32
mtime
+=
0
.
444
;
/* 1982-09-10 11:22:33.444 */
#endif
r
=
uv_fs_open
(
NULL
,
&
req
,
path
,
O_RDWR
,
0
,
NULL
);
r
=
uv_fs_open
(
NULL
,
&
req
,
path
,
O_RDWR
,
0
,
NULL
);
ASSERT
(
r
>=
0
);
ASSERT
(
r
>=
0
);
...
@@ -2645,11 +2712,7 @@ TEST_IMPL(fs_futime) {
...
@@ -2645,11 +2712,7 @@ TEST_IMPL(fs_futime) {
#endif
#endif
uv_fs_req_cleanup
(
&
req
);
uv_fs_req_cleanup
(
&
req
);
r
=
uv_fs_stat
(
NULL
,
&
req
,
path
,
NULL
);
ASSERT
(
r
==
0
);
ASSERT
(
req
.
result
==
0
);
check_utime
(
path
,
atime
,
mtime
,
/* test_lutime */
0
);
check_utime
(
path
,
atime
,
mtime
,
/* test_lutime */
0
);
uv_fs_req_cleanup
(
&
req
);
atime
=
mtime
=
1291404900
;
/* 2010-12-03 20:35:00 - mees <3 */
atime
=
mtime
=
1291404900
;
/* 2010-12-03 20:35:00 - mees <3 */
...
@@ -2708,11 +2771,7 @@ TEST_IMPL(fs_lutime) {
...
@@ -2708,11 +2771,7 @@ TEST_IMPL(fs_lutime) {
uv_fs_req_cleanup
(
&
req
);
uv_fs_req_cleanup
(
&
req
);
/* Test the synchronous version. */
/* Test the synchronous version. */
atime
=
mtime
=
400497753
;
/* 1982-09-10 11:22:33 */
atime
=
mtime
=
400497753
.
25
;
/* 1982-09-10 11:22:33.25 */
#ifdef _WIN32
mtime
+=
0
.
444
;
/* 1982-09-10 11:22:33.444 */
#endif
checkme
.
atime
=
atime
;
checkme
.
atime
=
atime
;
checkme
.
mtime
=
mtime
;
checkme
.
mtime
=
mtime
;
...
@@ -2837,6 +2896,9 @@ TEST_IMPL(fs_scandir_non_existent_dir) {
...
@@ -2837,6 +2896,9 @@ TEST_IMPL(fs_scandir_non_existent_dir) {
}
}
TEST_IMPL
(
fs_scandir_file
)
{
TEST_IMPL
(
fs_scandir_file
)
{
#if defined(__ASAN__)
RETURN_SKIP
(
"Test does not currently work in ASAN"
);
#endif
const
char
*
path
;
const
char
*
path
;
int
r
;
int
r
;
...
@@ -3083,6 +3145,9 @@ static void fs_read_bufs(int add_flags) {
...
@@ -3083,6 +3145,9 @@ static void fs_read_bufs(int add_flags) {
uv_fs_req_cleanup
(
&
close_req
);
uv_fs_req_cleanup
(
&
close_req
);
}
}
TEST_IMPL
(
fs_read_bufs
)
{
TEST_IMPL
(
fs_read_bufs
)
{
#if defined(__ASAN__)
RETURN_SKIP
(
"Test does not currently work in ASAN"
);
#endif
fs_read_bufs
(
0
);
fs_read_bufs
(
0
);
fs_read_bufs
(
UV_FS_O_FILEMAP
);
fs_read_bufs
(
UV_FS_O_FILEMAP
);
...
@@ -4372,6 +4437,7 @@ TEST_IMPL(fs_invalid_mkdir_name) {
...
@@ -4372,6 +4437,7 @@ TEST_IMPL(fs_invalid_mkdir_name) {
loop
=
uv_default_loop
();
loop
=
uv_default_loop
();
r
=
uv_fs_mkdir
(
loop
,
&
req
,
"invalid>"
,
0
,
NULL
);
r
=
uv_fs_mkdir
(
loop
,
&
req
,
"invalid>"
,
0
,
NULL
);
ASSERT
(
r
==
UV_EINVAL
);
ASSERT
(
r
==
UV_EINVAL
);
ASSERT_EQ
(
UV_EINVAL
,
uv_fs_mkdir
(
loop
,
&
req
,
"test:lol"
,
0
,
NULL
));
return
0
;
return
0
;
}
}
...
...
worker/deps/libuv/libuv/test/test-getaddrinfo.c
浏览文件 @
edde98d7
...
@@ -100,7 +100,7 @@ TEST_IMPL(getaddrinfo_fail) {
...
@@ -100,7 +100,7 @@ TEST_IMPL(getaddrinfo_fail) {
ASSERT
(
0
==
uv_getaddrinfo
(
uv_default_loop
(),
ASSERT
(
0
==
uv_getaddrinfo
(
uv_default_loop
(),
&
req
,
&
req
,
getaddrinfo_fail_cb
,
getaddrinfo_fail_cb
,
"
xyzzy.xyzzy.xyzzy
."
,
"
example.invalid
."
,
NULL
,
NULL
,
NULL
));
NULL
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
...
@@ -122,7 +122,7 @@ TEST_IMPL(getaddrinfo_fail_sync) {
...
@@ -122,7 +122,7 @@ TEST_IMPL(getaddrinfo_fail_sync) {
ASSERT
(
0
>
uv_getaddrinfo
(
uv_default_loop
(),
ASSERT
(
0
>
uv_getaddrinfo
(
uv_default_loop
(),
&
req
,
&
req
,
NULL
,
NULL
,
"
xyzzy.xyzzy.xyzzy
."
,
"
example.invalid
."
,
NULL
,
NULL
,
NULL
));
NULL
));
uv_freeaddrinfo
(
req
.
addrinfo
);
uv_freeaddrinfo
(
req
.
addrinfo
);
...
...
worker/deps/libuv/libuv/test/test-ipc.c
浏览文件 @
edde98d7
...
@@ -693,6 +693,11 @@ static void ipc_on_connection(uv_stream_t* server, int status) {
...
@@ -693,6 +693,11 @@ static void ipc_on_connection(uv_stream_t* server, int status) {
}
}
static
void
close_and_free_cb
(
uv_handle_t
*
handle
)
{
close_cb_called
++
;
free
(
handle
);
}
static
void
ipc_on_connection_tcp_conn
(
uv_stream_t
*
server
,
int
status
)
{
static
void
ipc_on_connection_tcp_conn
(
uv_stream_t
*
server
,
int
status
)
{
int
r
;
int
r
;
uv_buf_t
buf
;
uv_buf_t
buf
;
...
@@ -721,7 +726,7 @@ static void ipc_on_connection_tcp_conn(uv_stream_t* server, int status) {
...
@@ -721,7 +726,7 @@ static void ipc_on_connection_tcp_conn(uv_stream_t* server, int status) {
on_tcp_child_process_read
);
on_tcp_child_process_read
);
ASSERT_EQ
(
r
,
0
);
ASSERT_EQ
(
r
,
0
);
uv_close
((
uv_handle_t
*
)
conn
,
close_cb
);
uv_close
((
uv_handle_t
*
)
conn
,
close_
and_free_
cb
);
}
}
...
...
worker/deps/libuv/libuv/test/test-list.h
浏览文件 @
edde98d7
...
@@ -116,7 +116,8 @@ TEST_DECLARE (tcp_open_bound)
...
@@ -116,7 +116,8 @@ TEST_DECLARE (tcp_open_bound)
TEST_DECLARE
(
tcp_open_connected
)
TEST_DECLARE
(
tcp_open_connected
)
TEST_DECLARE
(
tcp_connect_error_after_write
)
TEST_DECLARE
(
tcp_connect_error_after_write
)
TEST_DECLARE
(
tcp_shutdown_after_write
)
TEST_DECLARE
(
tcp_shutdown_after_write
)
TEST_DECLARE
(
tcp_bind_error_addrinuse
)
TEST_DECLARE
(
tcp_bind_error_addrinuse_connect
)
TEST_DECLARE
(
tcp_bind_error_addrinuse_listen
)
TEST_DECLARE
(
tcp_bind_error_addrnotavail_1
)
TEST_DECLARE
(
tcp_bind_error_addrnotavail_1
)
TEST_DECLARE
(
tcp_bind_error_addrnotavail_2
)
TEST_DECLARE
(
tcp_bind_error_addrnotavail_2
)
TEST_DECLARE
(
tcp_bind_error_fault
)
TEST_DECLARE
(
tcp_bind_error_fault
)
...
@@ -359,6 +360,7 @@ TEST_DECLARE (fs_open_flags)
...
@@ -359,6 +360,7 @@ TEST_DECLARE (fs_open_flags)
TEST_DECLARE
(
fs_fd_hash
)
TEST_DECLARE
(
fs_fd_hash
)
#endif
#endif
TEST_DECLARE
(
fs_utime
)
TEST_DECLARE
(
fs_utime
)
TEST_DECLARE
(
fs_utime_round
)
TEST_DECLARE
(
fs_futime
)
TEST_DECLARE
(
fs_futime
)
TEST_DECLARE
(
fs_lutime
)
TEST_DECLARE
(
fs_lutime
)
TEST_DECLARE
(
fs_file_open_append
)
TEST_DECLARE
(
fs_file_open_append
)
...
@@ -451,12 +453,16 @@ TEST_DECLARE (poll_nested_epoll)
...
@@ -451,12 +453,16 @@ TEST_DECLARE (poll_nested_epoll)
#ifdef UV_HAVE_KQUEUE
#ifdef UV_HAVE_KQUEUE
TEST_DECLARE
(
poll_nested_kqueue
)
TEST_DECLARE
(
poll_nested_kqueue
)
#endif
#endif
TEST_DECLARE
(
poll_multiple_handles
)
TEST_DECLARE
(
ip4_addr
)
TEST_DECLARE
(
ip4_addr
)
TEST_DECLARE
(
ip6_addr_link_local
)
TEST_DECLARE
(
ip6_addr_link_local
)
TEST_DECLARE
(
poll_close_doesnt_corrupt_stack
)
TEST_DECLARE
(
poll_close_doesnt_corrupt_stack
)
TEST_DECLARE
(
poll_closesocket
)
TEST_DECLARE
(
poll_closesocket
)
TEST_DECLARE
(
close_fd
)
TEST_DECLARE
(
closed_fd_events
)
TEST_DECLARE
(
spawn_fs_open
)
#ifdef _WIN32
#ifdef _WIN32
TEST_DECLARE
(
spawn_detect_pipe_name_collisions_on_windows
)
TEST_DECLARE
(
spawn_detect_pipe_name_collisions_on_windows
)
#if !defined(USING_UV_SHARED)
#if !defined(USING_UV_SHARED)
...
@@ -471,8 +477,6 @@ TEST_DECLARE (ipc_listen_after_bind_twice)
...
@@ -471,8 +477,6 @@ TEST_DECLARE (ipc_listen_after_bind_twice)
TEST_DECLARE
(
win32_signum_number
)
TEST_DECLARE
(
win32_signum_number
)
#else
#else
TEST_DECLARE
(
emfile
)
TEST_DECLARE
(
emfile
)
TEST_DECLARE
(
close_fd
)
TEST_DECLARE
(
spawn_fs_open
)
TEST_DECLARE
(
spawn_setuid_setgid
)
TEST_DECLARE
(
spawn_setuid_setgid
)
TEST_DECLARE
(
we_get_signal
)
TEST_DECLARE
(
we_get_signal
)
TEST_DECLARE
(
we_get_signals
)
TEST_DECLARE
(
we_get_signals
)
...
@@ -481,7 +485,6 @@ TEST_DECLARE (we_get_signals_mixed)
...
@@ -481,7 +485,6 @@ TEST_DECLARE (we_get_signals_mixed)
TEST_DECLARE
(
signal_multiple_loops
)
TEST_DECLARE
(
signal_multiple_loops
)
TEST_DECLARE
(
signal_pending_on_close
)
TEST_DECLARE
(
signal_pending_on_close
)
TEST_DECLARE
(
signal_close_loop_alive
)
TEST_DECLARE
(
signal_close_loop_alive
)
TEST_DECLARE
(
closed_fd_events
)
#endif
#endif
#ifdef __APPLE__
#ifdef __APPLE__
TEST_DECLARE
(
osx_select
)
TEST_DECLARE
(
osx_select
)
...
@@ -567,7 +570,8 @@ TASK_LIST_START
...
@@ -567,7 +570,8 @@ TASK_LIST_START
#ifndef _WIN32
#ifndef _WIN32
TEST_ENTRY
(
pipe_close_stdout_read_stdin
)
TEST_ENTRY
(
pipe_close_stdout_read_stdin
)
#endif
#endif
TEST_ENTRY
(
pipe_set_non_blocking
)
/* Seems to be either about 0.5s or 5s, depending on the OS. */
TEST_ENTRY_CUSTOM
(
pipe_set_non_blocking
,
0
,
0
,
20000
)
TEST_ENTRY
(
pipe_set_chmod
)
TEST_ENTRY
(
pipe_set_chmod
)
TEST_ENTRY
(
tty
)
TEST_ENTRY
(
tty
)
#ifdef _WIN32
#ifdef _WIN32
...
@@ -671,7 +675,13 @@ TASK_LIST_START
...
@@ -671,7 +675,13 @@ TASK_LIST_START
TEST_HELPER
(
tcp_shutdown_after_write
,
tcp4_echo_server
)
TEST_HELPER
(
tcp_shutdown_after_write
,
tcp4_echo_server
)
TEST_ENTRY
(
tcp_connect_error_after_write
)
TEST_ENTRY
(
tcp_connect_error_after_write
)
TEST_ENTRY
(
tcp_bind_error_addrinuse
)
TEST_ENTRY
(
tcp_bind_error_addrinuse_connect
)
/* tcp4_echo_server steals the port. It needs to be a separate process
* because libuv sets setsockopt(SO_REUSEADDR) that lets you steal an
* existing bind if it originates from the same process.
*/
TEST_HELPER
(
tcp_bind_error_addrinuse_connect
,
tcp4_echo_server
)
TEST_ENTRY
(
tcp_bind_error_addrinuse_listen
)
TEST_ENTRY
(
tcp_bind_error_addrnotavail_1
)
TEST_ENTRY
(
tcp_bind_error_addrnotavail_1
)
TEST_ENTRY
(
tcp_bind_error_addrnotavail_2
)
TEST_ENTRY
(
tcp_bind_error_addrnotavail_2
)
TEST_ENTRY
(
tcp_bind_error_fault
)
TEST_ENTRY
(
tcp_bind_error_fault
)
...
@@ -894,6 +904,7 @@ TASK_LIST_START
...
@@ -894,6 +904,7 @@ TASK_LIST_START
#ifdef UV_HAVE_KQUEUE
#ifdef UV_HAVE_KQUEUE
TEST_ENTRY
(
poll_nested_kqueue
)
TEST_ENTRY
(
poll_nested_kqueue
)
#endif
#endif
TEST_ENTRY
(
poll_multiple_handles
)
TEST_ENTRY
(
socket_buffer_size
)
TEST_ENTRY
(
socket_buffer_size
)
...
@@ -935,6 +946,9 @@ TASK_LIST_START
...
@@ -935,6 +946,9 @@ TASK_LIST_START
TEST_ENTRY
(
poll_close_doesnt_corrupt_stack
)
TEST_ENTRY
(
poll_close_doesnt_corrupt_stack
)
TEST_ENTRY
(
poll_closesocket
)
TEST_ENTRY
(
poll_closesocket
)
TEST_ENTRY
(
close_fd
)
TEST_ENTRY
(
closed_fd_events
)
TEST_ENTRY
(
spawn_fs_open
)
#ifdef _WIN32
#ifdef _WIN32
TEST_ENTRY
(
spawn_detect_pipe_name_collisions_on_windows
)
TEST_ENTRY
(
spawn_detect_pipe_name_collisions_on_windows
)
#if !defined(USING_UV_SHARED)
#if !defined(USING_UV_SHARED)
...
@@ -949,8 +963,6 @@ TASK_LIST_START
...
@@ -949,8 +963,6 @@ TASK_LIST_START
TEST_ENTRY
(
win32_signum_number
)
TEST_ENTRY
(
win32_signum_number
)
#else
#else
TEST_ENTRY
(
emfile
)
TEST_ENTRY
(
emfile
)
TEST_ENTRY
(
close_fd
)
TEST_ENTRY
(
spawn_fs_open
)
TEST_ENTRY
(
spawn_setuid_setgid
)
TEST_ENTRY
(
spawn_setuid_setgid
)
TEST_ENTRY
(
we_get_signal
)
TEST_ENTRY
(
we_get_signal
)
TEST_ENTRY
(
we_get_signals
)
TEST_ENTRY
(
we_get_signals
)
...
@@ -959,7 +971,6 @@ TASK_LIST_START
...
@@ -959,7 +971,6 @@ TASK_LIST_START
TEST_ENTRY
(
signal_multiple_loops
)
TEST_ENTRY
(
signal_multiple_loops
)
TEST_ENTRY
(
signal_pending_on_close
)
TEST_ENTRY
(
signal_pending_on_close
)
TEST_ENTRY
(
signal_close_loop_alive
)
TEST_ENTRY
(
signal_close_loop_alive
)
TEST_ENTRY
(
closed_fd_events
)
#endif
#endif
#ifdef __APPLE__
#ifdef __APPLE__
...
@@ -988,6 +999,7 @@ TASK_LIST_START
...
@@ -988,6 +999,7 @@ TASK_LIST_START
#endif
#endif
TEST_ENTRY
(
fs_chown
)
TEST_ENTRY
(
fs_chown
)
TEST_ENTRY
(
fs_utime
)
TEST_ENTRY
(
fs_utime
)
TEST_ENTRY
(
fs_utime_round
)
TEST_ENTRY
(
fs_futime
)
TEST_ENTRY
(
fs_futime
)
TEST_ENTRY
(
fs_lutime
)
TEST_ENTRY
(
fs_lutime
)
TEST_ENTRY
(
fs_readlink
)
TEST_ENTRY
(
fs_readlink
)
...
...
worker/deps/libuv/libuv/test/test-ping-pong.c
浏览文件 @
edde98d7
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
/* strlen */
static
int
completed_pingers
=
0
;
static
int
completed_pingers
=
0
;
...
@@ -33,23 +34,21 @@ static int completed_pingers = 0;
...
@@ -33,23 +34,21 @@ static int completed_pingers = 0;
#define NUM_PINGS 1000
#define NUM_PINGS 1000
#endif
#endif
/* 64 bytes is enough for a pinger */
#define BUFSIZE 10240
static
char
PING
[]
=
"PING
\n
"
;
static
char
PING
[]
=
"PING
\n
"
;
static
char
PONG
[]
=
"PONG
\n
"
;
static
int
pinger_on_connect_count
;
static
int
pinger_on_connect_count
;
typedef
struct
{
typedef
struct
{
int
vectored_writes
;
int
vectored_writes
;
int
pongs
;
unsigned
pongs
;
int
state
;
unsigned
state
;
union
{
union
{
uv_tcp_t
tcp
;
uv_tcp_t
tcp
;
uv_pipe_t
pipe
;
uv_pipe_t
pipe
;
}
stream
;
}
stream
;
uv_connect_t
connect_req
;
uv_connect_t
connect_req
;
char
read_buffer
[
BUFSIZE
]
;
char
*
pong
;
}
pinger_t
;
}
pinger_t
;
...
@@ -59,28 +58,44 @@ static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) {
...
@@ -59,28 +58,44 @@ static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) {
}
}
static
void
ponger_on_close
(
uv_handle_t
*
handle
)
{
if
(
handle
->
data
)
free
(
handle
->
data
);
else
free
(
handle
);
}
static
void
pinger_on_close
(
uv_handle_t
*
handle
)
{
static
void
pinger_on_close
(
uv_handle_t
*
handle
)
{
pinger_t
*
pinger
=
(
pinger_t
*
)
handle
->
data
;
pinger_t
*
pinger
=
(
pinger_t
*
)
handle
->
data
;
ASSERT
(
NUM_PINGS
==
pinger
->
pongs
);
ASSERT
_EQ
(
NUM_PINGS
,
pinger
->
pongs
);
free
(
pinger
);
if
(
handle
==
(
uv_handle_t
*
)
&
pinger
->
stream
.
tcp
)
{
free
(
pinger
);
/* also frees handle */
}
else
{
uv_close
((
uv_handle_t
*
)
&
pinger
->
stream
.
tcp
,
ponger_on_close
);
free
(
handle
);
}
completed_pingers
++
;
completed_pingers
++
;
}
}
static
void
pinger_after_write
(
uv_write_t
*
req
,
int
status
)
{
static
void
pinger_after_write
(
uv_write_t
*
req
,
int
status
)
{
ASSERT
(
status
==
0
);
ASSERT
_EQ
(
status
,
0
);
free
(
req
);
free
(
req
);
}
}
static
void
pinger_write_ping
(
pinger_t
*
pinger
)
{
static
void
pinger_write_ping
(
pinger_t
*
pinger
)
{
uv_stream_t
*
stream
;
uv_write_t
*
req
;
uv_write_t
*
req
;
uv_buf_t
bufs
[
sizeof
PING
-
1
];
uv_buf_t
bufs
[
sizeof
PING
-
1
];
int
i
,
nbufs
;
int
i
,
nbufs
;
stream
=
(
uv_stream_t
*
)
&
pinger
->
stream
.
tcp
;
if
(
!
pinger
->
vectored_writes
)
{
if
(
!
pinger
->
vectored_writes
)
{
/* Write a single buffer. */
/* Write a single buffer. */
nbufs
=
1
;
nbufs
=
1
;
...
@@ -94,13 +109,8 @@ static void pinger_write_ping(pinger_t* pinger) {
...
@@ -94,13 +109,8 @@ static void pinger_write_ping(pinger_t* pinger) {
}
}
req
=
malloc
(
sizeof
(
*
req
));
req
=
malloc
(
sizeof
(
*
req
));
if
(
uv_write
(
req
,
ASSERT_NOT_NULL
(
req
);
(
uv_stream_t
*
)
&
pinger
->
stream
.
tcp
,
ASSERT_EQ
(
0
,
uv_write
(
req
,
stream
,
bufs
,
nbufs
,
pinger_after_write
));
bufs
,
nbufs
,
pinger_after_write
))
{
FATAL
(
"uv_write failed"
);
}
puts
(
"PING"
);
puts
(
"PING"
);
}
}
...
@@ -115,20 +125,20 @@ static void pinger_read_cb(uv_stream_t* stream,
...
@@ -115,20 +125,20 @@ static void pinger_read_cb(uv_stream_t* stream,
pinger
=
(
pinger_t
*
)
stream
->
data
;
pinger
=
(
pinger_t
*
)
stream
->
data
;
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
ASSERT
(
nread
==
UV_EOF
);
ASSERT
_EQ
(
nread
,
UV_EOF
);
puts
(
"got EOF"
);
puts
(
"got EOF"
);
free
(
buf
->
base
);
free
(
buf
->
base
);
uv_close
((
uv_handle_t
*
)
(
&
pinger
->
stream
.
tcp
)
,
pinger_on_close
);
uv_close
((
uv_handle_t
*
)
stream
,
pinger_on_close
);
return
;
return
;
}
}
/* Now we count the p
i
ngs */
/* Now we count the p
o
ngs */
for
(
i
=
0
;
i
<
nread
;
i
++
)
{
for
(
i
=
0
;
i
<
nread
;
i
++
)
{
ASSERT
(
buf
->
base
[
i
]
==
PING
[
pinger
->
state
]);
ASSERT
_EQ
(
buf
->
base
[
i
],
pinger
->
pong
[
pinger
->
state
]);
pinger
->
state
=
(
pinger
->
state
+
1
)
%
(
sizeof
(
PING
)
-
1
);
pinger
->
state
=
(
pinger
->
state
+
1
)
%
strlen
(
pinger
->
pong
);
if
(
pinger
->
state
!=
0
)
if
(
pinger
->
state
!=
0
)
continue
;
continue
;
...
@@ -139,7 +149,7 @@ static void pinger_read_cb(uv_stream_t* stream,
...
@@ -139,7 +149,7 @@ static void pinger_read_cb(uv_stream_t* stream,
if
(
pinger
->
pongs
<
NUM_PINGS
)
{
if
(
pinger
->
pongs
<
NUM_PINGS
)
{
pinger_write_ping
(
pinger
);
pinger_write_ping
(
pinger
);
}
else
{
}
else
{
uv_close
((
uv_handle_t
*
)
(
&
pinger
->
stream
.
tcp
)
,
pinger_on_close
);
uv_close
((
uv_handle_t
*
)
stream
,
pinger_on_close
);
break
;
break
;
}
}
}
}
...
@@ -148,20 +158,53 @@ static void pinger_read_cb(uv_stream_t* stream,
...
@@ -148,20 +158,53 @@ static void pinger_read_cb(uv_stream_t* stream,
}
}
static
void
ponger_read_cb
(
uv_stream_t
*
stream
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
uv_buf_t
writebuf
;
uv_write_t
*
req
;
int
i
;
if
(
nread
<
0
)
{
ASSERT_EQ
(
nread
,
UV_EOF
);
puts
(
"got EOF"
);
free
(
buf
->
base
);
uv_close
((
uv_handle_t
*
)
stream
,
ponger_on_close
);
return
;
}
/* Echo back */
for
(
i
=
0
;
i
<
nread
;
i
++
)
{
if
(
buf
->
base
[
i
]
==
'I'
)
buf
->
base
[
i
]
=
'O'
;
}
writebuf
=
uv_buf_init
(
buf
->
base
,
nread
);
req
=
malloc
(
sizeof
(
*
req
));
ASSERT_NOT_NULL
(
req
);
ASSERT_EQ
(
0
,
uv_write
(
req
,
stream
,
&
writebuf
,
1
,
pinger_after_write
));
}
static
void
pinger_on_connect
(
uv_connect_t
*
req
,
int
status
)
{
static
void
pinger_on_connect
(
uv_connect_t
*
req
,
int
status
)
{
pinger_t
*
pinger
=
(
pinger_t
*
)
req
->
handle
->
data
;
pinger_t
*
pinger
=
(
pinger_t
*
)
req
->
handle
->
data
;
pinger_on_connect_count
++
;
pinger_on_connect_count
++
;
ASSERT
(
status
==
0
);
ASSERT
_EQ
(
status
,
0
);
ASSERT
(
1
==
uv_is_readable
(
req
->
handle
));
ASSERT
_EQ
(
1
,
uv_is_readable
(
req
->
handle
));
ASSERT
(
1
==
uv_is_writable
(
req
->
handle
));
ASSERT
_EQ
(
1
,
uv_is_writable
(
req
->
handle
));
ASSERT
(
0
==
uv_is_closing
((
uv_handle_t
*
)
req
->
handle
));
ASSERT
_EQ
(
0
,
uv_is_closing
((
uv_handle_t
*
)
req
->
handle
));
pinger_write_ping
(
pinger
);
pinger_write_ping
(
pinger
);
uv_read_start
((
uv_stream_t
*
)(
req
->
handle
),
alloc_cb
,
pinger_read_cb
);
ASSERT_EQ
(
0
,
uv_read_start
((
uv_stream_t
*
)
req
->
handle
,
alloc_cb
,
pinger_read_cb
));
}
}
...
@@ -172,17 +215,18 @@ static void tcp_pinger_v6_new(int vectored_writes) {
...
@@ -172,17 +215,18 @@ static void tcp_pinger_v6_new(int vectored_writes) {
pinger_t
*
pinger
;
pinger_t
*
pinger
;
ASSERT
(
0
==
uv_ip6_addr
(
"::1"
,
TEST_PORT
,
&
server_addr
));
ASSERT
_EQ
(
0
,
uv_ip6_addr
(
"::1"
,
TEST_PORT
,
&
server_addr
));
pinger
=
malloc
(
sizeof
(
*
pinger
));
pinger
=
malloc
(
sizeof
(
*
pinger
));
ASSERT
(
pinger
!=
NULL
);
ASSERT
_NOT_NULL
(
pinger
);
pinger
->
vectored_writes
=
vectored_writes
;
pinger
->
vectored_writes
=
vectored_writes
;
pinger
->
state
=
0
;
pinger
->
state
=
0
;
pinger
->
pongs
=
0
;
pinger
->
pongs
=
0
;
pinger
->
pong
=
PING
;
/* Try to connect to the server and do NUM_PINGS ping-pongs. */
/* Try to connect to the server and do NUM_PINGS ping-pongs. */
r
=
uv_tcp_init
(
uv_default_loop
(),
&
pinger
->
stream
.
tcp
);
r
=
uv_tcp_init
(
uv_default_loop
(),
&
pinger
->
stream
.
tcp
);
pinger
->
stream
.
tcp
.
data
=
pinger
;
pinger
->
stream
.
tcp
.
data
=
pinger
;
ASSERT
(
!
r
);
ASSERT
_EQ
(
0
,
r
);
/* We are never doing multiple reads/connects at a time anyway, so these
/* We are never doing multiple reads/connects at a time anyway, so these
* handles can be pre-initialized. */
* handles can be pre-initialized. */
...
@@ -190,10 +234,10 @@ static void tcp_pinger_v6_new(int vectored_writes) {
...
@@ -190,10 +234,10 @@ static void tcp_pinger_v6_new(int vectored_writes) {
&
pinger
->
stream
.
tcp
,
&
pinger
->
stream
.
tcp
,
(
const
struct
sockaddr
*
)
&
server_addr
,
(
const
struct
sockaddr
*
)
&
server_addr
,
pinger_on_connect
);
pinger_on_connect
);
ASSERT
(
!
r
);
ASSERT
_EQ
(
0
,
r
);
/* Synchronous connect callbacks are not allowed. */
/* Synchronous connect callbacks are not allowed. */
ASSERT
(
pinger_on_connect_count
==
0
);
ASSERT
_EQ
(
pinger_on_connect_count
,
0
);
}
}
...
@@ -202,17 +246,18 @@ static void tcp_pinger_new(int vectored_writes) {
...
@@ -202,17 +246,18 @@ static void tcp_pinger_new(int vectored_writes) {
struct
sockaddr_in
server_addr
;
struct
sockaddr_in
server_addr
;
pinger_t
*
pinger
;
pinger_t
*
pinger
;
ASSERT
(
0
==
uv_ip4_addr
(
"127.0.0.1"
,
TEST_PORT
,
&
server_addr
));
ASSERT
_EQ
(
0
,
uv_ip4_addr
(
"127.0.0.1"
,
TEST_PORT
,
&
server_addr
));
pinger
=
malloc
(
sizeof
(
*
pinger
));
pinger
=
malloc
(
sizeof
(
*
pinger
));
ASSERT
(
pinger
!=
NULL
);
ASSERT
_NOT_NULL
(
pinger
);
pinger
->
vectored_writes
=
vectored_writes
;
pinger
->
vectored_writes
=
vectored_writes
;
pinger
->
state
=
0
;
pinger
->
state
=
0
;
pinger
->
pongs
=
0
;
pinger
->
pongs
=
0
;
pinger
->
pong
=
PING
;
/* Try to connect to the server and do NUM_PINGS ping-pongs. */
/* Try to connect to the server and do NUM_PINGS ping-pongs. */
r
=
uv_tcp_init
(
uv_default_loop
(),
&
pinger
->
stream
.
tcp
);
r
=
uv_tcp_init
(
uv_default_loop
(),
&
pinger
->
stream
.
tcp
);
pinger
->
stream
.
tcp
.
data
=
pinger
;
pinger
->
stream
.
tcp
.
data
=
pinger
;
ASSERT
(
!
r
);
ASSERT
_EQ
(
0
,
r
);
/* We are never doing multiple reads/connects at a time anyway, so these
/* We are never doing multiple reads/connects at a time anyway, so these
* handles can be pre-initialized. */
* handles can be pre-initialized. */
...
@@ -220,10 +265,10 @@ static void tcp_pinger_new(int vectored_writes) {
...
@@ -220,10 +265,10 @@ static void tcp_pinger_new(int vectored_writes) {
&
pinger
->
stream
.
tcp
,
&
pinger
->
stream
.
tcp
,
(
const
struct
sockaddr
*
)
&
server_addr
,
(
const
struct
sockaddr
*
)
&
server_addr
,
pinger_on_connect
);
pinger_on_connect
);
ASSERT
(
!
r
);
ASSERT
_EQ
(
0
,
r
);
/* Synchronous connect callbacks are not allowed. */
/* Synchronous connect callbacks are not allowed. */
ASSERT
(
pinger_on_connect_count
==
0
);
ASSERT
_EQ
(
pinger_on_connect_count
,
0
);
}
}
...
@@ -232,15 +277,16 @@ static void pipe_pinger_new(int vectored_writes) {
...
@@ -232,15 +277,16 @@ static void pipe_pinger_new(int vectored_writes) {
pinger_t
*
pinger
;
pinger_t
*
pinger
;
pinger
=
malloc
(
sizeof
(
*
pinger
));
pinger
=
malloc
(
sizeof
(
*
pinger
));
ASSERT
(
pinger
!=
NULL
);
ASSERT
_NOT_NULL
(
pinger
);
pinger
->
vectored_writes
=
vectored_writes
;
pinger
->
vectored_writes
=
vectored_writes
;
pinger
->
state
=
0
;
pinger
->
state
=
0
;
pinger
->
pongs
=
0
;
pinger
->
pongs
=
0
;
pinger
->
pong
=
PING
;
/* Try to connect to the server and do NUM_PINGS ping-pongs. */
/* Try to connect to the server and do NUM_PINGS ping-pongs. */
r
=
uv_pipe_init
(
uv_default_loop
(),
&
pinger
->
stream
.
pipe
,
0
);
r
=
uv_pipe_init
(
uv_default_loop
(),
&
pinger
->
stream
.
pipe
,
0
);
pinger
->
stream
.
pipe
.
data
=
pinger
;
pinger
->
stream
.
pipe
.
data
=
pinger
;
ASSERT
(
!
r
);
ASSERT
_EQ
(
0
,
r
);
/* We are never doing multiple reads/connects at a time anyway, so these
/* We are never doing multiple reads/connects at a time anyway, so these
* handles can be pre-initialized. */
* handles can be pre-initialized. */
...
@@ -248,13 +294,86 @@ static void pipe_pinger_new(int vectored_writes) {
...
@@ -248,13 +294,86 @@ static void pipe_pinger_new(int vectored_writes) {
pinger_on_connect
);
pinger_on_connect
);
/* Synchronous connect callbacks are not allowed. */
/* Synchronous connect callbacks are not allowed. */
ASSERT
(
pinger_on_connect_count
==
0
);
ASSERT
_EQ
(
pinger_on_connect_count
,
0
);
}
}
static
void
socketpair_pinger_new
(
int
vectored_writes
)
{
pinger_t
*
pinger
;
uv_os_sock_t
fds
[
2
];
uv_tcp_t
*
ponger
;
pinger
=
malloc
(
sizeof
(
*
pinger
));
ASSERT_NOT_NULL
(
pinger
);
pinger
->
vectored_writes
=
vectored_writes
;
pinger
->
state
=
0
;
pinger
->
pongs
=
0
;
pinger
->
pong
=
PONG
;
/* Try to make a socketpair and do NUM_PINGS ping-pongs. */
(
void
)
uv_default_loop
();
/* ensure WSAStartup has been performed */
ASSERT_EQ
(
0
,
uv_socketpair
(
SOCK_STREAM
,
0
,
fds
,
UV_NONBLOCK_PIPE
,
UV_NONBLOCK_PIPE
));
#ifndef _WIN32
/* On Windows, this is actually a UV_TCP, but libuv doesn't detect that. */
ASSERT_EQ
(
uv_guess_handle
((
uv_file
)
fds
[
0
]),
UV_NAMED_PIPE
);
ASSERT_EQ
(
uv_guess_handle
((
uv_file
)
fds
[
1
]),
UV_NAMED_PIPE
);
#endif
ASSERT_EQ
(
0
,
uv_tcp_init
(
uv_default_loop
(),
&
pinger
->
stream
.
tcp
));
pinger
->
stream
.
pipe
.
data
=
pinger
;
ASSERT_EQ
(
0
,
uv_tcp_open
(
&
pinger
->
stream
.
tcp
,
fds
[
1
]));
ponger
=
malloc
(
sizeof
(
*
ponger
));
ASSERT_NOT_NULL
(
ponger
);
ponger
->
data
=
NULL
;
ASSERT_EQ
(
0
,
uv_tcp_init
(
uv_default_loop
(),
ponger
));
ASSERT_EQ
(
0
,
uv_tcp_open
(
ponger
,
fds
[
0
]));
pinger_write_ping
(
pinger
);
ASSERT_EQ
(
0
,
uv_read_start
((
uv_stream_t
*
)
&
pinger
->
stream
.
tcp
,
alloc_cb
,
pinger_read_cb
));
ASSERT_EQ
(
0
,
uv_read_start
((
uv_stream_t
*
)
ponger
,
alloc_cb
,
ponger_read_cb
));
}
static
void
pipe2_pinger_new
(
int
vectored_writes
)
{
uv_file
fds
[
2
];
pinger_t
*
pinger
;
uv_pipe_t
*
ponger
;
/* Try to make a pipe and do NUM_PINGS pings. */
ASSERT_EQ
(
0
,
uv_pipe
(
fds
,
UV_NONBLOCK_PIPE
,
UV_NONBLOCK_PIPE
));
ASSERT_EQ
(
uv_guess_handle
(
fds
[
0
]),
UV_NAMED_PIPE
);
ASSERT_EQ
(
uv_guess_handle
(
fds
[
1
]),
UV_NAMED_PIPE
);
ponger
=
malloc
(
sizeof
(
*
ponger
));
ASSERT_NOT_NULL
(
ponger
);
ASSERT_EQ
(
0
,
uv_pipe_init
(
uv_default_loop
(),
ponger
,
0
));
ASSERT_EQ
(
0
,
uv_pipe_open
(
ponger
,
fds
[
0
]));
pinger
=
malloc
(
sizeof
(
*
pinger
));
ASSERT_NOT_NULL
(
pinger
);
pinger
->
vectored_writes
=
vectored_writes
;
pinger
->
state
=
0
;
pinger
->
pongs
=
0
;
pinger
->
pong
=
PING
;
ASSERT_EQ
(
0
,
uv_pipe_init
(
uv_default_loop
(),
&
pinger
->
stream
.
pipe
,
0
));
ASSERT_EQ
(
0
,
uv_pipe_open
(
&
pinger
->
stream
.
pipe
,
fds
[
1
]));
pinger
->
stream
.
pipe
.
data
=
pinger
;
/* record for close_cb */
ponger
->
data
=
pinger
;
/* record for read_cb */
pinger_write_ping
(
pinger
);
ASSERT_EQ
(
0
,
uv_read_start
((
uv_stream_t
*
)
ponger
,
alloc_cb
,
pinger_read_cb
));
}
static
int
run_ping_pong_test
(
void
)
{
static
int
run_ping_pong_test
(
void
)
{
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
);
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
);
ASSERT
(
completed_pingers
==
1
);
ASSERT
_EQ
(
completed_pingers
,
1
);
MAKE_VALGRIND_HAPPY
();
MAKE_VALGRIND_HAPPY
();
return
0
;
return
0
;
...
@@ -263,12 +382,20 @@ static int run_ping_pong_test(void) {
...
@@ -263,12 +382,20 @@ static int run_ping_pong_test(void) {
TEST_IMPL
(
tcp_ping_pong
)
{
TEST_IMPL
(
tcp_ping_pong
)
{
tcp_pinger_new
(
0
);
tcp_pinger_new
(
0
);
run_ping_pong_test
();
completed_pingers
=
0
;
socketpair_pinger_new
(
0
);
return
run_ping_pong_test
();
return
run_ping_pong_test
();
}
}
TEST_IMPL
(
tcp_ping_pong_vec
)
{
TEST_IMPL
(
tcp_ping_pong_vec
)
{
tcp_pinger_new
(
1
);
tcp_pinger_new
(
1
);
run_ping_pong_test
();
completed_pingers
=
0
;
socketpair_pinger_new
(
1
);
return
run_ping_pong_test
();
return
run_ping_pong_test
();
}
}
...
@@ -291,11 +418,19 @@ TEST_IMPL(tcp6_ping_pong_vec) {
...
@@ -291,11 +418,19 @@ TEST_IMPL(tcp6_ping_pong_vec) {
TEST_IMPL
(
pipe_ping_pong
)
{
TEST_IMPL
(
pipe_ping_pong
)
{
pipe_pinger_new
(
0
);
pipe_pinger_new
(
0
);
run_ping_pong_test
();
completed_pingers
=
0
;
pipe2_pinger_new
(
0
);
return
run_ping_pong_test
();
return
run_ping_pong_test
();
}
}
TEST_IMPL
(
pipe_ping_pong_vec
)
{
TEST_IMPL
(
pipe_ping_pong_vec
)
{
pipe_pinger_new
(
1
);
pipe_pinger_new
(
1
);
run_ping_pong_test
();
completed_pingers
=
0
;
pipe2_pinger_new
(
1
);
return
run_ping_pong_test
();
return
run_ping_pong_test
();
}
}
worker/deps/libuv/libuv/test/test-pipe-connect-error.c
浏览文件 @
edde98d7
...
@@ -76,6 +76,9 @@ TEST_IMPL(pipe_connect_bad_name) {
...
@@ -76,6 +76,9 @@ TEST_IMPL(pipe_connect_bad_name) {
TEST_IMPL
(
pipe_connect_to_file
)
{
TEST_IMPL
(
pipe_connect_to_file
)
{
#if defined(__ASAN__)
RETURN_SKIP
(
"Test does not currently work in ASAN"
);
#endif
const
char
*
path
=
"test/fixtures/empty_file"
;
const
char
*
path
=
"test/fixtures/empty_file"
;
uv_pipe_t
client
;
uv_pipe_t
client
;
uv_connect_t
req
;
uv_connect_t
req
;
...
...
worker/deps/libuv/libuv/test/test-pipe-getsockname.c
浏览文件 @
edde98d7
...
@@ -225,7 +225,9 @@ TEST_IMPL(pipe_getsockname_blocking) {
...
@@ -225,7 +225,9 @@ TEST_IMPL(pipe_getsockname_blocking) {
ASSERT
(
r
!=
-
1
);
ASSERT
(
r
!=
-
1
);
r
=
uv_pipe_open
(
&
pipe_client
,
readfd
);
r
=
uv_pipe_open
(
&
pipe_client
,
readfd
);
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
r
=
uv_read_start
((
uv_stream_t
*
)
&
pipe_client
,
NULL
,
NULL
);
r
=
uv_read_start
((
uv_stream_t
*
)
&
pipe_client
,
(
uv_alloc_cb
)
abort
,
(
uv_read_cb
)
abort
);
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
Sleep
(
100
);
Sleep
(
100
);
r
=
uv_read_stop
((
uv_stream_t
*
)
&
pipe_client
);
r
=
uv_read_stop
((
uv_stream_t
*
)
&
pipe_client
);
...
@@ -236,7 +238,9 @@ TEST_IMPL(pipe_getsockname_blocking) {
...
@@ -236,7 +238,9 @@ TEST_IMPL(pipe_getsockname_blocking) {
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
ASSERT
(
len1
==
0
);
/* It's an annonymous pipe. */
ASSERT
(
len1
==
0
);
/* It's an annonymous pipe. */
r
=
uv_read_start
((
uv_stream_t
*
)
&
pipe_client
,
NULL
,
NULL
);
r
=
uv_read_start
((
uv_stream_t
*
)
&
pipe_client
,
(
uv_alloc_cb
)
abort
,
(
uv_read_cb
)
abort
);
ASSERT
(
r
==
0
);
ASSERT
(
r
==
0
);
Sleep
(
100
);
Sleep
(
100
);
...
...
worker/deps/libuv/libuv/test/test-pipe-set-non-blocking.c
浏览文件 @
edde98d7
...
@@ -16,18 +16,10 @@
...
@@ -16,18 +16,10 @@
#include "uv.h"
#include "uv.h"
#include "task.h"
#include "task.h"
#ifdef _WIN32
TEST_IMPL
(
pipe_set_non_blocking
)
{
RETURN_SKIP
(
"Test not implemented on Windows."
);
}
#else
/* !_WIN32 */
#include <string.h>
/* memset */
#include <string.h>
/* memset */
#ifndef _WIN32
#include <unistd.h>
/* close */
#include <unistd.h>
/* close */
#include <sys/types.h>
#endif
#include <sys/socket.h>
struct
thread_ctx
{
struct
thread_ctx
{
uv_barrier_t
barrier
;
uv_barrier_t
barrier
;
...
@@ -54,8 +46,27 @@ static void thread_main(void* arg) {
...
@@ -54,8 +46,27 @@ static void thread_main(void* arg) {
uv_fs_req_cleanup
(
&
req
);
uv_fs_req_cleanup
(
&
req
);
}
while
(
n
>
0
||
(
n
==
-
1
&&
uv_errno
==
UV_EINTR
));
}
while
(
n
>
0
||
(
n
==
-
1
&&
uv_errno
==
UV_EINTR
));
#ifdef _WIN32
ASSERT
(
n
==
UV_EOF
);
#else
ASSERT
(
n
==
0
);
ASSERT
(
n
==
0
);
#endif
}
#ifdef _WIN32
static
void
write_cb
(
uv_write_t
*
req
,
int
status
)
{
ASSERT
(
status
==
0
);
req
->
handle
=
NULL
;
/* signal completion of write_cb */
}
}
#endif
#ifdef _WIN32
#define NWRITES (10 << 16)
#else
#define NWRITES (10 << 20)
#endif
TEST_IMPL
(
pipe_set_non_blocking
)
{
TEST_IMPL
(
pipe_set_non_blocking
)
{
struct
thread_ctx
ctx
;
struct
thread_ctx
ctx
;
...
@@ -66,9 +77,12 @@ TEST_IMPL(pipe_set_non_blocking) {
...
@@ -66,9 +77,12 @@ TEST_IMPL(pipe_set_non_blocking) {
uv_buf_t
buf
;
uv_buf_t
buf
;
uv_file
fd
[
2
];
uv_file
fd
[
2
];
int
n
;
int
n
;
#ifdef _WIN32
uv_write_t
write_req
;
#endif
ASSERT
(
0
==
uv_pipe_init
(
uv_default_loop
(),
&
pipe_handle
,
0
));
ASSERT
(
0
==
uv_pipe_init
(
uv_default_loop
(),
&
pipe_handle
,
0
));
ASSERT
(
0
==
socketpair
(
AF_UNIX
,
SOCK_STREAM
,
0
,
fd
));
ASSERT
(
0
==
uv_pipe
(
fd
,
0
,
0
));
ASSERT
(
0
==
uv_pipe_open
(
&
pipe_handle
,
fd
[
1
]));
ASSERT
(
0
==
uv_pipe_open
(
&
pipe_handle
,
fd
[
1
]));
ASSERT
(
0
==
uv_stream_set_blocking
((
uv_stream_t
*
)
&
pipe_handle
,
1
));
ASSERT
(
0
==
uv_stream_set_blocking
((
uv_stream_t
*
)
&
pipe_handle
,
1
));
fd
[
1
]
=
-
1
;
/* fd[1] is owned by pipe_handle now. */
fd
[
1
]
=
-
1
;
/* fd[1] is owned by pipe_handle now. */
...
@@ -83,11 +97,20 @@ TEST_IMPL(pipe_set_non_blocking) {
...
@@ -83,11 +97,20 @@ TEST_IMPL(pipe_set_non_blocking) {
memset
(
data
,
'.'
,
sizeof
(
data
));
memset
(
data
,
'.'
,
sizeof
(
data
));
nwritten
=
0
;
nwritten
=
0
;
while
(
nwritten
<
10
<<
20
)
{
while
(
nwritten
<
NWRITES
)
{
/* The stream is in blocking mode so uv_try_write() should always succeed
/* The stream is in blocking mode so uv_try_write() should always succeed
* with the exact number of bytes that we wanted written.
* with the exact number of bytes that we wanted written.
*/
*/
n
=
uv_try_write
((
uv_stream_t
*
)
&
pipe_handle
,
&
buf
,
1
);
n
=
uv_try_write
((
uv_stream_t
*
)
&
pipe_handle
,
&
buf
,
1
);
#ifdef _WIN32
ASSERT
(
n
==
UV_EAGAIN
);
/* E_NOTIMPL */
ASSERT
(
0
==
uv_write
(
&
write_req
,
(
uv_stream_t
*
)
&
pipe_handle
,
&
buf
,
1
,
write_cb
));
ASSERT
(
write_req
.
handle
!=
NULL
);
ASSERT
(
1
==
uv_run
(
uv_default_loop
(),
UV_RUN_ONCE
));
/* queue write_cb */
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_ONCE
));
/* process write_cb */
ASSERT
(
write_req
.
handle
==
NULL
);
/* check for signaled completion of write_cb */
n
=
buf
.
len
;
#endif
ASSERT
(
n
==
sizeof
(
data
));
ASSERT
(
n
==
sizeof
(
data
));
nwritten
+=
n
;
nwritten
+=
n
;
}
}
...
@@ -96,12 +119,14 @@ TEST_IMPL(pipe_set_non_blocking) {
...
@@ -96,12 +119,14 @@ TEST_IMPL(pipe_set_non_blocking) {
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
0
==
uv_thread_join
(
&
thread
));
ASSERT
(
0
==
uv_thread_join
(
&
thread
));
#ifdef _WIN32
ASSERT
(
0
==
_close
(
fd
[
0
]));
/* fd[1] is closed by uv_close(). */
#else
ASSERT
(
0
==
close
(
fd
[
0
]));
/* fd[1] is closed by uv_close(). */
ASSERT
(
0
==
close
(
fd
[
0
]));
/* fd[1] is closed by uv_close(). */
#endif
fd
[
0
]
=
-
1
;
fd
[
0
]
=
-
1
;
uv_barrier_destroy
(
&
ctx
.
barrier
);
uv_barrier_destroy
(
&
ctx
.
barrier
);
MAKE_VALGRIND_HAPPY
();
MAKE_VALGRIND_HAPPY
();
return
0
;
return
0
;
}
}
#endif
/* !_WIN32 */
worker/deps/libuv/libuv/test/test-platform-output.c
浏览文件 @
edde98d7
...
@@ -155,6 +155,7 @@ TEST_IMPL(platform_output) {
...
@@ -155,6 +155,7 @@ TEST_IMPL(platform_output) {
printf
(
" username: %s
\n
"
,
pwd
.
username
);
printf
(
" username: %s
\n
"
,
pwd
.
username
);
printf
(
" shell: %s
\n
"
,
pwd
.
shell
);
printf
(
" shell: %s
\n
"
,
pwd
.
shell
);
printf
(
" home directory: %s
\n
"
,
pwd
.
homedir
);
printf
(
" home directory: %s
\n
"
,
pwd
.
homedir
);
uv_os_free_passwd
(
&
pwd
);
pid
=
uv_os_getpid
();
pid
=
uv_os_getpid
();
ASSERT
(
pid
>
0
);
ASSERT
(
pid
>
0
);
...
...
worker/deps/libuv/libuv/test/test-poll-multiple-handles.c
0 → 100644
浏览文件 @
edde98d7
/* Copyright libuv project contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <errno.h>
#ifndef _WIN32
# include <fcntl.h>
# include <sys/socket.h>
# include <unistd.h>
#endif
#include "uv.h"
#include "task.h"
static
int
close_cb_called
=
0
;
static
void
close_cb
(
uv_handle_t
*
handle
)
{
close_cb_called
++
;
}
static
void
poll_cb
(
uv_poll_t
*
handle
,
int
status
,
int
events
)
{
/* Not a bound socket, linux immediately reports UV_READABLE, other OS do not */
ASSERT
(
events
==
UV_READABLE
);
}
TEST_IMPL
(
poll_multiple_handles
)
{
uv_os_sock_t
sock
;
uv_poll_t
first_poll_handle
,
second_poll_handle
;
#ifdef _WIN32
{
struct
WSAData
wsa_data
;
int
r
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
wsa_data
);
ASSERT
(
r
==
0
);
}
#endif
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
#ifdef _WIN32
ASSERT
(
sock
!=
INVALID_SOCKET
);
#else
ASSERT
(
sock
!=
-
1
);
#endif
ASSERT
(
0
==
uv_poll_init_socket
(
uv_default_loop
(),
&
first_poll_handle
,
sock
));
ASSERT
(
0
==
uv_poll_init_socket
(
uv_default_loop
(),
&
second_poll_handle
,
sock
));
ASSERT
(
0
==
uv_poll_start
(
&
first_poll_handle
,
UV_READABLE
,
poll_cb
));
/* We may not start polling while another polling handle is active
* on that fd.
*/
#ifndef _WIN32
/* We do not track handles in an O(1) lookupable way on Windows,
* so not checking that here.
*/
ASSERT
(
uv_poll_start
(
&
second_poll_handle
,
UV_READABLE
,
poll_cb
)
==
UV_EEXIST
);
#endif
/* After stopping the other polling handle, we now should be able to poll */
ASSERT
(
0
==
uv_poll_stop
(
&
first_poll_handle
));
ASSERT
(
0
==
uv_poll_start
(
&
second_poll_handle
,
UV_READABLE
,
poll_cb
));
/* Closing an already stopped polling handle is safe in any case */
uv_close
((
uv_handle_t
*
)
&
first_poll_handle
,
close_cb
);
uv_unref
((
uv_handle_t
*
)
&
second_poll_handle
);
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
close_cb_called
==
1
);
uv_ref
((
uv_handle_t
*
)
&
second_poll_handle
);
ASSERT
(
uv_is_active
((
uv_handle_t
*
)
&
second_poll_handle
));
uv_close
((
uv_handle_t
*
)
&
second_poll_handle
,
close_cb
);
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
close_cb_called
==
2
);
MAKE_VALGRIND_HAPPY
();
return
0
;
}
worker/deps/libuv/libuv/test/test-shutdown-eof.c
浏览文件 @
edde98d7
...
@@ -89,7 +89,13 @@ static void connect_cb(uv_connect_t *req, int status) {
...
@@ -89,7 +89,13 @@ static void connect_cb(uv_connect_t *req, int status) {
ASSERT
(
req
==
&
connect_req
);
ASSERT
(
req
==
&
connect_req
);
/* Start reading from our connection so we can receive the EOF. */
/* Start reading from our connection so we can receive the EOF. */
uv_read_start
((
uv_stream_t
*
)
&
tcp
,
alloc_cb
,
read_cb
);
ASSERT_EQ
(
0
,
uv_read_start
((
uv_stream_t
*
)
&
tcp
,
alloc_cb
,
read_cb
));
/* Check error handling. */
ASSERT_EQ
(
UV_EALREADY
,
uv_read_start
((
uv_stream_t
*
)
&
tcp
,
alloc_cb
,
read_cb
));
ASSERT_EQ
(
UV_EINVAL
,
uv_read_start
(
NULL
,
alloc_cb
,
read_cb
));
ASSERT_EQ
(
UV_EINVAL
,
uv_read_start
((
uv_stream_t
*
)
&
tcp
,
NULL
,
read_cb
));
ASSERT_EQ
(
UV_EINVAL
,
uv_read_start
((
uv_stream_t
*
)
&
tcp
,
alloc_cb
,
NULL
));
/*
/*
* Write the letter 'Q' to gracefully kill the echo-server. This will not
* Write the letter 'Q' to gracefully kill the echo-server. This will not
...
...
worker/deps/libuv/libuv/test/test-spawn.c
浏览文件 @
edde98d7
...
@@ -29,11 +29,9 @@
...
@@ -29,11 +29,9 @@
#include <string.h>
#include <string.h>
#ifdef _WIN32
#ifdef _WIN32
# if defined(__MINGW32__)
# include <basetyps.h>
# endif
# include <shellapi.h>
# include <shellapi.h>
# include <wchar.h>
# include <wchar.h>
typedef
BOOL
(
WINAPI
*
sCompareObjectHandles
)(
_In_
HANDLE
,
_In_
HANDLE
);
#else
#else
# include <unistd.h>
# include <unistd.h>
# include <sys/wait.h>
# include <sys/wait.h>
...
@@ -49,9 +47,7 @@ static char exepath[1024];
...
@@ -49,9 +47,7 @@ static char exepath[1024];
static
size_t
exepath_size
=
1024
;
static
size_t
exepath_size
=
1024
;
static
char
*
args
[
5
];
static
char
*
args
[
5
];
static
int
no_term_signal
;
static
int
no_term_signal
;
#ifndef _WIN32
static
int
timer_counter
;
static
int
timer_counter
;
#endif
static
uv_tcp_t
tcp_server
;
static
uv_tcp_t
tcp_server
;
#define OUTPUT_SIZE 1024
#define OUTPUT_SIZE 1024
...
@@ -140,12 +136,10 @@ static void on_read(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) {
...
@@ -140,12 +136,10 @@ static void on_read(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) {
}
}
#ifndef _WIN32
static
void
on_read_once
(
uv_stream_t
*
tcp
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
static
void
on_read_once
(
uv_stream_t
*
tcp
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
uv_read_stop
(
tcp
);
uv_read_stop
(
tcp
);
on_read
(
tcp
,
nread
,
buf
);
on_read
(
tcp
,
nread
,
buf
);
}
}
#endif
static
void
write_cb
(
uv_write_t
*
req
,
int
status
)
{
static
void
write_cb
(
uv_write_t
*
req
,
int
status
)
{
...
@@ -154,6 +148,11 @@ static void write_cb(uv_write_t* req, int status) {
...
@@ -154,6 +148,11 @@ static void write_cb(uv_write_t* req, int status) {
}
}
static
void
write_null_cb
(
uv_write_t
*
req
,
int
status
)
{
ASSERT
(
status
==
0
);
}
static
void
init_process_options
(
char
*
test
,
uv_exit_cb
exit_cb
)
{
static
void
init_process_options
(
char
*
test
,
uv_exit_cb
exit_cb
)
{
/* Note spawn_helper1 defined in test/run-tests.c */
/* Note spawn_helper1 defined in test/run-tests.c */
int
r
=
uv_exepath
(
exepath
,
&
exepath_size
);
int
r
=
uv_exepath
(
exepath
,
&
exepath_size
);
...
@@ -177,11 +176,9 @@ static void timer_cb(uv_timer_t* handle) {
...
@@ -177,11 +176,9 @@ static void timer_cb(uv_timer_t* handle) {
}
}
#ifndef _WIN32
static
void
timer_counter_cb
(
uv_timer_t
*
handle
)
{
static
void
timer_counter_cb
(
uv_timer_t
*
handle
)
{
++
timer_counter
;
++
timer_counter
;
}
}
#endif
TEST_IMPL
(
spawn_fails
)
{
TEST_IMPL
(
spawn_fails
)
{
...
@@ -1328,9 +1325,8 @@ TEST_IMPL(environment_creation) {
...
@@ -1328,9 +1325,8 @@ TEST_IMPL(environment_creation) {
found
=
1
;
found
=
1
;
}
}
}
}
if
(
prev
)
{
/* verify sort order -- requires Vista */
if
(
prev
)
{
/* verify sort order */
#if _WIN32_WINNT >= 0x0600 && \
#if !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
(!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR))
ASSERT
(
CompareStringOrdinal
(
prev
,
-
1
,
str
,
-
1
,
TRUE
)
==
1
);
ASSERT
(
CompareStringOrdinal
(
prev
,
-
1
,
str
,
-
1
,
TRUE
)
==
1
);
#endif
#endif
}
}
...
@@ -1579,17 +1575,27 @@ TEST_IMPL(spawn_auto_unref) {
...
@@ -1579,17 +1575,27 @@ TEST_IMPL(spawn_auto_unref) {
}
}
#ifndef _WIN32
TEST_IMPL
(
spawn_fs_open
)
{
TEST_IMPL
(
spawn_fs_open
)
{
int
fd
;
int
r
;
uv_os_fd_t
fd
;
uv_os_fd_t
dup_fd
;
uv_fs_t
fs_req
;
uv_fs_t
fs_req
;
uv_pipe_t
in
;
uv_pipe_t
in
;
uv_write_t
write_req
;
uv_write_t
write_req
;
uv_write_t
write_req2
;
uv_buf_t
buf
;
uv_buf_t
buf
;
uv_stdio_container_t
stdio
[
1
];
uv_stdio_container_t
stdio
[
1
];
#ifdef _WIN32
const
char
dev_null
[]
=
"NUL"
;
HMODULE
kernelbase_module
;
sCompareObjectHandles
pCompareObjectHandles
;
/* function introduced in Windows 10 */
#else
const
char
dev_null
[]
=
"/dev/null"
;
#endif
fd
=
uv_fs_open
(
NULL
,
&
fs_req
,
"/dev/null"
,
O_RDWR
,
0
,
NULL
);
r
=
uv_fs_open
(
NULL
,
&
fs_req
,
dev_null
,
O_RDWR
,
0
,
NULL
);
ASSERT
(
fd
>=
0
);
ASSERT
(
r
!=
-
1
);
fd
=
uv_get_osfhandle
((
uv_file
)
fs_req
.
result
);
uv_fs_req_cleanup
(
&
fs_req
);
uv_fs_req_cleanup
(
&
fs_req
);
init_process_options
(
"spawn_helper8"
,
exit_cb
);
init_process_options
(
"spawn_helper8"
,
exit_cb
);
...
@@ -1601,13 +1607,28 @@ TEST_IMPL(spawn_fs_open) {
...
@@ -1601,13 +1607,28 @@ TEST_IMPL(spawn_fs_open) {
options
.
stdio
[
0
].
data
.
stream
=
(
uv_stream_t
*
)
&
in
;
options
.
stdio
[
0
].
data
.
stream
=
(
uv_stream_t
*
)
&
in
;
options
.
stdio_count
=
1
;
options
.
stdio_count
=
1
;
/* make an inheritable copy */
#ifdef _WIN32
ASSERT
(
0
!=
DuplicateHandle
(
GetCurrentProcess
(),
fd
,
GetCurrentProcess
(),
&
dup_fd
,
0
,
/* inherit */
TRUE
,
DUPLICATE_SAME_ACCESS
));
kernelbase_module
=
GetModuleHandleA
(
"kernelbase.dll"
);
pCompareObjectHandles
=
(
sCompareObjectHandles
)
GetProcAddress
(
kernelbase_module
,
"CompareObjectHandles"
);
ASSERT
(
pCompareObjectHandles
==
NULL
||
pCompareObjectHandles
(
fd
,
dup_fd
));
#else
dup_fd
=
dup
(
fd
);
#endif
ASSERT
(
0
==
uv_spawn
(
uv_default_loop
(),
&
process
,
&
options
));
ASSERT
(
0
==
uv_spawn
(
uv_default_loop
(),
&
process
,
&
options
));
buf
=
uv_buf_init
((
char
*
)
&
fd
,
sizeof
(
fd
));
buf
=
uv_buf_init
((
char
*
)
&
fd
,
sizeof
(
fd
));
ASSERT
(
0
==
uv_write
(
&
write_req
,
(
uv_stream_t
*
)
&
in
,
&
buf
,
1
,
write_cb
));
ASSERT
(
0
==
uv_write
(
&
write_req
,
(
uv_stream_t
*
)
&
in
,
&
buf
,
1
,
write_null_cb
));
buf
=
uv_buf_init
((
char
*
)
&
dup_fd
,
sizeof
(
fd
));
ASSERT
(
0
==
uv_write
(
&
write_req2
,
(
uv_stream_t
*
)
&
in
,
&
buf
,
1
,
write_cb
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
0
==
uv_fs_close
(
NULL
,
&
fs_req
,
fd
,
NULL
));
ASSERT
(
0
==
uv_fs_close
(
NULL
,
&
fs_req
,
r
,
NULL
));
ASSERT
(
exit_cb_called
==
1
);
ASSERT
(
exit_cb_called
==
1
);
ASSERT
(
close_cb_called
==
2
);
/* One for `in`, one for process */
ASSERT
(
close_cb_called
==
2
);
/* One for `in`, one for process */
...
@@ -1615,17 +1636,20 @@ TEST_IMPL(spawn_fs_open) {
...
@@ -1615,17 +1636,20 @@ TEST_IMPL(spawn_fs_open) {
MAKE_VALGRIND_HAPPY
();
MAKE_VALGRIND_HAPPY
();
return
0
;
return
0
;
}
}
#endif
/* !_WIN32 */
#ifndef _WIN32
TEST_IMPL
(
closed_fd_events
)
{
TEST_IMPL
(
closed_fd_events
)
{
uv_stdio_container_t
stdio
[
3
];
uv_stdio_container_t
stdio
[
3
];
uv_pipe_t
pipe_handle
;
uv_pipe_t
pipe_handle
;
int
fd
[
2
];
uv_fs_t
req
;
uv_buf_t
bufs
[
1
];
uv_file
fd
[
2
];
bufs
[
0
]
=
uv_buf_init
(
""
,
1
);
/* create a pipe and share it with a child process */
/* create a pipe and share it with a child process */
ASSERT
(
0
==
pipe
(
fd
));
ASSERT
(
0
==
uv_pipe
(
fd
,
0
,
0
));
ASSERT
(
fd
[
0
]
>
2
);
ASSERT
(
fd
[
1
]
>
2
);
/* spawn_helper4 blocks indefinitely. */
/* spawn_helper4 blocks indefinitely. */
init_process_options
(
"spawn_helper4"
,
exit_cb
);
init_process_options
(
"spawn_helper4"
,
exit_cb
);
...
@@ -1642,12 +1666,18 @@ TEST_IMPL(closed_fd_events) {
...
@@ -1642,12 +1666,18 @@ TEST_IMPL(closed_fd_events) {
/* read from the pipe with uv */
/* read from the pipe with uv */
ASSERT
(
0
==
uv_pipe_init
(
uv_default_loop
(),
&
pipe_handle
,
0
));
ASSERT
(
0
==
uv_pipe_init
(
uv_default_loop
(),
&
pipe_handle
,
0
));
ASSERT
(
0
==
uv_pipe_open
(
&
pipe_handle
,
fd
[
0
]));
ASSERT
(
0
==
uv_pipe_open
(
&
pipe_handle
,
fd
[
0
]));
/* uv_pipe_open() takes ownership of the file descriptor. */
fd
[
0
]
=
-
1
;
fd
[
0
]
=
-
1
;
ASSERT
(
0
==
uv_read_start
((
uv_stream_t
*
)
&
pipe_handle
,
on_alloc
,
on_read_once
));
ASSERT
(
0
==
uv_read_start
((
uv_stream_t
*
)
&
pipe_handle
,
on_alloc
,
on_read_once
));
ASSERT
(
1
==
write
(
fd
[
1
],
""
,
1
));
ASSERT
(
1
==
uv_fs_write
(
NULL
,
&
req
,
fd
[
1
],
bufs
,
1
,
-
1
,
NULL
));
ASSERT
(
req
.
result
==
1
);
uv_fs_req_cleanup
(
&
req
);
#ifdef _WIN32
ASSERT
(
1
==
uv_run
(
uv_default_loop
(),
UV_RUN_ONCE
));
#endif
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_ONCE
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_ONCE
));
/* should have received just one byte */
/* should have received just one byte */
...
@@ -1656,7 +1686,9 @@ TEST_IMPL(closed_fd_events) {
...
@@ -1656,7 +1686,9 @@ TEST_IMPL(closed_fd_events) {
/* close the pipe and see if we still get events */
/* close the pipe and see if we still get events */
uv_close
((
uv_handle_t
*
)
&
pipe_handle
,
close_cb
);
uv_close
((
uv_handle_t
*
)
&
pipe_handle
,
close_cb
);
ASSERT
(
1
==
write
(
fd
[
1
],
""
,
1
));
ASSERT
(
1
==
uv_fs_write
(
NULL
,
&
req
,
fd
[
1
],
bufs
,
1
,
-
1
,
NULL
));
ASSERT
(
req
.
result
==
1
);
uv_fs_req_cleanup
(
&
req
);
ASSERT
(
0
==
uv_timer_init
(
uv_default_loop
(),
&
timer
));
ASSERT
(
0
==
uv_timer_init
(
uv_default_loop
(),
&
timer
));
ASSERT
(
0
==
uv_timer_start
(
&
timer
,
timer_counter_cb
,
10
,
0
));
ASSERT
(
0
==
uv_timer_start
(
&
timer
,
timer_counter_cb
,
10
,
0
));
...
@@ -1669,13 +1701,17 @@ TEST_IMPL(closed_fd_events) {
...
@@ -1669,13 +1701,17 @@ TEST_IMPL(closed_fd_events) {
ASSERT
(
timer_counter
==
1
);
ASSERT
(
timer_counter
==
1
);
/* cleanup */
/* cleanup */
ASSERT
(
0
==
uv_process_kill
(
&
process
,
/* SIGTERM */
15
));
ASSERT
(
0
==
uv_process_kill
(
&
process
,
SIGTERM
));
#ifdef _WIN32
ASSERT
(
0
==
_close
(
fd
[
1
]));
#else
ASSERT
(
0
==
close
(
fd
[
1
]));
ASSERT
(
0
==
close
(
fd
[
1
]));
#endif
MAKE_VALGRIND_HAPPY
();
MAKE_VALGRIND_HAPPY
();
return
0
;
return
0
;
}
}
#endif
/* !_WIN32 */
TEST_IMPL
(
spawn_reads_child_path
)
{
TEST_IMPL
(
spawn_reads_child_path
)
{
int
r
;
int
r
;
...
@@ -1746,38 +1782,6 @@ TEST_IMPL(spawn_reads_child_path) {
...
@@ -1746,38 +1782,6 @@ TEST_IMPL(spawn_reads_child_path) {
return
0
;
return
0
;
}
}
#ifndef _WIN32
static
int
mpipe
(
int
*
fds
)
{
if
(
pipe
(
fds
)
==
-
1
)
return
-
1
;
if
(
fcntl
(
fds
[
0
],
F_SETFD
,
FD_CLOEXEC
)
==
-
1
||
fcntl
(
fds
[
1
],
F_SETFD
,
FD_CLOEXEC
)
==
-
1
)
{
close
(
fds
[
0
]);
close
(
fds
[
1
]);
return
-
1
;
}
return
0
;
}
#else
static
int
mpipe
(
int
*
fds
)
{
SECURITY_ATTRIBUTES
attr
;
HANDLE
readh
,
writeh
;
attr
.
nLength
=
sizeof
(
attr
);
attr
.
lpSecurityDescriptor
=
NULL
;
attr
.
bInheritHandle
=
FALSE
;
if
(
!
CreatePipe
(
&
readh
,
&
writeh
,
&
attr
,
0
))
return
-
1
;
fds
[
0
]
=
_open_osfhandle
((
intptr_t
)
readh
,
0
);
fds
[
1
]
=
_open_osfhandle
((
intptr_t
)
writeh
,
0
);
if
(
fds
[
0
]
==
-
1
||
fds
[
1
]
==
-
1
)
{
CloseHandle
(
readh
);
CloseHandle
(
writeh
);
return
-
1
;
}
return
0
;
}
#endif
/* !_WIN32 */
TEST_IMPL
(
spawn_inherit_streams
)
{
TEST_IMPL
(
spawn_inherit_streams
)
{
uv_process_t
child_req
;
uv_process_t
child_req
;
uv_stdio_container_t
child_stdio
[
2
];
uv_stdio_container_t
child_stdio
[
2
];
...
@@ -1803,8 +1807,8 @@ TEST_IMPL(spawn_inherit_streams) {
...
@@ -1803,8 +1807,8 @@ TEST_IMPL(spawn_inherit_streams) {
ASSERT
(
uv_pipe_init
(
loop
,
&
pipe_stdin_parent
,
0
)
==
0
);
ASSERT
(
uv_pipe_init
(
loop
,
&
pipe_stdin_parent
,
0
)
==
0
);
ASSERT
(
uv_pipe_init
(
loop
,
&
pipe_stdout_parent
,
0
)
==
0
);
ASSERT
(
uv_pipe_init
(
loop
,
&
pipe_stdout_parent
,
0
)
==
0
);
ASSERT
(
mpipe
(
fds_stdin
)
!=
-
1
);
ASSERT
(
uv_pipe
(
fds_stdin
,
0
,
0
)
==
0
);
ASSERT
(
mpipe
(
fds_stdout
)
!=
-
1
);
ASSERT
(
uv_pipe
(
fds_stdout
,
0
,
0
)
==
0
);
ASSERT
(
uv_pipe_open
(
&
pipe_stdin_child
,
fds_stdin
[
0
])
==
0
);
ASSERT
(
uv_pipe_open
(
&
pipe_stdin_child
,
fds_stdin
[
0
])
==
0
);
ASSERT
(
uv_pipe_open
(
&
pipe_stdout_child
,
fds_stdout
[
1
])
==
0
);
ASSERT
(
uv_pipe_open
(
&
pipe_stdout_child
,
fds_stdout
[
1
])
==
0
);
...
...
worker/deps/libuv/libuv/test/test-tcp-bind-error.c
浏览文件 @
edde98d7
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <stdlib.h>
static
int
connect_cb_called
=
0
;
static
int
close_cb_called
=
0
;
static
int
close_cb_called
=
0
;
...
@@ -34,7 +35,49 @@ static void close_cb(uv_handle_t* handle) {
...
@@ -34,7 +35,49 @@ static void close_cb(uv_handle_t* handle) {
}
}
TEST_IMPL
(
tcp_bind_error_addrinuse
)
{
static
void
connect_cb
(
uv_connect_t
*
req
,
int
status
)
{
ASSERT
(
status
==
UV_EADDRINUSE
);
uv_close
((
uv_handle_t
*
)
req
->
handle
,
close_cb
);
connect_cb_called
++
;
}
TEST_IMPL
(
tcp_bind_error_addrinuse_connect
)
{
struct
sockaddr_in
addr
;
int
addrlen
;
uv_connect_t
req
;
uv_tcp_t
conn
;
/* 127.0.0.1:<TEST_PORT> is already taken by tcp4_echo_server running in
* another process. uv_tcp_bind() and uv_tcp_connect() should still succeed
* (greatest common denominator across platforms) but the connect callback
* should receive an UV_EADDRINUSE error.
*/
ASSERT
(
0
==
uv_tcp_init
(
uv_default_loop
(),
&
conn
));
ASSERT
(
0
==
uv_ip4_addr
(
"127.0.0.1"
,
TEST_PORT
,
&
addr
));
ASSERT
(
0
==
uv_tcp_bind
(
&
conn
,
(
const
struct
sockaddr
*
)
&
addr
,
0
));
ASSERT
(
0
==
uv_ip4_addr
(
"127.0.0.1"
,
TEST_PORT
+
1
,
&
addr
));
ASSERT
(
0
==
uv_tcp_connect
(
&
req
,
&
conn
,
(
const
struct
sockaddr
*
)
&
addr
,
connect_cb
));
addrlen
=
sizeof
(
addr
);
ASSERT
(
UV_EADDRINUSE
==
uv_tcp_getsockname
(
&
conn
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
));
ASSERT
(
0
==
uv_run
(
uv_default_loop
(),
UV_RUN_DEFAULT
));
ASSERT
(
connect_cb_called
==
1
);
ASSERT
(
close_cb_called
==
1
);
MAKE_VALGRIND_HAPPY
();
return
0
;
}
TEST_IMPL
(
tcp_bind_error_addrinuse_listen
)
{
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
uv_tcp_t
server1
,
server2
;
uv_tcp_t
server1
,
server2
;
int
r
;
int
r
;
...
@@ -240,7 +283,9 @@ TEST_IMPL(tcp_bind_writable_flags) {
...
@@ -240,7 +283,9 @@ TEST_IMPL(tcp_bind_writable_flags) {
ASSERT
(
r
==
UV_EPIPE
);
ASSERT
(
r
==
UV_EPIPE
);
r
=
uv_shutdown
(
&
shutdown_req
,
(
uv_stream_t
*
)
&
server
,
NULL
);
r
=
uv_shutdown
(
&
shutdown_req
,
(
uv_stream_t
*
)
&
server
,
NULL
);
ASSERT
(
r
==
UV_ENOTCONN
);
ASSERT
(
r
==
UV_ENOTCONN
);
r
=
uv_read_start
((
uv_stream_t
*
)
&
server
,
NULL
,
NULL
);
r
=
uv_read_start
((
uv_stream_t
*
)
&
server
,
(
uv_alloc_cb
)
abort
,
(
uv_read_cb
)
abort
);
ASSERT
(
r
==
UV_ENOTCONN
);
ASSERT
(
r
==
UV_ENOTCONN
);
uv_close
((
uv_handle_t
*
)
&
server
,
close_cb
);
uv_close
((
uv_handle_t
*
)
&
server
,
close_cb
);
...
...
worker/deps/libuv/libuv/test/test-tcp-connect-timeout.c
浏览文件 @
edde98d7
...
@@ -111,7 +111,7 @@ static int is_supported_system(void) {
...
@@ -111,7 +111,7 @@ static int is_supported_system(void) {
if
(
cnt
!=
3
)
{
if
(
cnt
!=
3
)
{
return
0
;
return
0
;
}
}
/
/ relase >= 10.0.16299
/
* relase >= 10.0.16299 */
for
(
cnt
=
0
;
cnt
<
3
;
++
cnt
)
{
for
(
cnt
=
0
;
cnt
<
3
;
++
cnt
)
{
if
(
semver
[
cnt
]
>
min_semver
[
cnt
])
if
(
semver
[
cnt
]
>
min_semver
[
cnt
])
return
1
;
return
1
;
...
...
worker/deps/libuv/libuv/test/test-tty.c
浏览文件 @
edde98d7
...
@@ -426,6 +426,9 @@ TEST_IMPL(tty_pty) {
...
@@ -426,6 +426,9 @@ TEST_IMPL(tty_pty) {
#if defined(__QEMU__)
#if defined(__QEMU__)
RETURN_SKIP
(
"Test does not currently work in QEMU"
);
RETURN_SKIP
(
"Test does not currently work in QEMU"
);
#endif
#endif
#if defined(__ASAN__)
RETURN_SKIP
(
"Test does not currently work in ASAN"
);
#endif
#if defined(__APPLE__) || \
#if defined(__APPLE__) || \
defined(__DragonFly__) || \
defined(__DragonFly__) || \
...
...
worker/deps/libuv/libuv/test/test-udp-connect.c
浏览文件 @
edde98d7
...
@@ -124,7 +124,7 @@ TEST_IMPL(udp_connect) {
...
@@ -124,7 +124,7 @@ TEST_IMPL(udp_connect) {
buf
=
uv_buf_init
(
"EXIT"
,
4
);
buf
=
uv_buf_init
(
"EXIT"
,
4
);
/
/ connect() to INADDR_ANY fails on Windows wih WSAEADDRNOTAVAIL
/
* connect() to INADDR_ANY fails on Windows wih WSAEADDRNOTAVAIL */
ASSERT_EQ
(
0
,
uv_ip4_addr
(
"0.0.0.0"
,
TEST_PORT
,
&
tmp_addr
));
ASSERT_EQ
(
0
,
uv_ip4_addr
(
"0.0.0.0"
,
TEST_PORT
,
&
tmp_addr
));
r
=
uv_udp_connect
(
&
client
,
(
const
struct
sockaddr
*
)
&
tmp_addr
);
r
=
uv_udp_connect
(
&
client
,
(
const
struct
sockaddr
*
)
&
tmp_addr
);
#ifdef _WIN32
#ifdef _WIN32
...
...
worker/deps/libuv/libuv/tools/make_dist_html.py
浏览文件 @
edde98d7
#!/usr/bin/python
#!/usr/bin/python3
from
__future__
import
print_function
import
itertools
import
itertools
import
os
import
os
...
@@ -84,7 +82,7 @@ EXE = r'''
...
@@ -84,7 +82,7 @@ EXE = r'''
'''
'''
def
version
(
tag
):
def
version
(
tag
):
return
map
(
int
,
re
.
match
(
'^v(
\
d+)
\
.(
\
d+)
\
.(
\
d+)'
,
tag
)
.
groups
(
))
return
list
(
map
(
int
,
re
.
match
(
'^v(
\
d+)
\
.(
\
d+)
\
.(
\
d+)'
,
tag
)
.
groups
()
))
def
major_minor
(
tag
):
def
major_minor
(
tag
):
return
version
(
tag
)[:
2
]
return
version
(
tag
)[:
2
]
...
@@ -114,7 +112,7 @@ def groups_for(groups, n=4):
...
@@ -114,7 +112,7 @@ def groups_for(groups, n=4):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
tags
=
subprocess
.
check_output
([
'git'
,
'tag'
])
tags
=
subprocess
.
check_output
([
'git'
,
'tag'
]
,
text
=
True
)
tags
=
[
tag
for
tag
in
tags
.
split
(
'
\n
'
)
if
tag
.
startswith
(
'v'
)]
tags
=
[
tag
for
tag
in
tags
.
split
(
'
\n
'
)
if
tag
.
startswith
(
'v'
)]
tags
.
sort
(
key
=
version
,
reverse
=
True
)
tags
.
sort
(
key
=
version
,
reverse
=
True
)
groups
=
[
group_for
(
list
(
g
))
for
_
,
g
in
itertools
.
groupby
(
tags
,
major_minor
)]
groups
=
[
group_for
(
list
(
g
))
for
_
,
g
in
itertools
.
groupby
(
tags
,
major_minor
)]
...
...
worker/scripts/get-dep.sh
浏览文件 @
edde98d7
...
@@ -80,7 +80,7 @@ function get_netstring()
...
@@ -80,7 +80,7 @@ function get_netstring()
function
get_libuv
()
function
get_libuv
()
{
{
GIT_REPO
=
"https://github.com/libuv/libuv.git"
GIT_REPO
=
"https://github.com/libuv/libuv.git"
GIT_TAG
=
"v1.4
0
.0"
GIT_TAG
=
"v1.4
1
.0"
DEST
=
"deps/libuv/libuv"
DEST
=
"deps/libuv/libuv"
get_dep
"
${
GIT_REPO
}
"
"
${
GIT_TAG
}
"
"
${
DEST
}
"
get_dep
"
${
GIT_REPO
}
"
"
${
GIT_TAG
}
"
"
${
DEST
}
"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论