Lines Matching refs:req
172 uv_fs_t req;
175 r = uv_fs_stat(NULL, &req, filename, NULL);
177 ASSERT_OK(req.result);
179 s = &req.statbuf;
190 uv_fs_req_cleanup(&req);
194 static void dummy_cb(uv_fs_t* req) {
195 (void) req;
200 static void link_cb(uv_fs_t* req) {
201 ASSERT_EQ(req->fs_type, UV_FS_LINK);
202 ASSERT_OK(req->result);
204 uv_fs_req_cleanup(req);
208 static void symlink_cb(uv_fs_t* req) {
209 ASSERT_EQ(req->fs_type, UV_FS_SYMLINK);
210 ASSERT_OK(req->result);
212 uv_fs_req_cleanup(req);
215 static void readlink_cb(uv_fs_t* req) {
216 ASSERT_EQ(req->fs_type, UV_FS_READLINK);
217 ASSERT_OK(req->result);
218 ASSERT_OK(strcmp(req->ptr, "test_file_symlink2"));
220 uv_fs_req_cleanup(req);
224 static void realpath_cb(uv_fs_t* req) {
227 ASSERT_EQ(req->fs_type, UV_FS_REALPATH);
228 ASSERT_OK(req->result);
233 ASSERT_OK(_stricmp(req->ptr, test_file_abs_buf));
236 ASSERT_OK(strcmp(req->ptr, test_file_abs_buf));
239 uv_fs_req_cleanup(req);
243 static void access_cb(uv_fs_t* req) {
244 ASSERT_EQ(req->fs_type, UV_FS_ACCESS);
246 uv_fs_req_cleanup(req);
250 static void fchmod_cb(uv_fs_t* req) {
251 ASSERT_EQ(req->fs_type, UV_FS_FCHMOD);
252 ASSERT_OK(req->result);
254 uv_fs_req_cleanup(req);
255 check_permission("test_file", *(int*)req->data);
259 static void chmod_cb(uv_fs_t* req) {
260 ASSERT_EQ(req->fs_type, UV_FS_CHMOD);
261 ASSERT_OK(req->result);
263 uv_fs_req_cleanup(req);
264 check_permission("test_file", *(int*)req->data);
268 static void fchown_cb(uv_fs_t* req) {
269 ASSERT_EQ(req->fs_type, UV_FS_FCHOWN);
270 ASSERT_OK(req->result);
272 uv_fs_req_cleanup(req);
276 static void chown_cb(uv_fs_t* req) {
277 ASSERT_EQ(req->fs_type, UV_FS_CHOWN);
278 ASSERT_OK(req->result);
280 uv_fs_req_cleanup(req);
283 static void lchown_cb(uv_fs_t* req) {
284 ASSERT_EQ(req->fs_type, UV_FS_LCHOWN);
285 ASSERT_OK(req->result);
287 uv_fs_req_cleanup(req);
290 static void chown_root_cb(uv_fs_t* req) {
291 ASSERT_EQ(req->fs_type, UV_FS_CHOWN);
294 ASSERT_OK(req->result);
300 ASSERT_OK(req->result);
304 ASSERT_EQ(req->result, UV_EINVAL);
310 ASSERT(req->result == 0 || req->result == UV_EPERM);
312 ASSERT_EQ(req->result, UV_EPERM);
316 uv_fs_req_cleanup(req);
319 static void unlink_cb(uv_fs_t* req) {
320 ASSERT_PTR_EQ(req, &unlink_req);
321 ASSERT_EQ(req->fs_type, UV_FS_UNLINK);
322 ASSERT_OK(req->result);
324 uv_fs_req_cleanup(req);
327 static void fstat_cb(uv_fs_t* req) {
328 uv_stat_t* s = req->ptr;
329 ASSERT_EQ(req->fs_type, UV_FS_FSTAT);
330 ASSERT_OK(req->result);
332 uv_fs_req_cleanup(req);
337 static void statfs_cb(uv_fs_t* req) {
340 ASSERT_EQ(req->fs_type, UV_FS_STATFS);
341 ASSERT_OK(req->result);
342 ASSERT_NOT_NULL(req->ptr);
343 stats = req->ptr;
364 uv_fs_req_cleanup(req);
365 ASSERT_NULL(req->ptr);
370 static void close_cb(uv_fs_t* req) {
372 ASSERT_PTR_EQ(req, &close_req);
373 ASSERT_EQ(req->fs_type, UV_FS_CLOSE);
374 ASSERT_OK(req->result);
376 uv_fs_req_cleanup(req);
384 static void ftruncate_cb(uv_fs_t* req) {
386 ASSERT_PTR_EQ(req, &ftruncate_req);
387 ASSERT_EQ(req->fs_type, UV_FS_FTRUNCATE);
388 ASSERT_OK(req->result);
390 uv_fs_req_cleanup(req);
395 static void fail_cb(uv_fs_t* req) {
399 static void read_cb(uv_fs_t* req) {
401 ASSERT_PTR_EQ(req, &read_req);
402 ASSERT_EQ(req->fs_type, UV_FS_READ);
403 ASSERT_GE(req->result, 0); /* FIXME(bnoordhuis) Check if requested size? */
405 uv_fs_req_cleanup(req);
418 static void open_cb(uv_fs_t* req) {
420 ASSERT_PTR_EQ(req, &open_req1);
421 ASSERT_EQ(req->fs_type, UV_FS_OPEN);
422 if (req->result < 0) {
423 fprintf(stderr, "async open error: %d\n", (int) req->result);
427 ASSERT(req->path);
428 ASSERT_OK(memcmp(req->path, "test_file2\0", 11));
429 uv_fs_req_cleanup(req);
438 static void open_cb_simple(uv_fs_t* req) {
439 ASSERT_EQ(req->fs_type, UV_FS_OPEN);
440 if (req->result < 0) {
441 fprintf(stderr, "async open error: %d\n", (int) req->result);
445 ASSERT(req->path);
446 uv_fs_req_cleanup(req);
450 static void fsync_cb(uv_fs_t* req) {
452 ASSERT_PTR_EQ(req, &fsync_req);
453 ASSERT_EQ(req->fs_type, UV_FS_FSYNC);
454 ASSERT_OK(req->result);
456 uv_fs_req_cleanup(req);
462 static void fdatasync_cb(uv_fs_t* req) {
464 ASSERT_PTR_EQ(req, &fdatasync_req);
465 ASSERT_EQ(req->fs_type, UV_FS_FDATASYNC);
466 ASSERT_OK(req->result);
468 uv_fs_req_cleanup(req);
474 static void write_cb(uv_fs_t* req) {
476 ASSERT_PTR_EQ(req, &write_req);
477 ASSERT_EQ(req->fs_type, UV_FS_WRITE);
478 ASSERT_GE(req->result, 0); /* FIXME(bnoordhuis) Check if requested size? */
480 uv_fs_req_cleanup(req);
486 static void create_cb(uv_fs_t* req) {
488 ASSERT_PTR_EQ(req, &open_req1);
489 ASSERT_EQ(req->fs_type, UV_FS_OPEN);
490 ASSERT_GE(req->result, 0);
492 uv_fs_req_cleanup(req);
494 r = uv_fs_write(loop, &write_req, req->result, &iov, 1, -1, write_cb);
499 static void rename_cb(uv_fs_t* req) {
500 ASSERT_PTR_EQ(req, &rename_req);
501 ASSERT_EQ(req->fs_type, UV_FS_RENAME);
502 ASSERT_OK(req->result);
504 uv_fs_req_cleanup(req);
508 static void mkdir_cb(uv_fs_t* req) {
509 ASSERT_PTR_EQ(req, &mkdir_req);
510 ASSERT_EQ(req->fs_type, UV_FS_MKDIR);
511 ASSERT_OK(req->result);
513 ASSERT(req->path);
514 ASSERT_OK(memcmp(req->path, "test_dir\0", 9));
515 uv_fs_req_cleanup(req);
519 static void check_mkdtemp_result(uv_fs_t* req) {
522 ASSERT_EQ(req->fs_type, UV_FS_MKDTEMP);
523 ASSERT_OK(req->result);
524 ASSERT(req->path);
525 ASSERT_EQ(15, strlen(req->path));
526 ASSERT_OK(memcmp(req->path, "test_dir_", 9));
527 ASSERT_NE(0, memcmp(req->path + 9, "XXXXXX", 6));
528 check_permission(req->path, 0700);
530 /* Check if req->path is actually a directory */
531 r = uv_fs_stat(NULL, &stat_req, req->path, NULL);
538 static void mkdtemp_cb(uv_fs_t* req) {
539 ASSERT_PTR_EQ(req, &mkdtemp_req1);
540 check_mkdtemp_result(req);
545 static void check_mkstemp_result(uv_fs_t* req) {
548 ASSERT_EQ(req->fs_type, UV_FS_MKSTEMP);
549 ASSERT_GE(req->result, 0);
550 ASSERT(req->path);
551 ASSERT_EQ(16, strlen(req->path));
552 ASSERT_OK(memcmp(req->path, "test_file_", 10));
553 ASSERT_NE(0, memcmp(req->path + 10, "XXXXXX", 6));
554 check_permission(req->path, 0600);
556 /* Check if req->path is actually a file */
557 r = uv_fs_stat(NULL, &stat_req, req->path, NULL);
564 static void mkstemp_cb(uv_fs_t* req) {
565 ASSERT_PTR_EQ(req, &mkstemp_req1);
566 check_mkstemp_result(req);
571 static void rmdir_cb(uv_fs_t* req) {
572 ASSERT_PTR_EQ(req, &rmdir_req);
573 ASSERT_EQ(req->fs_type, UV_FS_RMDIR);
574 ASSERT_OK(req->result);
576 ASSERT(req->path);
577 ASSERT_OK(memcmp(req->path, "test_dir\0", 9));
578 uv_fs_req_cleanup(req);
604 static void scandir_cb(uv_fs_t* req) {
606 ASSERT_PTR_EQ(req, &scandir_req);
607 ASSERT_EQ(req->fs_type, UV_FS_SCANDIR);
608 ASSERT_EQ(2, req->result);
609 ASSERT(req->ptr);
611 while (UV_EOF != uv_fs_scandir_next(req, &dent)) {
616 ASSERT(req->path);
617 ASSERT_OK(memcmp(req->path, "test_dir\0", 9));
618 uv_fs_req_cleanup(req);
619 ASSERT(!req->ptr);
623 static void empty_scandir_cb(uv_fs_t* req) {
626 ASSERT_PTR_EQ(req, &scandir_req);
627 ASSERT_EQ(req->fs_type, UV_FS_SCANDIR);
628 ASSERT_OK(req->result);
629 ASSERT_NULL(req->ptr);
630 ASSERT_EQ(UV_EOF, uv_fs_scandir_next(req, &dent));
631 uv_fs_req_cleanup(req);
635 static void non_existent_scandir_cb(uv_fs_t* req) {
638 ASSERT_PTR_EQ(req, &scandir_req);
639 ASSERT_EQ(req->fs_type, UV_FS_SCANDIR);
640 ASSERT_EQ(req->result, UV_ENOENT);
641 ASSERT_NULL(req->ptr);
642 ASSERT_EQ(UV_ENOENT, uv_fs_scandir_next(req, &dent));
643 uv_fs_req_cleanup(req);
648 static void file_scandir_cb(uv_fs_t* req) {
649 ASSERT_PTR_EQ(req, &scandir_req);
650 ASSERT_EQ(req->fs_type, UV_FS_SCANDIR);
651 ASSERT_EQ(req->result, UV_ENOTDIR);
652 ASSERT_NULL(req->ptr);
653 uv_fs_req_cleanup(req);
658 static void stat_cb(uv_fs_t* req) {
659 ASSERT_PTR_EQ(req, &stat_req);
660 ASSERT(req->fs_type == UV_FS_STAT || req->fs_type == UV_FS_LSTAT);
661 ASSERT_OK(req->result);
662 ASSERT(req->ptr);
664 uv_fs_req_cleanup(req);
665 ASSERT(!req->ptr);
668 static void stat_batch_cb(uv_fs_t* req) {
669 ASSERT(req->fs_type == UV_FS_STAT || req->fs_type == UV_FS_LSTAT);
670 ASSERT_OK(req->result);
671 ASSERT(req->ptr);
673 uv_fs_req_cleanup(req);
674 ASSERT(!req->ptr);
678 static void sendfile_cb(uv_fs_t* req) {
679 ASSERT_PTR_EQ(req, &sendfile_req);
680 ASSERT_EQ(req->fs_type, UV_FS_SENDFILE);
681 ASSERT_EQ(65545, req->result);
683 uv_fs_req_cleanup(req);
687 static void sendfile_nodata_cb(uv_fs_t* req) {
688 ASSERT_PTR_EQ(req, &sendfile_req);
689 ASSERT_EQ(req->fs_type, UV_FS_SENDFILE);
690 ASSERT_OK(req->result);
692 uv_fs_req_cleanup(req);
696 static void open_noent_cb(uv_fs_t* req) {
697 ASSERT_EQ(req->fs_type, UV_FS_OPEN);
698 ASSERT_EQ(req->result, UV_ENOENT);
700 uv_fs_req_cleanup(req);
703 static void open_nametoolong_cb(uv_fs_t* req) {
704 ASSERT_EQ(req->fs_type, UV_FS_OPEN);
705 ASSERT_EQ(req->result, UV_ENAMETOOLONG);
707 uv_fs_req_cleanup(req);
710 static void open_loop_cb(uv_fs_t* req) {
711 ASSERT_EQ(req->fs_type, UV_FS_OPEN);
712 ASSERT_EQ(req->result, UV_ELOOP);
714 uv_fs_req_cleanup(req);
719 uv_fs_t req;
724 r = uv_fs_open(NULL, &req, "does_not_exist", UV_FS_O_RDONLY, 0, NULL);
726 ASSERT_EQ(req.result, UV_ENOENT);
727 uv_fs_req_cleanup(&req);
729 r = uv_fs_open(loop, &req, "does_not_exist", UV_FS_O_RDONLY, 0,
744 uv_fs_t req;
753 r = uv_fs_open(NULL, &req, name, UV_FS_O_RDONLY, 0, NULL);
755 ASSERT_EQ(req.result, UV_ENAMETOOLONG);
756 uv_fs_req_cleanup(&req);
758 r = uv_fs_open(loop, &req, name, UV_FS_O_RDONLY, 0, open_nametoolong_cb);
770 uv_fs_t req;
776 r = uv_fs_symlink(NULL, &req, "test_symlink", "test_symlink", 0, NULL);
791 uv_fs_req_cleanup(&req);
793 r = uv_fs_open(NULL, &req, "test_symlink", UV_FS_O_RDONLY, 0, NULL);
795 ASSERT_EQ(req.result, UV_ELOOP);
796 uv_fs_req_cleanup(&req);
798 r = uv_fs_open(loop, &req, "test_symlink", UV_FS_O_RDONLY, 0, open_loop_cb);
816 uv_fs_t req;
820 r = uv_fs_lstat(loop, &req, path, NULL);
822 r = uv_fs_stat(loop, &req, path, NULL);
826 ASSERT_OK(req.result);
827 s = &req.statbuf;
868 uv_fs_req_cleanup(&req);
872 static void utime_cb(uv_fs_t* req) {
875 ASSERT_PTR_EQ(req, &utime_req);
876 ASSERT_OK(req->result);
877 ASSERT_EQ(req->fs_type, UV_FS_UTIME);
879 c = req->data;
882 uv_fs_req_cleanup(req);
887 static void futime_cb(uv_fs_t* req) {
890 ASSERT_PTR_EQ(req, &futime_req);
891 ASSERT_OK(req->result);
892 ASSERT_EQ(req->fs_type, UV_FS_FUTIME);
894 c = req->data;
897 uv_fs_req_cleanup(req);
902 static void lutime_cb(uv_fs_t* req) {
905 ASSERT_OK(req->result);
906 ASSERT_EQ(req->fs_type, UV_FS_LUTIME);
908 c = req->data;
911 uv_fs_req_cleanup(req);
1208 uv_fs_t req;
1267 r = uv_fs_read(NULL, &req, open_req1.result, &iov, 1, -1, NULL);
1269 ASSERT_GE(req.result, 0);
1271 uv_fs_req_cleanup(&req);
1337 uv_fs_t req;
1365 r = uv_fs_write(NULL, &req, mkstemp_req1.result, &iov, 1, -1, NULL);
1367 ASSERT_EQ(req.result, sizeof(test_buf));
1368 uv_fs_req_cleanup(&req);
1371 uv_fs_close(NULL, &req, mkstemp_req1.result, NULL);
1372 uv_fs_req_cleanup(&req);
1373 uv_fs_close(NULL, &req, mkstemp_req2.result, NULL);
1374 uv_fs_req_cleanup(&req);
1376 fd = uv_fs_open(NULL, &req, mkstemp_req1.path, UV_FS_O_RDONLY, 0, NULL);
1378 uv_fs_req_cleanup(&req);
1382 r = uv_fs_read(NULL, &req, fd, &iov, 1, -1, NULL);
1384 ASSERT_GE(req.result, 0);
1386 uv_fs_req_cleanup(&req);
1388 uv_fs_close(NULL, &req, fd, NULL);
1389 uv_fs_req_cleanup(&req);
1403 uv_fs_t req;
1422 r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
1425 ASSERT_GE(req.result, 0);
1426 file = req.result;
1427 uv_fs_req_cleanup(&req);
1432 ASSERT_OK(uv_fs_fstat(NULL, &req, file, NULL));
1433 ASSERT_OK(req.result);
1434 s = req.ptr;
1450 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1452 ASSERT_EQ(req.result, sizeof(test_buf));
1453 uv_fs_req_cleanup(&req);
1455 memset(&req.statbuf, 0xaa, sizeof(req.statbuf));
1456 r = uv_fs_fstat(NULL, &req, file, NULL);
1458 ASSERT_OK(req.result);
1459 s = req.ptr;
1537 uv_fs_req_cleanup(&req);
1540 r = uv_fs_fstat(loop, &req, file, fstat_cb);
1546 r = uv_fs_close(NULL, &req, file, NULL);
1548 ASSERT_OK(req.result);
1549 uv_fs_req_cleanup(&req);
1568 uv_fs_t req;
1575 res = uv_fs_fstat(NULL, &req, fd, NULL);
1577 ASSERT_OK(req.result);
1580 st = req.ptr;
1596 uv_fs_req_cleanup(&req);
1606 uv_fs_t req;
1616 r = uv_fs_access(NULL, &req, "test_file", F_OK, NULL);
1618 ASSERT_LT(req.result, 0);
1619 uv_fs_req_cleanup(&req);
1622 r = uv_fs_access(loop, &req, "test_file", F_OK, access_cb);
1629 r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
1632 ASSERT_GE(req.result, 0);
1633 file = req.result;
1634 uv_fs_req_cleanup(&req);
1637 r = uv_fs_access(NULL, &req, "test_file", F_OK, NULL);
1639 ASSERT_OK(req.result);
1640 uv_fs_req_cleanup(&req);
1643 r = uv_fs_access(loop, &req, "test_file", F_OK, access_cb);
1650 r = uv_fs_close(NULL, &req, file, NULL);
1652 ASSERT_OK(req.result);
1653 uv_fs_req_cleanup(&req);
1656 r = uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL);
1658 uv_fs_req_cleanup(&req);
1660 r = uv_fs_access(NULL, &req, "test_dir", W_OK, NULL);
1662 ASSERT_OK(req.result);
1663 uv_fs_req_cleanup(&req);
1682 uv_fs_t req;
1690 r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
1693 ASSERT_GE(req.result, 0);
1694 file = req.result;
1695 uv_fs_req_cleanup(&req);
1698 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1700 ASSERT_EQ(req.result, sizeof(test_buf));
1701 uv_fs_req_cleanup(&req);
1705 r = uv_fs_chmod(NULL, &req, "test_file", 0200, NULL);
1707 ASSERT_OK(req.result);
1708 uv_fs_req_cleanup(&req);
1714 r = uv_fs_chmod(NULL, &req, "test_file", 0400, NULL);
1716 ASSERT_OK(req.result);
1717 uv_fs_req_cleanup(&req);
1722 r = uv_fs_fchmod(NULL, &req, file, 0600, NULL);
1724 ASSERT_OK(req.result);
1725 uv_fs_req_cleanup(&req);
1733 req.data = &mode;
1735 r = uv_fs_chmod(loop, &req, "test_file", 0200, chmod_cb);
1745 req.data = &mode;
1747 r = uv_fs_chmod(loop, &req, "test_file", 0400, chmod_cb);
1755 req.data = &mode;
1757 r = uv_fs_fchmod(loop, &req, file, 0600, fchmod_cb);
1762 uv_fs_close(loop, &req, file, NULL);
1780 uv_fs_t req;
1789 &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
1793 ASSERT_GE(req.result, 0);
1794 file = req.result;
1795 uv_fs_req_cleanup(&req);
1798 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1800 ASSERT_EQ(req.result, sizeof(test_buf));
1801 uv_fs_req_cleanup(&req);
1803 uv_fs_close(loop, &req, file, NULL);
1806 r = uv_fs_chmod(NULL, &req, "test_file", 0400, NULL);
1808 ASSERT_OK(req.result);
1809 uv_fs_req_cleanup(&req);
1814 r = uv_fs_unlink(NULL, &req, "test_file", NULL);
1816 ASSERT_OK(req.result);
1817 uv_fs_req_cleanup(&req);
1826 uv_fs_chmod(NULL, &req, "test_file", 0600, NULL);
1827 uv_fs_req_cleanup(&req);
1837 uv_fs_t req;
1846 &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
1850 ASSERT_GE(req.result, 0);
1851 file = req.result;
1852 uv_fs_req_cleanup(&req);
1855 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
1857 ASSERT_EQ(req.result, sizeof(test_buf));
1858 uv_fs_req_cleanup(&req);
1860 uv_fs_close(loop, &req, file, NULL);
1865 uv_fs_req_cleanup(&req);
1870 r = uv_fs_unlink(NULL, &req, "test_file", NULL);
1872 ASSERT_OK(req.result);
1873 uv_fs_req_cleanup(&req);
1882 uv_fs_chmod(NULL, &req, "test_file", 0600, NULL);
1883 uv_fs_req_cleanup(&req);
1893 uv_fs_t req;
1902 r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
1905 ASSERT_GE(req.result, 0);
1906 file = req.result;
1907 uv_fs_req_cleanup(&req);
1910 r = uv_fs_chown(NULL, &req, "test_file", -1, -1, NULL);
1912 ASSERT_OK(req.result);
1913 uv_fs_req_cleanup(&req);
1916 r = uv_fs_fchown(NULL, &req, file, -1, -1, NULL);
1918 ASSERT_OK(req.result);
1919 uv_fs_req_cleanup(&req);
1922 r = uv_fs_chown(loop, &req, "test_file", -1, -1, chown_cb);
1930 r = uv_fs_chown(loop, &req, "test_file", 0, 0, chown_root_cb);
1937 r = uv_fs_fchown(loop, &req, file, -1, -1, fchown_cb);
1945 r = uv_fs_link(NULL, &req, "test_file", "test_file_link", NULL);
1947 ASSERT_OK(req.result);
1948 uv_fs_req_cleanup(&req);
1951 r = uv_fs_lchown(NULL, &req, "test_file_link", -1, -1, NULL);
1953 ASSERT_OK(req.result);
1954 uv_fs_req_cleanup(&req);
1957 r = uv_fs_lchown(loop, &req, "test_file_link", -1, -1, lchown_cb);
1964 r = uv_fs_close(NULL, &req, file, NULL);
1966 ASSERT_OK(req.result);
1967 uv_fs_req_cleanup(&req);
1986 uv_fs_t req;
1997 r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
2000 ASSERT_GE(req.result, 0);
2001 file = req.result;
2002 uv_fs_req_cleanup(&req);
2005 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
2007 ASSERT_EQ(req.result, sizeof(test_buf));
2008 uv_fs_req_cleanup(&req);
2010 uv_fs_close(loop, &req, file, NULL);
2013 r = uv_fs_link(NULL, &req, "test_file", "test_file_link", NULL);
2015 ASSERT_OK(req.result);
2016 uv_fs_req_cleanup(&req);
2018 r = uv_fs_open(NULL, &req, "test_file_link", UV_FS_O_RDWR, 0, NULL);
2020 ASSERT_GE(req.result, 0);
2021 link = req.result;
2022 uv_fs_req_cleanup(&req);
2026 r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL);
2028 ASSERT_GE(req.result, 0);
2034 r = uv_fs_link(loop, &req, "test_file", "test_file_link2", link_cb);
2039 r = uv_fs_open(NULL, &req, "test_file_link2", UV_FS_O_RDWR, 0, NULL);
2041 ASSERT_GE(req.result, 0);
2042 link = req.result;
2043 uv_fs_req_cleanup(&req);
2047 r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL);
2049 ASSERT_GE(req.result, 0);
2052 uv_fs_close(loop, &req, link, NULL);
2073 uv_fs_t req;
2076 ASSERT_OK(uv_fs_readlink(loop, &req, "no_such_file", dummy_cb));
2079 ASSERT_NULL(req.ptr);
2080 ASSERT_EQ(req.result, UV_ENOENT);
2081 uv_fs_req_cleanup(&req);
2083 ASSERT_EQ(UV_ENOENT, uv_fs_readlink(NULL, &req, "no_such_file", NULL));
2084 ASSERT_NULL(req.ptr);
2085 ASSERT_EQ(req.result, UV_ENOENT);
2086 uv_fs_req_cleanup(&req);
2092 uv_fs_t req;
2098 r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
2101 ASSERT_GE(req.result, 0);
2102 file = req.result;
2103 uv_fs_req_cleanup(&req);
2105 r = uv_fs_close(NULL, &req, file, NULL);
2107 ASSERT_OK(req.result);
2108 uv_fs_req_cleanup(&req);
2111 r = uv_fs_readlink(NULL, &req, "test_file", NULL);
2113 uv_fs_req_cleanup(&req);
2125 uv_fs_t req;
2128 ASSERT_OK(uv_fs_realpath(loop, &req, "no_such_file", dummy_cb));
2131 ASSERT_NULL(req.ptr);
2132 ASSERT_EQ(req.result, UV_ENOENT);
2133 uv_fs_req_cleanup(&req);
2135 ASSERT_EQ(UV_ENOENT, uv_fs_realpath(NULL, &req, "no_such_file", NULL));
2136 ASSERT_NULL(req.ptr);
2137 ASSERT_EQ(req.result, UV_ENOENT);
2138 uv_fs_req_cleanup(&req);
2147 uv_fs_t req;
2170 r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDWR | UV_FS_O_CREAT,
2173 ASSERT_GE(req.result, 0);
2174 file = req.result;
2175 uv_fs_req_cleanup(&req);
2178 r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
2180 ASSERT_EQ(req.result, sizeof(test_buf));
2181 uv_fs_req_cleanup(&req);
2183 uv_fs_close(loop, &req, file, NULL);
2186 r = uv_fs_symlink(NULL, &req, "test_file", "test_file_symlink", 0, NULL);
2205 ASSERT_OK(req.result);
2206 uv_fs_req_cleanup(&req);
2208 r = uv_fs_open(NULL, &req, "test_file_symlink", UV_FS_O_RDWR, 0, NULL);
2210 ASSERT_GE(req.result, 0);
2211 link = req.result;
2212 uv_fs_req_cleanup(&req);
2216 r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL);
2218 ASSERT_GE(req.result, 0);
2221 uv_fs_close(loop, &req, link, NULL);
2224 &req,
2230 uv_fs_req_cleanup(&req);
2236 r = uv_fs_readlink(NULL, &req, "test_file_symlink_symlink", NULL);
2238 ASSERT_OK(strcmp(req.ptr, "test_file_symlink"));
2239 uv_fs_req_cleanup(&req);
2241 r = uv_fs_realpath(NULL, &req, "test_file_symlink_symlink", NULL);
2244 ASSERT_OK(_stricmp(req.ptr, test_file_abs_buf));
2246 ASSERT_OK(strcmp(req.ptr, test_file_abs_buf));
2248 uv_fs_req_cleanup(&req);
2252 &req,
2261 r = uv_fs_open(NULL, &req, "test_file_symlink2", UV_FS_O_RDWR, 0, NULL);
2263 ASSERT_GE(req.result, 0);
2264 link = req.result;
2265 uv_fs_req_cleanup(&req);
2269 r = uv_fs_read(NULL, &req, link, &iov, 1, 0, NULL);
2271 ASSERT_GE(req.result, 0);
2274 uv_fs_close(loop, &req, link, NULL);
2277 &req,
2283 uv_fs_req_cleanup(&req);
2285 r = uv_fs_readlink(loop, &req, "test_file_symlink2_symlink", readlink_cb);
2290 r = uv_fs_realpath(loop, &req, "test_file", realpath_cb);
2314 uv_fs_t req;
2330 uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL);
2331 uv_fs_req_cleanup(&req);
2347 r = uv_fs_symlink(NULL, &req, test_dir, "test_dir_symlink", type, NULL);
2349 uv_fs_req_cleanup(&req);
2355 ASSERT_OK(req.result);
2356 uv_fs_req_cleanup(&req);
2358 r = uv_fs_stat(NULL, &req, "test_dir_symlink", NULL);
2360 ASSERT(((uv_stat_t*)req.ptr)->st_mode & S_IFDIR);
2361 uv_fs_req_cleanup(&req);
2363 r = uv_fs_lstat(NULL, &req, "test_dir_symlink", NULL);
2368 ASSERT(((uv_stat_t*)req.ptr)->st_mode & S_IFLNK);
2370 ASSERT_EQ(((uv_stat_t*)req.ptr)->st_size, strlen(test_dir + 4));
2374 ASSERT_EQ(((uv_stat_t*)req.ptr)->st_size, strlen("test_dir_symlink"));
2376 ASSERT_EQ(((uv_stat_t*)req.ptr)->st_size, strlen(test_dir));
2379 uv_fs_req_cleanup(&req);
2381 r = uv_fs_readlink(NULL, &req, "test_dir_symlink", NULL);
2384 ASSERT_OK(strcmp(req.ptr, test_dir + 4));
2386 ASSERT_OK(strcmp(req.ptr, test_dir));
2388 uv_fs_req_cleanup(&req);
2390 r = uv_fs_realpath(NULL, &req, "test_dir_symlink", NULL);
2393 ASSERT_EQ(strlen(req.ptr), test_dir_abs_size - 5);
2394 ASSERT_OK(_strnicmp(req.ptr, test_dir + 4, test_dir_abs_size - 5));
2396 ASSERT_OK(strcmp(req.ptr, test_dir_abs_buf));
2398 uv_fs_req_cleanup(&req);
2430 r = uv_fs_unlink(NULL, &req, "test_dir_symlink", NULL);
2432 uv_fs_req_cleanup(&req);
2469 uv_fs_t req;
2482 uv_fs_mkdir(NULL, &req, "test_dir", 0777, NULL);
2483 uv_fs_req_cleanup(&req);
2512 r = uv_fs_readlink(NULL, &req, "test_dir/test_file", NULL);
2514 uv_fs_req_cleanup(&req);
2521 r = uv_fs_stat(NULL, &req, "\\\\<mac_ip>\\Macintosh HD\\.DS_Store", NULL);
2523 uv_fs_req_cleanup(&req);
2525 r = uv_fs_lstat(NULL, &req, "\\\\<mac_ip>\\Macintosh HD\\.DS_Store", NULL);
2527 uv_fs_req_cleanup(&req);
2536 r = uv_fs_stat(NULL, &req, "test_dir/test_file", NULL);
2538 uv_fs_req_cleanup(&req);
2540 r = uv_fs_lstat(NULL, &req, "test_dir/test_file", NULL);
2542 uv_fs_req_cleanup(&req);
2575 uv_fs_t req;
2593 if (uv_fs_opendir(loop, &req, windowsapps_path, NULL) != 0) {
2598 if (uv_fs_scandir(loop, &req, windowsapps_path, 0, NULL) <= 0) {
2602 while (uv_fs_scandir_next(&req, &dirent) != UV_EOF) {
2626 uv_fs_t req;
2632 r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT,
2636 ASSERT_GE(req.result, 0);
2637 uv_fs_req_cleanup(&req);
2638 uv_fs_close(loop, &req, r, NULL);
2642 r = uv_fs_utime(NULL, &req, path, atime, mtime, NULL);
2644 ASSERT_OK(req.result);
2645 uv_fs_req_cleanup(&req);
2673 uv_fs_t req;
2678 r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT,
2682 ASSERT_GE(req.result, 0);
2683 uv_fs_req_cleanup(&req);
2684 ASSERT_OK(uv_fs_close(loop, &req, r, NULL));
2688 r = uv_fs_utime(NULL, &req, path, atime, mtime, NULL);
2700 ASSERT_OK(req.result);
2701 uv_fs_req_cleanup(&req);
2748 uv_fs_t req;
2757 r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT,
2761 ASSERT_GE(req.result, 0);
2762 uv_fs_req_cleanup(&req);
2763 uv_fs_close(loop, &req, r, NULL);
2767 r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR, 0, NULL);
2769 ASSERT_GE(req.result, 0);
2770 file = req.result; /* FIXME probably not how it's supposed to be used */
2771 uv_fs_req_cleanup(&req);
2773 r = uv_fs_futime(NULL, &req, file, atime, mtime, NULL);
2779 ASSERT_OK(req.result);
2781 uv_fs_req_cleanup(&req);
2812 uv_fs_t req;
2819 r = uv_fs_open(NULL, &req, path, UV_FS_O_RDWR | UV_FS_O_CREAT,
2823 ASSERT_GE(req.result, 0);
2824 uv_fs_req_cleanup(&req);
2825 uv_fs_close(loop, &req, r, NULL);
2828 s = uv_fs_symlink(NULL, &req, path, symlink_path, 0, NULL);
2840 ASSERT_OK(req.result);
2841 uv_fs_req_cleanup(&req);
2849 req.data = &checkme;
2851 r = uv_fs_lutime(NULL, &req, symlink_path, atime, mtime, NULL);
2858 lutime_cb(&req);
2868 r = uv_fs_lutime(loop, &req, symlink_path, atime, mtime, lutime_cb);
2883 uv_fs_t req;
2888 r = uv_fs_stat(NULL, &req, "non_existent_file", NULL);
2890 ASSERT_EQ(req.result, UV_ENOENT);
2891 uv_fs_req_cleanup(&req);
2900 uv_fs_t req;
2907 uv_fs_mkdir(NULL, &req, path, 0777, NULL);
2908 uv_fs_req_cleanup(&req);
2910 /* Fill the req to ensure that required fields are cleaned up */
2911 memset(&req, 0xdb, sizeof(req));
2913 r = uv_fs_scandir(NULL, &req, path, 0, NULL);
2915 ASSERT_OK(req.result);
2916 ASSERT_NULL(req.ptr);
2917 ASSERT_EQ(UV_EOF, uv_fs_scandir_next(&req, &dent));
2918 uv_fs_req_cleanup(&req);
2927 uv_fs_rmdir(NULL, &req, path, NULL);
2928 uv_fs_req_cleanup(&req);
2937 uv_fs_t req;
2944 uv_fs_rmdir(NULL, &req, path, NULL);
2945 uv_fs_req_cleanup(&req);
2947 /* Fill the req to ensure that required fields are cleaned up */
2948 memset(&req, 0xdb, sizeof(req));
2950 r = uv_fs_scandir(NULL, &req, path, 0, NULL);
2952 ASSERT_EQ(req.result, UV_ENOENT);
2953 ASSERT_NULL(req.ptr);
2954 ASSERT_EQ(UV_ENOENT, uv_fs_scandir_next(&req, &dent));
2955 uv_fs_req_cleanup(&req);
2994 uv_fs_t req;
2996 ASSERT_LT(0, uv_fs_scandir(NULL, &req, "test/fixtures/one_file", 0, NULL));
2997 ASSERT_NE(UV_EOF, uv_fs_scandir_next(&req, &d));
2998 uv_fs_req_cleanup(&req);
3000 ASSERT_LT(0, uv_fs_scandir(NULL, &req, "test/fixtures", 0, NULL));
3001 ASSERT_NE(UV_EOF, uv_fs_scandir_next(&req, &d));
3002 uv_fs_req_cleanup(&req);
3011 uv_fs_t req;
3017 r = uv_fs_open(NULL, &req, path, UV_FS_O_RDONLY, 0, NULL);
3019 ASSERT_GE(req.result, 0);
3020 ASSERT_NULL(req.ptr);
3022 uv_fs_req_cleanup(&req);
3024 r = uv_fs_close(NULL, &req, file, NULL);
3027 r = uv_fs_open(loop, &req, path, UV_FS_O_RDONLY, 0, open_cb_simple);
4393 uv_fs_t req;
4413 uv_fs_chmod(loop, &req, "test_file_icacls", S_IWUSR, NULL);
4469 uv_fs_t req;
4477 &req, "test_file", UV_FS_O_WRONLY | UV_FS_O_CREAT,
4481 ASSERT_GE(req.result, 0);
4482 file = req.result;
4483 uv_fs_req_cleanup(&req);
4484 r = uv_fs_close(NULL, &req, file, NULL);
4486 uv_fs_req_cleanup(&req);
4492 r = uv_fs_open(NULL, &req, "test_file", UV_FS_O_RDONLY, 0, NULL);
4494 ASSERT_GE(req.result, 0);
4495 file = req.result;
4496 uv_fs_req_cleanup(&req);
4497 r = uv_fs_fchmod(NULL, &req, file, S_IWUSR, NULL);
4499 ASSERT_OK(req.result);
4500 uv_fs_req_cleanup(&req);
4501 r = uv_fs_close(NULL, &req, file, NULL);
4503 uv_fs_req_cleanup(&req);
4515 uv_fs_t req;
4519 r = uv_fs_mkdir(loop, &req, "invalid>", 0, NULL);
4521 ASSERT_EQ(UV_EINVAL, uv_fs_mkdir(loop, &req, "test:lol", 0, NULL));
4528 uv_fs_t req;
4534 r = uv_fs_statfs(NULL, &req, ".", NULL);
4536 statfs_cb(&req);
4540 r = uv_fs_statfs(loop, &req, ".", statfs_cb);
4550 uv_fs_t req;
4554 r = uv_fs_statfs(NULL, &req, "non_existing_file", NULL);
4557 system_error = uv_fs_get_system_error(&req);
4569 uv_fs_t req[300];
4580 for (i = 0; i < (int) ARRAY_SIZE(req); ++i) {
4581 r = uv_fs_stat(loop, &req[i], "test_dir", stat_batch_cb);
4586 ASSERT_EQ(stat_cb_count, ARRAY_SIZE(req));