Home
last modified time | relevance | path

Searched refs:dir_fd (Results 1 – 25 of 38) sorted by relevance

12

/third_party/python/Lib/
Dglob.py13 def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False): argument
24 return list(iglob(pathname, root_dir=root_dir, dir_fd=dir_fd, recursive=recursive))
26 def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False): argument
38 sys.audit("glob.glob/2", pathname, recursive, root_dir, dir_fd)
43 it = _iglob(pathname, root_dir, dir_fd, recursive, False)
53 def _iglob(pathname, root_dir, dir_fd, recursive, dironly): argument
58 if _lexists(_join(root_dir, pathname), dir_fd):
62 if _isdir(_join(root_dir, dirname), dir_fd):
67 yield from _glob2(root_dir, basename, dir_fd, dironly)
69 yield from _glob1(root_dir, basename, dir_fd, dironly)
[all …]
/third_party/musl/libc-test/src/functionalext/supplement/stat/
Dfutimesat.c32 int dir_fd = open(path, O_RDONLY | O_DIRECTORY); in futimesat_0100() local
33 if (dir_fd < 0) { in futimesat_0100()
37 int fd = openat(dir_fd, "test.txt", O_CREAT | O_RDWR | O_EXCL, 0666); in futimesat_0100()
56 int result = futimesat(dir_fd, "test.txt", tv); in futimesat_0100()
62 if (fstatat(dir_fd, "test.txt", &st2, 0) != 0) { in futimesat_0100()
70 if (unlinkat(dir_fd, "test.txt", 0) != 0) { in futimesat_0100()
74 close(dir_fd); in futimesat_0100()
84 int dir_fd = open(path, O_RDONLY | O_DIRECTORY); in futimesat_0200() local
85 if (dir_fd < 0) { in futimesat_0200()
89 int fd = openat(dir_fd, "test.txt", O_CREAT | O_RDWR | O_EXCL, 0666); in futimesat_0200()
[all …]
/third_party/ltp/testcases/kernel/syscalls/name_to_handle_at/
Dname_to_handle_at01.c24 static int dir_fd, fd_atcwd = AT_FDCWD, file_fd; variable
33 {&dir_fd, TEST_FILE, 0, O_RDWR},
34 {&dir_fd, TEST_FILE, 0, O_RDONLY},
35 {&dir_fd, TEST_FILE, 0, O_WRONLY},
36 {&dir_fd, TEST_FILE, AT_EMPTY_PATH, O_RDWR},
37 {&dir_fd, TEST_FILE, AT_EMPTY_PATH, O_RDONLY},
38 {&dir_fd, TEST_FILE, AT_EMPTY_PATH, O_WRONLY},
39 {&dir_fd, TEST_FILE, AT_SYMLINK_FOLLOW, O_RDWR},
40 {&dir_fd, TEST_FILE, AT_SYMLINK_FOLLOW, O_RDONLY},
41 {&dir_fd, TEST_FILE, AT_SYMLINK_FOLLOW, O_WRONLY},
[all …]
/third_party/ltp/testcases/kernel/syscalls/openat/
Dopenat01.c40 static int dir_fd, fd; variable
46 int *dir_fd; member
51 {&dir_fd, TEST_FILE, 0, 0},
52 {&dir_fd, glob_path, 0, 0},
64 TST_EXP_FAIL2(openat(*tc->dir_fd, tc->pathname, O_RDWR, 0600), in verify_openat()
67 TST_EXP_FAIL2(openat(*tc->dir_fd, tc->pathname, O_RDWR, 0600), in verify_openat()
71 TST_EXP_FD(openat(*tc->dir_fd, tc->pathname, O_RDWR, 0600)); in verify_openat()
84 dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); in setup()
94 if (dir_fd > 0) in cleanup()
95 SAFE_CLOSE(dir_fd); in cleanup()
Dopenat04.c44 static int tmpfile_fd = -1, dir_fd = -1, mount_flag; variable
98 dir_fd = SAFE_OPEN(WORKDIR, O_RDONLY, O_DIRECTORY); in setup()
99 open_tmpfile_supported(dir_fd); in setup()
142 tmpfile_fd = SAFE_OPENAT(dir_fd, ".", O_TMPFILE | O_RDWR, MODE_SGID); in run()
144 SAFE_LINKAT(AT_FDCWD, path, dir_fd, OPEN_FILE, AT_SYMLINK_FOLLOW); in run()
145 file_test(dir_fd, OPEN_FILE, 0); in run()
157 if (dir_fd >= 0) in cleanup()
158 SAFE_CLOSE(dir_fd); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/openat2/
Dopenat201.c16 static int dir_fd = -1, fd_atcwd = AT_FDCWD; variable
27 {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, 0, &how, sizeof(*how)},
28 {&dir_fd, TEST_FILE, O_RDONLY, S_IRUSR, 0, &how, sizeof(*how)},
29 {&dir_fd, TEST_FILE, O_WRONLY, S_IWUSR, 0, &how, sizeof(*how)},
30 {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_XDEV, &how, sizeof(*how)},
31 {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_MAGICLINKS, &how, sizeof(*how)},
32 {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_NO_SYMLINKS, &how, sizeof(*how)},
33 {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_BENEATH, &how, sizeof(*how)},
34 {&dir_fd, TEST_FILE, O_RDWR, S_IRWXU, RESOLVE_IN_ROOT, &how, sizeof(*how)},
47 if (dir_fd != -1) in cleanup()
[all …]
/third_party/ltp/testcases/kernel/syscalls/readlinkat/
Dreadlinkat02.c32 static int file_fd, dir_fd; variable
41 {&dir_fd, SYMLINK_FILE, 0, EINVAL},
42 {&dir_fd, TEST_FILE, BUFF_SIZE, EINVAL},
44 {&dir_fd, "test_file/test_file", BUFF_SIZE, ENOTDIR},
46 {&dir_fd, "does_not_exists", BUFF_SIZE, ENOENT},
63 dir_fd = SAFE_OPEN(".", O_RDONLY); in setup()
75 if (dir_fd > -1) in cleanup()
76 SAFE_CLOSE(dir_fd); in cleanup()
Dreadlinkat01.c32 static int file_fd, dir_fd, dir_fd2; variable
42 {&dir_fd, &testsymlink},
43 {&dir_fd, &abspath},
76 dir_fd = SAFE_OPEN(".", O_DIRECTORY); in setup()
85 if (dir_fd > -1) in cleanup()
86 SAFE_CLOSE(dir_fd); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/mknodat/
Dmknodat02.c56 static int dir_fd; variable
63 int *dir_fd; member
71 { &dir_fd, "tnode4", FIFOMODE, EROFS },
72 { &dir_fd, "tnode5", FREGMODE, EROFS },
73 { &dir_fd, "tnode6", SOCKMODE, EROFS },
130 dir_fd = SAFE_OPEN(cleanup, MNT_POINT, O_DIRECTORY); in setup()
144 int fd = *(tc->dir_fd); in mknodat_verify()
169 if (dir_fd > 0 && close(dir_fd) < 0) in cleanup()
170 tst_resm(TWARN | TERRNO, "close(%d) failed", dir_fd); in cleanup()
Dmknodat01.c51 static int dir_fd, fd; variable
56 int *dir_fd; member
61 {&dir_fd, testfile, 0, 0},
62 {&dir_fd, testfile3, 0, 0},
75 TEST(mknodat(*test->dir_fd, test->name, S_IFREG, dev)); in verify_mknodat()
137 dir_fd = SAFE_OPEN(cleanup, PATHNAME, O_DIRECTORY); in setup()
150 if (dir_fd > 0 && close(dir_fd)) in cleanup()
/third_party/ltp/lib/
Dtst_cgroup.c46 int dir_fd; member
372 if (!mkdirat(parent->dir_fd, dir_name, 0777)) { in cgroup_dir_mk()
380 dpath = tst_decode_fd(parent->dir_fd); in cgroup_dir_mk()
392 parent->dir_fd, dpath, dir_name); in cgroup_dir_mk()
396 new->dir_fd = SAFE_OPENAT(parent->dir_fd, dir_name, in cgroup_dir_mk()
615 root->mnt_dir.dir_fd = mnt_dfd; in cgroup_root_scan()
756 SAFE_FILE_PRINTFAT(ctrl->ctrl_root->mnt_dir.dir_fd, in cgroup_mount_v1()
771 SAFE_FILE_READAT(root->mnt_dir.dir_fd, in cgroup_copy_cpuset()
773 SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd, in cgroup_copy_cpuset()
870 SAFE_FILE_PRINTFAT(root->mnt_dir.dir_fd, in tst_cg_require()
[all …]
/third_party/ltp/testcases/kernel/syscalls/mkdirat/
Dmkdirat01.c46 static int dir_fd, fd; variable
51 int *dir_fd; member
56 {&dir_fd, relpath, 0, 0},
57 {&dir_fd, abspath, 0, 0},
68 TEST(mkdirat(*test->dir_fd, test->name, 0600)); in verify_mkdirat()
100 dir_fd = SAFE_OPEN(cleanup, testdir, O_DIRECTORY); in setup_iteration()
105 SAFE_CLOSE(cleanup, dir_fd); in cleanup_iteration()
Dmkdirat02.c21 static int dir_fd; variable
30 {&dir_fd, TEST_DIR, EROFS},
32 {&dir_fd, test_dir, ELOOP},
40 dir_fd = SAFE_OPEN(".", O_DIRECTORY); in setup()
/third_party/ltp/testcases/kernel/syscalls/faccessat/
Dfaccessat01.c31 static int dir_fd, file_fd; variable
42 {&dir_fd, &test_file, 0},
43 {&dir_fd, &abs_path, 0},
64 dir_fd = SAFE_OPEN(TESTDIR, O_DIRECTORY); in setup()
70 if (dir_fd > -1) in cleanup()
71 SAFE_CLOSE(dir_fd); in cleanup()
Dfaccessat02.c25 static int dir_fd, file_fd; variable
48 dir_fd = SAFE_OPEN(TESTDIR, O_DIRECTORY); in setup()
54 if (dir_fd > -1) in cleanup()
55 SAFE_CLOSE(dir_fd); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/open_by_handle_at/
Dopen_by_handle_at01.c24 static int dir_fd, fd_atcwd = AT_FDCWD, file_fd; variable
33 {&dir_fd, &d_fhp, O_RDWR},
34 {&dir_fd, &d_fhp, O_RDONLY},
35 {&dir_fd, &d_fhp, O_WRONLY},
46 SAFE_CLOSE(dir_fd); in cleanup()
55 dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY); in setup()
70 TEST(name_to_handle_at(dir_fd, TEST_FILE, d_fhp, &mount_id, in setup()
/third_party/ltp/testcases/kernel/syscalls/faccessat2/
Dfaccessat201.c27 static int dir_fd, bad_fd = -1; variable
39 {&dir_fd, &testfile, 0},
42 {&dir_fd, &testfile, AT_EACCESS},
65 dir_fd = SAFE_OPEN(TESTDIR, O_DIRECTORY); in setup()
72 if (dir_fd > -1) in cleanup()
73 SAFE_CLOSE(dir_fd); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/fchownat/
Dfchownat01.c45 static int dir_fd; variable
57 {0, 0, 0, &dir_fd, TESTFILE},
60 {-1, EINVAL, 9999, &dir_fd, TESTFILE},
95 dir_fd = SAFE_OPEN(cleanup, "./", O_DIRECTORY); in setup()
130 if (dir_fd > 0) in cleanup()
131 close(dir_fd); in cleanup()
Dfchownat02.c43 static int dir_fd; variable
82 dir_fd = SAFE_OPEN(cleanup, "./", O_DIRECTORY); in setup()
102 TEST(fchownat(dir_fd, TESTFILE_LINK, set_uid, set_gid, in fchownat_verify()
/third_party/python/Lib/test/
Dtest_glob.py12 dir_fd = None variable in GlobTests
43 self.dir_fd = os.open(self.tempdir, os.O_RDONLY | os.O_DIRECTORY)
45 self.dir_fd = None
48 if self.dir_fd is not None:
49 os.close(self.dir_fd)
88 if self.dir_fd is not None:
90 glob.glob(pattern, dir_fd=self.dir_fd, **kwargs), res2)
92 glob.iglob(pattern, dir_fd=self.dir_fd, **kwargs), res2)
94 glob.glob(bpattern, dir_fd=self.dir_fd, **kwargs), bres2)
96 glob.iglob(bpattern, dir_fd=self.dir_fd, **kwargs), bres2)
[all …]
Dtest_posix.py677 dir_fd=None)
1090 self.assertTrue(posix.access(os_helper.TESTFN, os.R_OK, dir_fd=f))
1100 posix.chmod(os_helper.TESTFN, stat.S_IRUSR | stat.S_IWUSR, dir_fd=f)
1115 posix.chown(os_helper.TESTFN, os.getuid(), os.getgid(), dir_fd=f)
1128 s2 = posix.stat(os_helper.TESTFN, dir_fd=f)
1130 s2 = posix.stat(os_helper.TESTFN, dir_fd=None)
1133 posix.stat, os_helper.TESTFN, dir_fd=posix.getcwd())
1135 posix.stat, os_helper.TESTFN, dir_fd=float(f))
1137 posix.stat, os_helper.TESTFN, dir_fd=10**20)
1146 posix.utime(os_helper.TESTFN, None, dir_fd=f)
[all …]
/third_party/ltp/testcases/kernel/syscalls/statx/
Dstatx12.c29 static int dir_fd = -1, file_fd = -1; variable
36 {MNTPOINT, 1, &dir_fd},
73 dir_fd = SAFE_OPEN(MNTPOINT, O_DIRECTORY); in setup()
79 if (dir_fd > -1) in cleanup()
80 SAFE_CLOSE(dir_fd); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/pread/
Dpread02.c25 static int pipe_fd[2], fd, dir_fd; variable
36 {&dir_fd, K1, 0, "file descriptor is a directory", EISDIR}
56 dir_fd = SAFE_OPEN(PREAD_TEMPDIR, O_RDONLY); in setup()
70 if (dir_fd > 0) in cleanup()
71 SAFE_CLOSE(dir_fd); in cleanup()
/third_party/python/Doc/library/
Dglob.rst39 .. function:: glob(pathname, *, root_dir=None, dir_fd=None, recursive=False)
57 <dir_fd>` with the *dir_fd* parameter.
68 .. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.glob
78 Added the *root_dir* and *dir_fd* parameters.
81 .. function:: iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False)
87 .. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.iglob
93 Added the *root_dir* and *dir_fd* parameters.
/third_party/ltp/testcases/kernel/syscalls/readdir/
Dreaddir21.c30 static unsigned int dir_fd; variable
43 {&dir_fd, (struct old_linux_dirent *)-1,
58 dir_fd = SAFE_OPEN(TEST_DIR4, O_RDONLY | O_DIRECTORY); in setup()

12