libuv 1.47.0.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4615 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-11-07 17:30:39 +00:00
parent 889773c38d
commit ee9cb63327
226 changed files with 6648 additions and 6444 deletions

View File

@@ -36,11 +36,11 @@ static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) {
static void read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
switch (++read_cb_called) {
case 1:
ASSERT(nread == 1);
ASSERT_EQ(1, nread);
uv_read_stop(handle);
break;
case 2:
ASSERT(nread == UV_EOF);
ASSERT_EQ(nread, UV_EOF);
uv_close((uv_handle_t *) handle, NULL);
break;
default:
@@ -55,29 +55,29 @@ TEST_IMPL(close_fd) {
uv_file fd[2];
bufs[0] = uv_buf_init("", 1);
ASSERT(0 == uv_pipe(fd, 0, 0));
ASSERT(0 == uv_pipe_init(uv_default_loop(), &pipe_handle, 0));
ASSERT(0 == uv_pipe_open(&pipe_handle, fd[0]));
ASSERT_OK(uv_pipe(fd, 0, 0));
ASSERT_OK(uv_pipe_init(uv_default_loop(), &pipe_handle, 0));
ASSERT_OK(uv_pipe_open(&pipe_handle, fd[0]));
/* uv_pipe_open() takes ownership of the file descriptor. */
fd[0] = -1;
ASSERT(1 == uv_fs_write(NULL, &req, fd[1], bufs, 1, -1, NULL));
ASSERT(1 == req.result);
ASSERT_EQ(1, uv_fs_write(NULL, &req, fd[1], bufs, 1, -1, NULL));
ASSERT_EQ(1, req.result);
uv_fs_req_cleanup(&req);
#ifdef _WIN32
ASSERT(0 == _close(fd[1]));
ASSERT_OK(_close(fd[1]));
#else
ASSERT(0 == close(fd[1]));
ASSERT_OK(close(fd[1]));
#endif
fd[1] = -1;
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(1 == read_cb_called);
ASSERT(0 == uv_is_active((const uv_handle_t *) &pipe_handle));
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(2 == read_cb_called);
ASSERT(0 != uv_is_closing((const uv_handle_t *) &pipe_handle));
ASSERT_OK(uv_read_start((uv_stream_t *) &pipe_handle, alloc_cb, read_cb));
ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT));
ASSERT_EQ(1, read_cb_called);
ASSERT_OK(uv_is_active((const uv_handle_t *) &pipe_handle));
ASSERT_OK(uv_read_start((uv_stream_t *) &pipe_handle, alloc_cb, read_cb));
ASSERT_OK(uv_run(uv_default_loop(), UV_RUN_DEFAULT));
ASSERT_EQ(2, read_cb_called);
ASSERT_NE(0, uv_is_closing((const uv_handle_t *) &pipe_handle));
MAKE_VALGRIND_HAPPY(uv_default_loop());
return 0;