libuv 1.48.0.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4828 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-02-07 23:12:32 +00:00
parent e98802f5b2
commit 6765254f43
53 changed files with 1172 additions and 305 deletions

View File

@@ -51,6 +51,9 @@
# ifndef lseek
# define lseek _lseek
# endif
# define S_IFDIR _S_IFDIR
# define S_IFCHR _S_IFCHR
# define S_IFREG _S_IFREG
#endif
#define TOO_LONG_NAME_LENGTH 65536
@@ -227,7 +230,7 @@ static void realpath_cb(uv_fs_t* req) {
uv_cwd(test_file_abs_buf, &test_file_abs_size);
#ifdef _WIN32
strcat(test_file_abs_buf, "\\test_file");
ASSERT_OK(stricmp(req->ptr, test_file_abs_buf));
ASSERT_OK(_stricmp(req->ptr, test_file_abs_buf));
#else
strcat(test_file_abs_buf, "/test_file");
ASSERT_OK(strcmp(req->ptr, test_file_abs_buf));
@@ -343,7 +346,7 @@ static void statfs_cb(uv_fs_t* req) {
defined(__OpenBSD__) || defined(__NetBSD__)
ASSERT_OK(stats->f_type);
#else
ASSERT_GT(stats->f_type, 0);
ASSERT_UINT64_GT(stats->f_type, 0);
#endif
ASSERT_GT(stats->f_bsize, 0);
@@ -718,12 +721,13 @@ TEST_IMPL(fs_file_noent) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &req, "does_not_exist", O_RDONLY, 0, NULL);
r = uv_fs_open(NULL, &req, "does_not_exist", UV_FS_O_RDONLY, 0, NULL);
ASSERT_EQ(r, UV_ENOENT);
ASSERT_EQ(req.result, UV_ENOENT);
uv_fs_req_cleanup(&req);
r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, open_noent_cb);
r = uv_fs_open(loop, &req, "does_not_exist", UV_FS_O_RDONLY, 0,
open_noent_cb);
ASSERT_OK(r);
ASSERT_OK(open_cb_count);
@@ -746,12 +750,12 @@ TEST_IMPL(fs_file_nametoolong) {
memset(name, 'a', TOO_LONG_NAME_LENGTH);
name[TOO_LONG_NAME_LENGTH] = 0;
r = uv_fs_open(NULL, &req, name, O_RDONLY, 0, NULL);
r = uv_fs_open(NULL, &req, name, UV_FS_O_RDONLY, 0, NULL);
ASSERT_EQ(r, UV_ENAMETOOLONG);
ASSERT_EQ(req.result, UV_ENAMETOOLONG);
uv_fs_req_cleanup(&req);
r = uv_fs_open(loop, &req, name, O_RDONLY, 0, open_nametoolong_cb);
r = uv_fs_open(loop, &req, name, UV_FS_O_RDONLY, 0, open_nametoolong_cb);
ASSERT_OK(r);
ASSERT_OK(open_cb_count);
@@ -786,12 +790,12 @@ TEST_IMPL(fs_file_loop) {
ASSERT_OK(r);
uv_fs_req_cleanup(&req);
r = uv_fs_open(NULL, &req, "test_symlink", O_RDONLY, 0, NULL);
r = uv_fs_open(NULL, &req, "test_symlink", UV_FS_O_RDONLY, 0, NULL);
ASSERT_EQ(r, UV_ELOOP);
ASSERT_EQ(req.result, UV_ELOOP);
uv_fs_req_cleanup(&req);
r = uv_fs_open(loop, &req, "test_symlink", O_RDONLY, 0, open_loop_cb);
r = uv_fs_open(loop, &req, "test_symlink", UV_FS_O_RDONLY, 0, open_loop_cb);
ASSERT_OK(r);
ASSERT_OK(open_cb_count);
@@ -918,7 +922,7 @@ TEST_IMPL(fs_file_async) {
loop = uv_default_loop();
r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT,
r = uv_fs_open(loop, &open_req1, "test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IRUSR | S_IWUSR, create_cb);
ASSERT_OK(r);
uv_run(loop, UV_RUN_DEFAULT);
@@ -938,7 +942,7 @@ TEST_IMPL(fs_file_async) {
ASSERT_EQ(1, close_cb_count);
ASSERT_EQ(1, rename_cb_count);
r = uv_fs_open(loop, &open_req1, "test_file2", O_RDWR, 0, open_cb);
r = uv_fs_open(loop, &open_req1, "test_file2", UV_FS_O_RDWR, 0, open_cb);
ASSERT_OK(r);
uv_run(loop, UV_RUN_DEFAULT);
@@ -950,7 +954,7 @@ TEST_IMPL(fs_file_async) {
ASSERT_EQ(1, write_cb_count);
ASSERT_EQ(1, ftruncate_cb_count);
r = uv_fs_open(loop, &open_req1, "test_file2", O_RDONLY, 0, open_cb);
r = uv_fs_open(loop, &open_req1, "test_file2", UV_FS_O_RDONLY, 0, open_cb);
ASSERT_OK(r);
uv_run(loop, UV_RUN_DEFAULT);
@@ -982,7 +986,8 @@ static void fs_file_sync(int add_flags) {
loop = uv_default_loop();
r = uv_fs_open(loop, &open_req1, "test_file",
O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -998,7 +1003,8 @@ static void fs_file_sync(int add_flags) {
ASSERT_OK(close_req.result);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR | add_flags, 0, NULL);
r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDWR | add_flags, 0,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -1025,7 +1031,7 @@ static void fs_file_sync(int add_flags) {
ASSERT_OK(rename_req.result);
uv_fs_req_cleanup(&rename_req);
r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDONLY | add_flags, 0,
r = uv_fs_open(NULL, &open_req1, "test_file2", UV_FS_O_RDONLY | add_flags, 0,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
@@ -1071,7 +1077,8 @@ static void fs_file_write_null_buffer(int add_flags) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &open_req1, "test_file",
O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -1116,7 +1123,8 @@ TEST_IMPL(fs_async_dir) {
ASSERT_EQ(1, mkdir_cb_count);
/* Create 2 files synchronously. */
r = uv_fs_open(NULL, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT,
r = uv_fs_open(NULL, &open_req1, "test_dir/file1",
UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
uv_fs_req_cleanup(&open_req1);
@@ -1124,7 +1132,8 @@ TEST_IMPL(fs_async_dir) {
ASSERT_OK(r);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT,
r = uv_fs_open(NULL, &open_req1, "test_dir/file2",
UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
uv_fs_req_cleanup(&open_req1);
@@ -1193,7 +1202,7 @@ 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, size_t expected_size) {
int f, r;
struct stat s1, s2;
uv_fs_t req;
@@ -1205,7 +1214,7 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
unlink("test_file");
unlink("test_file2");
f = open("test_file", O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
f = open("test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT, S_IWUSR | S_IRUSR);
ASSERT_NE(f, -1);
if (setup != NULL)
@@ -1215,12 +1224,12 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t expected_size) {
ASSERT_OK(r);
/* Test starts here. */
r = uv_fs_open(NULL, &open_req1, "test_file", O_RDWR, 0, NULL);
r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDWR, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
r = uv_fs_open(NULL, &open_req2, "test_file2", O_WRONLY | O_CREAT,
r = uv_fs_open(NULL, &open_req2, "test_file2", UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req2.result, 0);
@@ -1248,7 +1257,7 @@ static int test_sendfile(void (*setup)(int), uv_fs_cb cb, off_t 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);
r = uv_fs_open(NULL, &open_req1, "test_file2", UV_FS_O_RDWR, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -1364,7 +1373,7 @@ TEST_IMPL(fs_mkstemp) {
uv_fs_close(NULL, &req, mkstemp_req2.result, NULL);
uv_fs_req_cleanup(&req);
fd = uv_fs_open(NULL, &req, mkstemp_req1.path , O_RDONLY, 0, NULL);
fd = uv_fs_open(NULL, &req, mkstemp_req1.path, UV_FS_O_RDONLY, 0, NULL);
ASSERT_GE(fd, 0);
uv_fs_req_cleanup(&req);
@@ -1410,7 +1419,7 @@ TEST_IMPL(fs_fstat) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
@@ -1617,7 +1626,7 @@ TEST_IMPL(fs_access) {
access_cb_count = 0; /* reset for the next test */
/* Create file */
r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
@@ -1678,7 +1687,7 @@ TEST_IMPL(fs_chmod) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
@@ -1777,9 +1786,7 @@ TEST_IMPL(fs_unlink_readonly) {
loop = uv_default_loop();
r = uv_fs_open(NULL,
&req,
"test_file",
O_RDWR | O_CREAT,
&req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -1836,9 +1843,7 @@ TEST_IMPL(fs_unlink_archive_readonly) {
loop = uv_default_loop();
r = uv_fs_open(NULL,
&req,
"test_file",
O_RDWR | O_CREAT,
&req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -1894,7 +1899,7 @@ TEST_IMPL(fs_chown) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
@@ -1989,7 +1994,7 @@ TEST_IMPL(fs_link) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
@@ -2010,7 +2015,7 @@ TEST_IMPL(fs_link) {
ASSERT_OK(req.result);
uv_fs_req_cleanup(&req);
r = uv_fs_open(NULL, &req, "test_file_link", O_RDWR, 0, NULL);
r = uv_fs_open(NULL, &req, "test_file_link", UV_FS_O_RDWR, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
link = req.result;
@@ -2031,7 +2036,7 @@ TEST_IMPL(fs_link) {
uv_run(loop, UV_RUN_DEFAULT);
ASSERT_EQ(1, link_cb_count);
r = uv_fs_open(NULL, &req, "test_file_link2", O_RDWR, 0, NULL);
r = uv_fs_open(NULL, &req, "test_file_link2", UV_FS_O_RDWR, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
link = req.result;
@@ -2090,7 +2095,7 @@ TEST_IMPL(fs_readlink) {
/* Setup */
/* Create a non-symlink file */
r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
@@ -2162,7 +2167,7 @@ TEST_IMPL(fs_symlink) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,
r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
@@ -2200,7 +2205,7 @@ TEST_IMPL(fs_symlink) {
ASSERT_OK(req.result);
uv_fs_req_cleanup(&req);
r = uv_fs_open(NULL, &req, "test_file_symlink", O_RDWR, 0, NULL);
r = uv_fs_open(NULL, &req, "test_file_symlink", UV_FS_O_RDWR, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
link = req.result;
@@ -2236,7 +2241,7 @@ TEST_IMPL(fs_symlink) {
r = uv_fs_realpath(NULL, &req, "test_file_symlink_symlink", NULL);
ASSERT_OK(r);
#ifdef _WIN32
ASSERT_OK(stricmp(req.ptr, test_file_abs_buf));
ASSERT_OK(_stricmp(req.ptr, test_file_abs_buf));
#else
ASSERT_OK(strcmp(req.ptr, test_file_abs_buf));
#endif
@@ -2253,7 +2258,7 @@ TEST_IMPL(fs_symlink) {
uv_run(loop, UV_RUN_DEFAULT);
ASSERT_EQ(1, symlink_cb_count);
r = uv_fs_open(NULL, &req, "test_file_symlink2", O_RDWR, 0, NULL);
r = uv_fs_open(NULL, &req, "test_file_symlink2", UV_FS_O_RDWR, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
link = req.result;
@@ -2386,13 +2391,14 @@ int test_symlink_dir_impl(int type) {
ASSERT_OK(r);
#ifdef _WIN32
ASSERT_EQ(strlen(req.ptr), test_dir_abs_size - 5);
ASSERT_OK(strnicmp(req.ptr, test_dir + 4, test_dir_abs_size - 5));
ASSERT_OK(_strnicmp(req.ptr, test_dir + 4, test_dir_abs_size - 5));
#else
ASSERT_OK(strcmp(req.ptr, test_dir_abs_buf));
#endif
uv_fs_req_cleanup(&req);
r = uv_fs_open(NULL, &open_req1, "test_dir/file1", O_WRONLY | O_CREAT,
r = uv_fs_open(NULL, &open_req1, "test_dir/file1",
UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
uv_fs_req_cleanup(&open_req1);
@@ -2400,7 +2406,8 @@ int test_symlink_dir_impl(int type) {
ASSERT_OK(r);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_dir/file2", O_WRONLY | O_CREAT,
r = uv_fs_open(NULL, &open_req1, "test_dir/file2",
UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
uv_fs_req_cleanup(&open_req1);
@@ -2622,7 +2629,9 @@ TEST_IMPL(fs_utime) {
/* Setup. */
loop = uv_default_loop();
unlink(path);
r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL);
r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
uv_fs_req_cleanup(&req);
@@ -2666,7 +2675,9 @@ TEST_IMPL(fs_utime_round) {
loop = uv_default_loop();
unlink(path);
r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL);
r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
uv_fs_req_cleanup(&req);
@@ -2743,7 +2754,9 @@ TEST_IMPL(fs_futime) {
/* Setup. */
loop = uv_default_loop();
unlink(path);
r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL);
r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
uv_fs_req_cleanup(&req);
@@ -2751,7 +2764,7 @@ TEST_IMPL(fs_futime) {
atime = mtime = 400497753.25; /* 1982-09-10 11:22:33.25 */
r = uv_fs_open(NULL, &req, path, O_RDWR, 0, NULL);
r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
file = req.result; /* FIXME probably not how it's supposed to be used */
@@ -2803,7 +2816,9 @@ TEST_IMPL(fs_lutime) {
/* Setup */
loop = uv_default_loop();
unlink(path);
r = uv_fs_open(NULL, &req, path, O_RDWR | O_CREAT, S_IWUSR | S_IRUSR, NULL);
r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
uv_fs_req_cleanup(&req);
@@ -2999,7 +3014,7 @@ TEST_IMPL(fs_open_dir) {
path = ".";
loop = uv_default_loop();
r = uv_fs_open(NULL, &req, path, O_RDONLY, 0, NULL);
r = uv_fs_open(NULL, &req, path, UV_FS_O_RDONLY, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
ASSERT_NULL(req.ptr);
@@ -3009,7 +3024,7 @@ TEST_IMPL(fs_open_dir) {
r = uv_fs_close(NULL, &req, file, NULL);
ASSERT_OK(r);
r = uv_fs_open(loop, &req, path, O_RDONLY, 0, open_cb_simple);
r = uv_fs_open(loop, &req, path, UV_FS_O_RDONLY, 0, open_cb_simple);
ASSERT_OK(r);
ASSERT_OK(open_cb_count);
@@ -3030,7 +3045,8 @@ static void fs_file_open_append(int add_flags) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &open_req1, "test_file",
O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -3047,7 +3063,7 @@ static void fs_file_open_append(int add_flags) {
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_file",
O_RDWR | O_APPEND | add_flags, 0, NULL);
UV_FS_O_RDWR | UV_FS_O_APPEND | add_flags, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -3063,7 +3079,7 @@ static void fs_file_open_append(int add_flags) {
ASSERT_OK(close_req.result);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags,
r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY | add_flags,
S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
@@ -3105,7 +3121,7 @@ TEST_IMPL(fs_rename_to_existing_file) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &open_req1, "test_file", O_WRONLY | O_CREAT,
r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
@@ -3122,7 +3138,7 @@ TEST_IMPL(fs_rename_to_existing_file) {
ASSERT_OK(close_req.result);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_file2", O_WRONLY | O_CREAT,
r = uv_fs_open(NULL, &open_req1, "test_file2", UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
@@ -3138,7 +3154,7 @@ TEST_IMPL(fs_rename_to_existing_file) {
ASSERT_OK(rename_req.result);
uv_fs_req_cleanup(&rename_req);
r = uv_fs_open(NULL, &open_req1, "test_file2", O_RDONLY, 0, NULL);
r = uv_fs_open(NULL, &open_req1, "test_file2", UV_FS_O_RDONLY, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -3171,7 +3187,7 @@ static void fs_read_bufs(int add_flags) {
ASSERT_LE(0, uv_fs_open(NULL, &open_req1,
"test/fixtures/lorem_ipsum.txt",
O_RDONLY | add_flags, 0, NULL));
UV_FS_O_RDONLY | add_flags, 0, NULL));
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -3235,7 +3251,8 @@ static void fs_read_file_eof(int add_flags) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &open_req1, "test_file",
O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -3251,7 +3268,7 @@ static void fs_read_file_eof(int add_flags) {
ASSERT_OK(close_req.result);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0,
r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY | add_flags, 0,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
@@ -3299,7 +3316,8 @@ static void fs_write_multiple_bufs(int add_flags) {
loop = uv_default_loop();
r = uv_fs_open(NULL, &open_req1, "test_file",
O_WRONLY | O_CREAT | add_flags, S_IWUSR | S_IRUSR, NULL);
UV_FS_O_WRONLY | UV_FS_O_CREAT | add_flags, S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -3316,7 +3334,7 @@ static void fs_write_multiple_bufs(int add_flags) {
ASSERT_OK(close_req.result);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0,
r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY | add_flags, 0,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
@@ -3405,7 +3423,7 @@ static void fs_write_alotof_bufs(int add_flags) {
r = uv_fs_open(NULL,
&open_req1,
"test_file",
O_RDWR | O_CREAT | add_flags,
UV_FS_O_RDWR | UV_FS_O_CREAT | add_flags,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -3439,7 +3457,7 @@ static void fs_write_alotof_bufs(int add_flags) {
ASSERT_OK(close_req.result);
uv_fs_req_cleanup(&close_req);
r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY | add_flags, 0,
r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY | add_flags, 0,
NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
@@ -3518,7 +3536,7 @@ static void fs_write_alotof_bufs_with_offset(int add_flags) {
r = uv_fs_open(NULL,
&open_req1,
"test_file",
O_RDWR | O_CREAT | add_flags,
UV_FS_O_RDWR | UV_FS_O_CREAT | add_flags,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -3904,9 +3922,7 @@ TEST_IMPL(get_osfhandle_valid_handle) {
loop = uv_default_loop();
r = uv_fs_open(NULL,
&open_req1,
"test_file",
O_RDWR | O_CREAT,
&open_req1, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -3945,7 +3961,7 @@ TEST_IMPL(open_osfhandle_valid_handle) {
r = uv_fs_open(NULL,
&open_req1,
"test_file",
O_RDWR | O_CREAT,
UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -3986,9 +4002,7 @@ TEST_IMPL(fs_file_pos_after_op_with_offset) {
loop = uv_default_loop();
r = uv_fs_open(loop,
&open_req1,
"test_file",
O_RDWR | O_CREAT,
&open_req1, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GT(r, 0);
@@ -4060,7 +4074,7 @@ static void fs_file_pos_close_check(const char *contents, int size) {
uv_fs_req_cleanup(&close_req);
/* Confirm file contents */
r = uv_fs_open(NULL, &open_req1, "test_file", O_RDONLY, 0, NULL);
r = uv_fs_open(NULL, &open_req1, "test_file", UV_FS_O_RDONLY, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(open_req1.result, 0);
uv_fs_req_cleanup(&open_req1);
@@ -4088,7 +4102,7 @@ static void fs_file_pos_write(int add_flags) {
r = uv_fs_open(NULL,
&open_req1,
"test_file",
O_TRUNC | O_CREAT | O_RDWR | add_flags,
UV_FS_O_TRUNC | UV_FS_O_CREAT | UV_FS_O_RDWR | add_flags,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GT(r, 0);
@@ -4126,7 +4140,7 @@ static void fs_file_pos_append(int add_flags) {
r = uv_fs_open(NULL,
&open_req1,
"test_file",
O_APPEND | O_CREAT | O_RDWR | add_flags,
UV_FS_O_APPEND | UV_FS_O_CREAT | UV_FS_O_RDWR | add_flags,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GT(r, 0);
@@ -4273,7 +4287,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) {
r = uv_fs_open(NULL,
&open_req1,
"test_file",
O_RDWR | O_CREAT | UV_FS_O_EXLOCK,
UV_FS_O_RDWR | UV_FS_O_CREAT | UV_FS_O_EXLOCK,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -4282,8 +4296,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) {
r = uv_fs_open(NULL,
&open_req2,
"test_file",
O_RDONLY | UV_FS_O_EXLOCK,
"test_file", UV_FS_O_RDONLY | UV_FS_O_EXLOCK,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_LT(r, 0);
@@ -4297,8 +4310,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) {
r = uv_fs_open(NULL,
&open_req2,
"test_file",
O_RDONLY | UV_FS_O_EXLOCK,
"test_file", UV_FS_O_RDONLY | UV_FS_O_EXLOCK,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -4405,7 +4417,7 @@ TEST_IMPL(fs_open_readonly_acl) {
r = uv_fs_open(loop,
&open_req1,
"test_file_icacls",
O_RDONLY | O_CREAT,
UV_FS_O_RDONLY | UV_FS_O_CREAT,
S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -4428,7 +4440,8 @@ TEST_IMPL(fs_open_readonly_acl) {
}
/* Try opening the file */
r = uv_fs_open(NULL, &open_req1, "test_file_icacls", O_RDONLY, 0, NULL);
r = uv_fs_open(NULL, &open_req1, "test_file_icacls", UV_FS_O_RDONLY, 0,
NULL);
if (r < 0) {
goto acl_cleanup;
}
@@ -4461,9 +4474,7 @@ TEST_IMPL(fs_fchmod_archive_readonly) {
/* Setup*/
unlink("test_file");
r = uv_fs_open(NULL,
&req,
"test_file",
O_WRONLY | O_CREAT,
&req, "test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT,
S_IWUSR | S_IRUSR,
NULL);
ASSERT_GE(r, 0);
@@ -4478,7 +4489,7 @@ TEST_IMPL(fs_fchmod_archive_readonly) {
ASSERT(r);
check_permission("test_file", 0400);
/* Try fchmod */
r = uv_fs_open(NULL, &req, "test_file", O_RDONLY, 0, NULL);
r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDONLY, 0, NULL);
ASSERT_GE(r, 0);
ASSERT_GE(req.result, 0);
file = req.result;