libuv 1.42.0.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3650 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-07-27 22:08:18 +00:00
parent 5197eb91f7
commit da51e87774
183 changed files with 4013 additions and 1768 deletions

View File

@ -19,12 +19,11 @@
* IN THE SOFTWARE.
*/
#if !defined(_WIN32)
#include "uv.h"
#include "task.h"
#include <fcntl.h>
#ifndef _WIN32
#include <unistd.h>
#endif
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) {
TEST_IMPL(close_fd) {
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_open(&pipe_handle, fd[0]));
fd[0] = -1; /* uv_pipe_open() takes ownership of the file descriptor. */
ASSERT(1 == write(fd[1], "", 1));
/* 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);
uv_fs_req_cleanup(&req);
#ifdef _WIN32
ASSERT(0 == _close(fd[1]));
#else
ASSERT(0 == 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));
@ -72,9 +82,3 @@ TEST_IMPL(close_fd) {
MAKE_VALGRIND_HAPPY();
return 0;
}
#else
typedef int file_has_no_tests; /* ISO C forbids an empty translation unit. */
#endif /* !_WIN32 */