/freebsd/contrib/netbsd-tests/lib/libc/c063/ |
H A D | t_o_search.c | 78 int dfd; in ATF_TC_BODY() local 85 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 87 ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1); in ATF_TC_BODY() 90 ATF_REQUIRE(fchmod(dfd, 0644) == 0); in ATF_TC_BODY() 92 ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1); in ATF_TC_BODY() 95 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 108 int dfd; in ATF_TC_BODY() local 115 ATF_REQUIRE((dfd = open(DIR, O_RDONLY|O_SEARCH, 0)) != -1); in ATF_TC_BODY() 117 ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1); in ATF_TC_BODY() 120 ATF_REQUIRE(fchmod(dfd, 0644) == 0); in ATF_TC_BODY() [all …]
|
H A D | t_faccessat.c | 59 int dfd; in ATF_TC_BODY() local 66 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 67 ATF_REQUIRE(faccessat(dfd, BASEFILE, F_OK, 0) == 0); in ATF_TC_BODY() 68 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 108 int dfd; in ATF_TC_BODY() local 111 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 112 ATF_REQUIRE(faccessat(dfd, FILEERR, F_OK, 0) == -1); in ATF_TC_BODY() 113 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 123 int dfd; in ATF_TC_BODY() local 131 ATF_REQUIRE((dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0)) != -1); in ATF_TC_BODY() [all …]
|
H A D | t_fstatat.c | 59 int dfd; in ATF_TC_BODY() local 67 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 68 ATF_REQUIRE(fstatat(dfd, BASEFILE, &st1, 0) == 0); in ATF_TC_BODY() 69 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 115 int dfd; in ATF_TC_BODY() local 119 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 120 ATF_REQUIRE(fstatat(dfd, FILEERR, &st, 0) == -1); in ATF_TC_BODY() 121 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 131 int dfd; in ATF_TC_BODY() local 140 ATF_REQUIRE((dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0)) != -1); in ATF_TC_BODY() [all …]
|
H A D | t_utimensat.c | 65 int dfd; in ATF_TC_BODY() local 73 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 74 ATF_REQUIRE(utimensat(dfd, BASEFILE, tptr, 0) == 0); in ATF_TC_BODY() 75 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 128 int dfd; in ATF_TC_BODY() local 131 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 132 ATF_REQUIRE(utimensat(dfd, FILEERR, tptr, 0) == -1); in ATF_TC_BODY() 133 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 143 int dfd; in ATF_TC_BODY() local 151 ATF_REQUIRE((dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0)) != -1); in ATF_TC_BODY() [all …]
|
H A D | t_fchownat.c | 77 int dfd; in ATF_TC_BODY() local 88 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 89 ATF_REQUIRE(fchownat(dfd, BASEFILE, uid, gid, 0) == 0); in ATF_TC_BODY() 90 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 149 int dfd; in ATF_TC_BODY() local 155 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 156 ATF_REQUIRE(fchownat(dfd, FILEERR, uid, gid, 0) == -1); in ATF_TC_BODY() 157 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 168 int dfd; in ATF_TC_BODY() local 179 ATF_REQUIRE((dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0)) != -1); in ATF_TC_BODY() [all …]
|
H A D | t_openat.c | 57 int dfd; in ATF_TC_BODY() local 64 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 65 ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 66 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 110 int dfd; in ATF_TC_BODY() local 114 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 115 ATF_REQUIRE((fd = openat(dfd, FILEERR, O_RDONLY, 0)) == -1); in ATF_TC_BODY() 116 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 126 int dfd; in ATF_TC_BODY() local 134 ATF_REQUIRE((dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0)) != -1); in ATF_TC_BODY() [all …]
|
H A D | t_unlinkat.c | 57 int dfd; in ATF_TC_BODY() local 64 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 65 ATF_REQUIRE(unlinkat(dfd, BASEFILE, 0) == 0); in ATF_TC_BODY() 66 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 106 int dfd; in ATF_TC_BODY() local 109 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 110 ATF_REQUIRE(unlinkat(dfd, FILEERR, 0) == -1); in ATF_TC_BODY() 111 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 121 int dfd; in ATF_TC_BODY() local 129 ATF_REQUIRE((dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0)) != -1); in ATF_TC_BODY() [all …]
|
H A D | t_fchmodat.c | 59 int dfd; in ATF_TC_BODY() local 67 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 68 ATF_REQUIRE(fchmodat(dfd, BASEFILE, 0600, 0) == 0); in ATF_TC_BODY() 69 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 116 int dfd; in ATF_TC_BODY() local 119 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 120 ATF_REQUIRE(fchmodat(dfd, FILEERR, 0600, 0) == -1); in ATF_TC_BODY() 121 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 131 int dfd; in ATF_TC_BODY() local 139 ATF_REQUIRE((dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0)) != -1); in ATF_TC_BODY() [all …]
|
H A D | t_readlinkat.c | 59 int dfd; in ATF_TC_BODY() local 69 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 70 len = readlinkat(dfd, BASELINK, buf, sizeof(buf)-1); in ATF_TC_BODY() 73 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY() 122 int dfd; in ATF_TC_BODY() local 125 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 126 ATF_REQUIRE(readlinkat(dfd, FILEERR, F_OK, 0) == -1); in ATF_TC_BODY() 127 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY()
|
H A D | t_mkdirat.c | 57 int dfd; in ATF_TC_BODY() local 61 ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1); in ATF_TC_BODY() 62 ATF_REQUIRE(mkdirat(dfd, BASESDIR, mode) != -1); in ATF_TC_BODY() 63 ATF_REQUIRE(close(dfd) == 0); in ATF_TC_BODY()
|
/freebsd/sys/contrib/openzfs/tests/zfs-tests/cmd/ |
H A D | clonefile.c | 71 cf_copy_file_range(int sfd, loff_t *soff, int dfd, loff_t *doff, in cf_copy_file_range() argument 75 return (copy_file_range(sfd, soff, dfd, doff, len, flags)); in cf_copy_file_range() 77 syscall(__NR_copy_file_range, sfd, soff, dfd, doff, len, flags)); in cf_copy_file_range() 153 int do_clone(int sfd, int dfd); 154 int do_clonerange(int sfd, int dfd, loff_t soff, loff_t doff, size_t len); 155 int do_copyfilerange(int sfd, int dfd, loff_t soff, loff_t doff, size_t len); 156 int do_deduperange(int sfd, int dfd, loff_t soff, loff_t doff, size_t len); 238 int dfd = open(argv[optind+1], O_WRONLY|O_CREAT, in main() local 240 if (dfd < 0) { in main() 250 err = do_clone(sfd, dfd); in main() [all …]
|
H A D | clone_mmap_write.c | 67 int dfd; in clone_file() local 69 if ((dfd = open(dest, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0) { in clone_file() 74 if (copy_file_range(sfd, 0, dfd, 0, size, 0) < 0) { in clone_file() 79 return (dfd); in clone_file() 106 int sfd, dfd; in main() local 119 dfd = clone_file(sfd, sb.st_size, argv[2]); in main() 120 p = map_file(dfd, sb.st_size); in main() 121 map_write(p, dfd); in main()
|
H A D | clone_mmap_cached.c | 75 int dfd, sfd; in main() local 114 dfd = open(argv[1], O_RDWR); in main() 115 if (fstat(dfd, &sb) == -1) { in main() 120 dmem = mmap_file(dfd, dsize); in main() 139 if (copy_file_range(sfd, &soff, dfd, &doff, ssize, 0) < 0) { in main()
|
/freebsd/contrib/tcsh/ |
H A D | tw.init.c | 71 DIR *dfd; /* Current directory descriptor */ member 75 #define SETDIR(dfd) \ argument 77 tw_dir_fd = dfd; \ 82 #define CLRDIR(dfd) \ argument 83 if (dfd != NULL) { \ 85 xclosedir(dfd); \ 86 dfd = NULL; \ 157 tw_dir_next(struct Strbuf *res, DIR *dfd) in tw_dir_next() argument 161 if (dfd == NULL) in tw_dir_next() 164 if ((dirp = readdir(dfd)) != NULL) { in tw_dir_next() [all …]
|
/freebsd/sbin/gbde/ |
H A D | gbde.c |
|
/freebsd/contrib/ntp/ntpd/ |
H A D | ntp_ppsdev.c | 71 int dfd; /* file descriptor for dir for 'openat()' */ member 81 else if (-1 != pxdir->dfd) in xdirClose() 82 close(pxdir->dfd); /* otherwise _we_ have to do it */ in xdirClose() 83 pxdir->dfd = -1; in xdirClose() 100 if (-1 == (pxdir->dfd = openat(fdo, path, OModeD))) in xdirOpenAt() 102 if (NULL == (pxdir->dir = fdopendir(pxdir->dfd))) in xdirOpenAt() 128 int dfd; in readFileAt() local 130 if (-1 == (dfd = openat(rfd, path, OModeF)) || -1 == fstat(dfd, &sb)) in readFileAt() 134 if (1 > (rdlen = read(dfd, ret, sb.st_size))) in readFileAt() 136 close(dfd); in readFileAt() [all …]
|
/freebsd/contrib/capsicum-test/ |
H A D | rename.cc | 37 int dfd = open(dir_path, O_DIRECTORY); in TEST() local 42 EXPECT_OK(renameat(AT_FDCWD, src_path, dfd, src_path)); in TEST() 43 EXPECT_OK(renameat(dfd, src_path, AT_FDCWD, src_path)); in TEST() 44 EXPECT_OK(renameat(dfd, src_path, dfd, src_path)); in TEST() 46 close(dfd); in TEST()
|
H A D | capmode.cc | 439 int dfd = open(TmpFile("cap_at_syscalls"), O_RDONLY); in TEST() local 440 EXPECT_OK(dfd); in TEST() 442 int file = openat(dfd, "testfile", O_RDONLY|O_CREAT, 0644); in TEST() 453 EXPECT_OK(fstatat(dfd, "testfile", &fs, 0)); in TEST() 454 EXPECT_OK(mkdirat(dfd, "subdir", 0600)); in TEST() 455 EXPECT_OK(fchmodat(dfd, "subdir", 0644, 0)); in TEST() 456 EXPECT_OK(faccessat(dfd, "subdir", F_OK, 0)); in TEST() 457 EXPECT_OK(renameat(dfd, "subdir", dfd, "subdir2")); in TEST() 458 EXPECT_OK(renameat(dfd, "subdir2", dfd, "subdir")); in TEST() 463 EXPECT_OK(futimesat(dfd, "testfile", tv)); in TEST() [all …]
|
H A D | capability-fd.cc | 672 #define TRY_DIR_OPS(dfd, ...) do { \ argument 675 TryDirOps((dfd), rights); \ 942 int dfd = open(TmpFile("cap_dirops"), O_RDONLY | O_DIRECTORY | extra); in DirOperationsTest() local 943 EXPECT_OK(dfd); in DirOperationsTest() 949 TRY_DIR_OPS(dfd, CAP_LINKAT_SOURCE); in DirOperationsTest() 950 TRY_DIR_OPS(dfd, CAP_LINKAT_TARGET); in DirOperationsTest() 951 TRY_DIR_OPS(dfd, CAP_CREATE, CAP_READ, CAP_LOOKUP); in DirOperationsTest() 952 TRY_DIR_OPS(dfd, CAP_CREATE, CAP_WRITE, CAP_LOOKUP); in DirOperationsTest() 953 TRY_DIR_OPS(dfd, CAP_CREATE, CAP_READ, CAP_WRITE, CAP_LOOKUP); in DirOperationsTest() 954 TRY_DIR_OPS(dfd, CAP_FSYNC, CAP_READ, CAP_LOOKUP); in DirOperationsTest() [all …]
|
/freebsd/contrib/openbsm/bin/auditdistd/ |
H A D | trail.c | 158 int dfd; in trail_type() local 162 dfd = dirfd(dirfp); in trail_type() 163 PJDLOG_ASSERT(dfd >= 0); in trail_type() 164 if (fstatat(dfd, filename, &sb, AT_SYMLINK_NOFOLLOW) == -1) { in trail_type() 207 int dfd, fd; in trail_start() local 221 dfd = dirfd(trail->tr_dirfp); in trail_start() 222 PJDLOG_ASSERT(dfd >= 0); in trail_start() 224 fd = openat(dfd, trail->tr_filename, O_RDONLY); in trail_start() 313 if (unlinkat(dfd, trail->tr_filename, 0) == -1) { in trail_start() 328 int dfd; in trail_next() local [all …]
|
/freebsd/contrib/netbsd-tests/fs/puffs/h_dtfs/ |
H A D | dtfs_subr.c | 85 struct dtfs_dirent *dfd; in dtfs_genfile() local 110 dfd = emalloc(sizeof(struct dtfs_dirent)); in dtfs_genfile() 111 dfd->dfd_node = newpn; in dtfs_genfile() 112 dfd->dfd_name = estrndup(pcn->pcn_name, pcn->pcn_namelen); in dtfs_genfile() 113 dfd->dfd_namelen = strlen(dfd->dfd_name); in dtfs_genfile() 114 dfd->dfd_parent = dir; in dtfs_genfile() 115 dtfs_adddent(dir, dfd); in dtfs_genfile() 182 struct dtfs_dirent *dfd; in dtfs_nukenode() local 187 dfd = dtfs_dirgetbyname(DTFS_PTOF(pn_parent), fname, fnlen); in dtfs_nukenode() 188 assert(dfd); in dtfs_nukenode() [all …]
|
H A D | dtfs_vnops.c | 48 struct dtfs_dirent *dfd; in dtfs_node_lookup() local 64 dfd = dtfs_dirgetbyname(df, pcn->pcn_name, pcn->pcn_namelen); in dtfs_node_lookup() 65 if (dfd) { in dtfs_node_lookup() 74 puffs_newinfo_setcookie(pni, dfd->dfd_node); in dtfs_node_lookup() 75 puffs_newinfo_setvtype(pni, dfd->dfd_node->pn_va.va_type); in dtfs_node_lookup() 76 puffs_newinfo_setsize(pni, dfd->dfd_node->pn_va.va_size); in dtfs_node_lookup() 77 puffs_newinfo_setrdev(pni, dfd->dfd_node->pn_va.va_rdev); in dtfs_node_lookup() 80 puffs_flush_pagecache_node(pu, dfd->dfd_node); in dtfs_node_lookup() 376 struct dtfs_dirent *dfd; in dtfs_node_link() local 378 dfd = emalloc(sizeof(struct dtfs_dirent)); in dtfs_node_link() [all …]
|
/freebsd/tools/test/stress2/misc/ |
H A D | mapwrite.sh | 117 int dfd; 118 if ((dfd = open(CLONE_NAME, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0) { 123 if (copy_file_range(sfd, 0, dfd, 0, DATASIZE * NDATA, 0) < 0) { 128 return (dfd); 156 int dfd = _clone_file(sfd); 157 void *p = _map_file(dfd); 158 _map_write(p, dfd);
|
/freebsd/sys/compat/linux/ |
H A D | linux_file.c | 209 int dfd; in linux_openat() local 211 dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; in linux_openat() 212 return (linux_common_open(td, dfd, args->filename, args->flags, in linux_openat() 616 int dfd; in linux_do_accessat() local 622 dfd = (ldfd == LINUX_AT_FDCWD) ? AT_FDCWD : ldfd; in linux_do_accessat() 623 return (kern_accessat(td, dfd, filename, UIO_USERSPACE, flags, amode)); in linux_do_accessat() 630 return (linux_do_accessat(td, args->dfd, args->filename, args->amode, in linux_faccessat() 652 return (linux_do_accessat(td, args->dfd, args->filename, args->amode, in linux_faccessat2() 681 int dfd, struct linux_unlinkat_args *args) in linux_unlinkat_impl() argument 687 error = kern_frmdirat(td, dfd, path, FD_NONE, pathseg, 0); in linux_unlinkat_impl() [all …]
|
/freebsd/contrib/ofed/librdmacm/ |
H A D | preload.c | 447 static int copysockopts(int dfd, int sfd, struct socket_calls *dapi, in copysockopts() argument 455 ret = dapi->fcntl(dfd, F_SETFL, ret); in copysockopts() 462 ret = dapi->setsockopt(dfd, SOL_SOCKET, SO_REUSEADDR, ¶m, len); in copysockopts() 469 ret = dapi->setsockopt(dfd, IPPROTO_TCP, TCP_NODELAY, ¶m, len); in copysockopts() 482 int sfd, dfd, param, ret; in transpose_socket() local 499 dfd = dapi->socket(param, SOCK_STREAM, 0); in transpose_socket() 500 if (dfd < 0) in transpose_socket() 501 return dfd; in transpose_socket() 503 ret = copysockopts(dfd, sfd, dapi, sapi); in transpose_socket() 507 fd_store(socket, dfd, new_type, fd_ready); in transpose_socket() [all …]
|