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 …]
Dos.py430 def fwalk(top=".", topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=None): argument
463 sys.audit("os.fwalk", top, topdown, onerror, follow_symlinks, dir_fd)
469 orig_st = stat(top, follow_symlinks=False, dir_fd=dir_fd)
470 topfd = open(top, O_RDONLY, dir_fd=dir_fd)
514 orig_st = stat(name, dir_fd=topfd, follow_symlinks=False)
519 dirfd = open(name, O_RDONLY, dir_fd=topfd)
/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/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/lib/
Dtst_cgroup.c48 int dir_fd; member
279 if (!mkdirat(parent->dir_fd, dir_name, 0777)) { in cgroup_dir_mk()
287 dpath = tst_decode_fd(parent->dir_fd); in cgroup_dir_mk()
296 parent->dir_fd, dpath, dir_name); in cgroup_dir_mk()
300 new->dir_fd = SAFE_OPENAT(parent->dir_fd, dir_name, in cgroup_dir_mk()
426 root->mnt_dir.dir_fd = mnt_dfd; in cgroup_root_scan()
550 SAFE_FILE_PRINTFAT(ctrl->ctrl_root->mnt_dir.dir_fd, in cgroup_mount_v1()
565 SAFE_FILE_READAT(root->mnt_dir.dir_fd, in cgroup_copy_cpuset()
567 SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd, in cgroup_copy_cpuset()
648 SAFE_FILE_PRINTFAT(root->mnt_dir.dir_fd, in tst_cgroup_require()
[all …]
/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 },
135 dir_fd = SAFE_OPEN(cleanup, MNT_POINT, O_DIRECTORY); in setup()
149 int fd = *(tc->dir_fd); in mknodat_verify()
174 if (dir_fd > 0 && close(dir_fd) < 0) in cleanup()
175 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()
140 dir_fd = SAFE_OPEN(cleanup, PATHNAME, O_DIRECTORY); in setup()
153 if (dir_fd > 0 && close(dir_fd)) in cleanup()
/third_party/ltp/testcases/kernel/syscalls/openat/
Dopenat01.c46 static int dir_fd, fd; variable
56 int *dir_fd; member
61 {&dir_fd, TEST_FILE, 0, 0},
62 {&dir_fd, glob_path, 0, 0},
72 TEST(openat(*test->dir_fd, test->pathname, O_RDWR, 0600)); in verify_openat()
124 dir_fd = SAFE_OPEN(cleanup, TEST_DIR, O_DIRECTORY); in setup()
140 if (dir_fd > 0 && close(dir_fd)) in cleanup()
/third_party/ltp/testcases/kernel/syscalls/readlinkat/
Dreadlinkat01.c45 static int dir_fd, fd; variable
55 int *dir_fd; member
61 {&dir_fd, TEST_SYMLINK, TEST_FILE, sizeof(TEST_FILE)-1, 0},
62 {&dir_fd, abspath, TEST_FILE, sizeof(TEST_FILE)-1, 0},
76 TEST(readlinkat(*test->dir_fd, test->path, buf, sizeof(buf))); in verify_readlinkat()
129 dir_fd = SAFE_OPEN(cleanup, ".", O_DIRECTORY); in setup()
139 if (dir_fd > 0 && close(dir_fd)) in cleanup()
Dreadlinkat02.c44 static int file_fd, dir_fd; variable
52 {&dir_fd, SYMLINK_FILE, 0, EINVAL},
53 {&dir_fd, TEST_FILE, BUFF_SIZE, EINVAL},
55 {&dir_fd, "test_file/test_file", BUFF_SIZE, ENOTDIR},
90 dir_fd = SAFE_OPEN(cleanup, "./", O_RDONLY); in setup()
118 close(dir_fd); in cleanup()
/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/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/fchownat/
Dfchownat01.c45 static int dir_fd; variable
57 {0, 0, 0, &dir_fd, TESTFILE},
60 {-1, EINVAL, 9999, &dir_fd, TESTFILE},
98 dir_fd = SAFE_OPEN(cleanup, "./", O_DIRECTORY); in setup()
133 if (dir_fd > 0) in cleanup()
134 close(dir_fd); in cleanup()
Dfchownat02.c43 static int dir_fd; variable
85 dir_fd = SAFE_OPEN(cleanup, "./", O_DIRECTORY); in setup()
105 TEST(fchownat(dir_fd, TESTFILE_LINK, set_uid, set_gid, in fchownat_verify()
/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/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/pipe/
Dpipe07.c110 int dir_fd, fd; in record_open_fds() local
116 dir_fd = dirfd(dir); in record_open_fds()
118 if (dir_fd == -1) in record_open_fds()
129 if (fd == dir_fd) in record_open_fds()
/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()
/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.
Dos.rst854 .. audit-event:: os.chmod path,mode,dir_fd os.fchmod
866 .. audit-event:: os.chown path,uid,gid,dir_fd os.fchown
1015 .. function:: open(path, flags, mode=0o777, *, dir_fd=None)
1028 <dir_fd>` with the *dir_fd* parameter.
1043 The *dir_fd* argument.
1649 If the function also supports *dir_fd* or *follow_symlinks* arguments, it's
1654 * **paths relative to directory descriptors:** If *dir_fd* is not ``None``, it
1657 path is absolute, *dir_fd* is ignored. (For POSIX systems, Python will call
1661 You can check whether or not *dir_fd* is supported for a particular function
1679 .. function:: access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)
[all …]
/third_party/python/Modules/
Dposixmodule.c1383 int dir_fd; in dir_fd_unavailable() local
1384 if (!dir_fd_converter(o, &dir_fd)) in dir_fd_unavailable()
1386 if (dir_fd != DEFAULT_DIR_FD) { in dir_fd_unavailable()
1390 *(int *)p = dir_fd; in dir_fd_unavailable()
1415 path_and_dir_fd_invalid(const char *function_name, path_t *path, int dir_fd) in path_and_dir_fd_invalid() argument
1417 if (!path->wide && (dir_fd != DEFAULT_DIR_FD) in path_and_dir_fd_invalid()
1431 dir_fd_and_fd_invalid(const char *function_name, int dir_fd, int fd) in dir_fd_and_fd_invalid() argument
1433 if ((dir_fd != DEFAULT_DIR_FD) && (fd != -1)) { in dir_fd_and_fd_invalid()
1456 dir_fd_and_follow_symlinks_invalid(const char *function_name, int dir_fd, in dir_fd_and_follow_symlinks_invalid() argument
1459 if ((dir_fd != DEFAULT_DIR_FD) && (!follow_symlinks)) { in dir_fd_and_follow_symlinks_invalid()
[all …]
/third_party/python/Modules/clinic/
Dposixmodule.c.h34 os_stat_impl(PyObject *module, path_t *path, int dir_fd, int follow_symlinks);
45 int dir_fd = DEFAULT_DIR_FD; in os_stat() local
59 if (!FSTATAT_DIR_FD_CONVERTER(args[1], &dir_fd)) { in os_stat()
71 return_value = os_stat_impl(module, &path, dir_fd, follow_symlinks); in os_stat()
93 os_lstat_impl(PyObject *module, path_t *path, int dir_fd);
104 int dir_fd = DEFAULT_DIR_FD; in os_lstat() local
116 if (!FSTATAT_DIR_FD_CONVERTER(args[1], &dir_fd)) { in os_lstat()
120 return_value = os_lstat_impl(module, &path, dir_fd); in os_lstat()
165 os_access_impl(PyObject *module, path_t *path, int mode, int dir_fd,
178 int dir_fd = DEFAULT_DIR_FD; in os_access() local
[all …]

12