/freebsd/tests/sys/vfs/ |
H A D | lookup_cap_dotdot.c | 39 static int dirfd = -1; variable 61 ATF_REQUIRE((dirfd = open("testdir", O_RDONLY)) >= 0); in prepare_dotdot_tests() 63 ATF_REQUIRE(mkdirat(dirfd, "d1", 0777) == 0); in prepare_dotdot_tests() 64 ATF_REQUIRE(mkdirat(dirfd, "d1/d2", 0777) == 0); in prepare_dotdot_tests() 65 ATF_REQUIRE(mkdirat(dirfd, "d1/d2/d3", 0777) == 0); in prepare_dotdot_tests() 66 touchat(dirfd, "d1/f1"); in prepare_dotdot_tests() 67 touchat(dirfd, "d1/d2/f2"); in prepare_dotdot_tests() 68 touchat(dirfd, "d1/d2/d3/f3"); in prepare_dotdot_tests() 69 ATF_REQUIRE(symlinkat("d1/d2/d3", dirfd, "l3") == 0); in prepare_dotdot_tests() 70 ATF_REQUIRE(symlinkat("../testdir/d1", dirfd, "lup") == 0); in prepare_dotdot_tests() [all …]
|
/freebsd/tools/regression/security/cap_test/ |
H A D | cap_test_capabilities.c | 111 try_file_ops(int filefd, int dirfd, cap_rights_t rights) in try_file_ops() argument 135 REQUIRE(dfd_cap = cap_new(dirfd, rights)); in try_file_ops() 188 CHECK(ret == -1 || unlinkat(dirfd, "cap_create", 0) == 0); in try_file_ops() 194 CHECK(ret == -1 || unlinkat(dirfd, "cap_create", 0) == 0); in try_file_ops() 199 CHECK(ret == -1 || unlinkat(dirfd, "cap_create", 0) == 0); in try_file_ops() 204 ret = openat(dirfd, "cap_fsync", O_CREAT, 0600); in try_file_ops() 231 CHECK(unlinkat(dirfd, "cap_fsync", 0) == 0); in try_file_ops() 236 ret = openat(dirfd, "cap_ftruncate", O_CREAT, 0600); in try_file_ops() 251 CHECK(unlinkat(dirfd, "cap_ftruncate", 0) == 0); in try_file_ops() 257 CHECK(ret == -1 || unlinkat(dirfd, "cap_create", 0) == 0); in try_file_ops() [all …]
|
/freebsd/lib/libc/tests/gen/ |
H A D | dir2_test.c | 53 int i, dirfd; in ATF_TC_BODY() local 61 dirfd = open(tmpdir, O_RDONLY | O_DIRECTORY); in ATF_TC_BODY() 62 ATF_REQUIRE(dirfd > 0); in ATF_TC_BODY() 73 fd = openat(dirfd, filename, O_WRONLY | O_CREAT, 0600); in ATF_TC_BODY() 79 dirp = fdopendir(dirfd); in ATF_TC_BODY() 80 ATF_REQUIRE_MSG(dirfd >= 0, "fdopendir failed"); in ATF_TC_BODY() 129 int i, dirfd; in ATF_TC_BODY() local 138 dirfd = open(tmpdir, O_RDONLY | O_DIRECTORY); in ATF_TC_BODY() 139 ATF_REQUIRE(dirfd > 0); in ATF_TC_BODY() 150 fd = openat(dirfd, filename, O_WRONLY | O_CREAT, 0600); in ATF_TC_BODY() [all …]
|
/freebsd/lib/libutil/ |
H A D | pidfile.c | 76 pidfile_read_impl(int dirfd, const char *filename, pid_t *pidptr) in pidfile_read_impl() argument 81 fd = openat(dirfd, filename, O_RDONLY | O_CLOEXEC); in pidfile_read_impl() 102 pidfile_read(int dirfd, const char *filename, pid_t *pidptr) in pidfile_read() argument 111 errno = pidfile_read_impl(dirfd, filename, pidptr); in pidfile_read() 127 int error, fd, dirfd, dirlen, filenamelen; in pidfile_open() local 159 dirfd = open(pfh->pf_dir, O_CLOEXEC | O_DIRECTORY | O_NONBLOCK); in pidfile_open() 160 if (dirfd == -1) { in pidfile_open() 173 fd = flopenat(dirfd, pfh->pf_filename, in pidfile_open() 180 errno = pidfile_read(dirfd, in pidfile_open() 187 close(dirfd); in pidfile_open() [all …]
|
H A D | flopen.c | 49 vflopenat(int dirfd, const char *path, int flags, va_list ap) in vflopenat() argument 72 if ((fd = openat(dirfd, path, flags, mode)) == -1) in vflopenat() 82 if (fstatat(dirfd, path, &sb, 0) == -1) { in vflopenat() 136 flopenat(int dirfd, const char *path, int flags, ...) in flopenat() argument 142 ret = vflopenat(dirfd, path, flags, ap); in flopenat()
|
/freebsd/usr.sbin/pw/ |
H A D | rm_r.c | 61 int dirfd; in rm_r() local 72 dirfd = openat(rootfd, path, O_DIRECTORY); in rm_r() 73 if (dirfd == -1) { in rm_r() 77 d = fdopendir(dirfd); in rm_r() 79 (void)close(dirfd); in rm_r() 86 if (fstatat(dirfd, e->d_name, &st, AT_SYMLINK_NOFOLLOW) != 0) in rm_r() 89 if (rm_r(dirfd, e->d_name, uid) == true) in rm_r() 92 unlinkat(dirfd, e->d_name, 0); in rm_r()
|
/freebsd/contrib/capsicum-test/ |
H A D | capability-fd.cc | 678 static void TryDirOps(int dirfd, cap_rights_t rights) { in TryDirOps() argument 680 int dfd_cap = dup(dirfd); in TryDirOps() 690 EXPECT_OK(unlinkat(dirfd, "cap_create", 0)); in TryDirOps() 696 EXPECT_OK(unlinkat(dirfd, "cap_create", 0)); in TryDirOps() 702 EXPECT_OK(unlinkat(dirfd, "cap_create", 0)); in TryDirOps() 705 rc = openat(dirfd, "cap_faccess", O_CREAT, 0600); in TryDirOps() 710 EXPECT_OK(unlinkat(dirfd, "cap_faccess", 0)); in TryDirOps() 712 rc = openat(dirfd, "cap_fsync", O_CREAT, 0600); in TryDirOps() 745 EXPECT_OK(unlinkat(dirfd, "cap_fsync", 0)); in TryDirOps() 747 rc = openat(dirfd, "cap_ftruncate", O_CREAT, 0600); in TryDirOps() [all …]
|
/freebsd/sys/security/audit/ |
H A D | audit.h | 113 void audit_arg_sockaddr(struct thread *td, int dirfd, struct sockaddr *sa); 117 void audit_arg_upath1(struct thread *td, int dirfd, char *upath); 119 void audit_arg_upath2(struct thread *td, int dirfd, char *upath); 302 #define AUDIT_ARG_SOCKADDR(td, dirfd, sa) do { \ argument 304 audit_arg_sockaddr((td), (dirfd), (sa)); \ 347 #define AUDIT_ARG_UPATH1(td, dirfd, upath) do { \ argument 349 audit_arg_upath1((td), (dirfd), (upath)); \ 357 #define AUDIT_ARG_UPATH2(td, dirfd, upath) do { \ argument 359 audit_arg_upath2((td), (dirfd), (upath)); \ 450 #define AUDIT_ARG_SOCKADDR(td, dirfd, sa) argument [all …]
|
H A D | audit_arg.c | 450 audit_arg_sockaddr(struct thread *td, int dirfd, struct sockaddr *sa) in audit_arg_sockaddr() argument 472 if (dirfd != AT_FDCWD) in audit_arg_sockaddr() 473 audit_arg_atfd1(dirfd); in audit_arg_sockaddr() 474 audit_arg_upath1(td, dirfd, in audit_arg_sockaddr() 733 audit_arg_upath(struct thread *td, int dirfd, char *upath, char **pathp) in audit_arg_upath() argument 738 audit_canon_path(td, dirfd, upath, *pathp); in audit_arg_upath() 742 audit_arg_upath1(struct thread *td, int dirfd, char *upath) in audit_arg_upath1() argument 750 audit_arg_upath(td, dirfd, upath, &ar->k_ar.ar_arg_upath1); in audit_arg_upath1() 755 audit_arg_upath2(struct thread *td, int dirfd, char *upath) in audit_arg_upath2() argument 763 audit_arg_upath(td, dirfd, upath, &ar->k_ar.ar_arg_upath2); in audit_arg_upath2()
|
H A D | audit_bsm_klib.c | 494 audit_canon_path(struct thread *td, int dirfd, char *path, char *cpath) in audit_canon_path() argument 510 if (dirfd == AT_FDCWD) { in audit_canon_path() 513 error = fgetvp(td, dirfd, cap_rights_init(&rights), &cdir); in audit_canon_path()
|
/freebsd/bin/pax/ |
H A D | tables.c | 69 static int dirfd = -1; /* storage for setting created dir time/mode */ variable 1088 if (dirfd != -1) in dir_start() 1095 if ((dirfd = mkstemp(tempfile)) >= 0) { in dir_start() 1122 if (dirfd < 0) in add_dir() 1129 if ((dblk.npos = lseek(dirfd, 0L, SEEK_CUR)) < 0) { in add_dir() 1142 if ((write(dirfd, name, dblk.nlen) == dblk.nlen) && in add_dir() 1143 (write(dirfd, (char *)&dblk, sizeof(dblk)) == sizeof(dblk))) { in add_dir() 1165 if (dirfd < 0) in proc_dir() 1175 if (lseek(dirfd, -((off_t)sizeof(dblk)), SEEK_CUR) < 0) in proc_dir() 1177 if (read(dirfd,(char *)&dblk, sizeof(dblk)) != sizeof(dblk)) in proc_dir() [all …]
|
/freebsd/contrib/netbsd-tests/fs/hfs/ |
H A D | t_pathconvert.c | 36 int dirfd, fd; in ATF_TC_BODY() local 58 RL(dirfd = rump_sys_open("/mp", O_RDONLY)); in ATF_TC_BODY() 60 RL(nbytes = rump_sys_getdents(dirfd, buf, sizeof buf)); in ATF_TC_BODY() 73 RL(rump_sys_close(dirfd)); in ATF_TC_BODY()
|
/freebsd/sys/sys/ |
H A D | namei.h | 213 #define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd) \ argument 214 NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, &cap_no_rights) 215 #define NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rightsp) \ argument 216 NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rightsp) 243 #define NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, startdir, rightsp) \ argument 254 _ndp->ni_dirfd = dirfd; \
|
/freebsd/usr.bin/bsdiff/bspatch/ |
H A D | bspatch.c | 53 static int dirfd = -1; 59 if (dirfd != -1 && newfile != NULL) in exit_cleanup() 60 if (unlinkat(dirfd, newfile, 0)) in exit_cleanup() 140 (dirfd = open(directory, O_DIRECTORY)) < 0) in main() 146 if ((newfd = openat(dirfd, newfile, in main() 165 cap_rights_limit(dirfd, &rights_dir) < 0) in main() 52 static int dirfd = -1; global() variable
|
/freebsd/usr.sbin/makefs/zfs/ |
H A D | fs.c | 152 int dirfd; member 267 *dirfdp = SLIST_FIRST(&arg->dirs)->dirfd; in fs_populate_path() 588 int dirfd; in fs_populate_dir() local 608 dirfd = fs_open_can_fail(cur, arg, O_DIRECTORY | O_RDONLY); in fs_populate_dir() 611 dirfd = arg->rootdirfd; in fs_populate_dir() 628 dir->dirfd = dirfd; in fs_populate_dir() 634 fs_build_one(arg->zfs, cur->inode->param, cur->child, dirfd); in fs_populate_dir() 693 if (dir->dirfd != -1) in fs_foreach_populate() 694 eclose(dir->dirfd); in fs_foreach_populate() 924 fs_build_one(zfs_opt_t *zfs, zfs_dsl_dir_t *dsldir, fsnode *root, int dirfd) in fs_build_one() argument [all …]
|
/freebsd/contrib/openbsm/bin/auditdistd/ |
H A D | trail.c | 162 dfd = dirfd(dirfp); in trail_type() 221 dfd = dirfd(trail->tr_dirfp); in trail_start() 370 dfd = dirfd(trail->tr_dirfp); in trail_next() 447 dfd = dirfd(trail->tr_dirfp); in trail_unlink() 475 fd = dirfd(trail->tr_dirfp); in trail_switch() 519 return (dirfd(trail->tr_dirfp)); in trail_dirfd()
|
/freebsd/lib/libpam/modules/pam_xdg/ |
H A D | pam_xdg.c | 190 int dirfd; in remove_dir() local 195 dirfd = openat(fd, dp->d_name, 0); in remove_dir() 196 remove_dir(dirfd); in remove_dir() 197 close(dirfd); in remove_dir()
|
/freebsd/usr.sbin/rwhod/ |
H A D | rwhod.c | 343 int dirfd; in receiver_process() local 350 dirfd = open(".", O_RDONLY | O_DIRECTORY); in receiver_process() 351 if (dirfd < 0) { in receiver_process() 357 if (caph_rights_limit(dirfd, &rights) < 0) { in receiver_process() 397 whod = openat(dirfd, path, O_WRONLY | O_CREAT, 0644); in receiver_process() 434 (void) close(dirfd); in receiver_process()
|
/freebsd/lib/libc/gen/ |
H A D | scandir.c | 161 scandirat(int dirfd, const char *dirname, struct dirent ***namelist, in scandirat() argument 168 fd = _openat(dirfd, dirname, O_RDONLY | O_DIRECTORY | O_CLOEXEC); in scandirat()
|
H A D | dirfd.c | 38 dirfd(DIR *dirp) in dirfd() function
|
/freebsd/crypto/heimdal/lib/roken/ |
H A D | cloexec.c | 64 rk_cloexec(dirfd(d)); in rk_cloexec_dir()
|
/freebsd/tools/build/cross-build/include/linux/ |
H A D | libutil.h | 52 int flopenat(int dirfd, const char *path, int flags, ...);
|
/freebsd/sys/compat/linux/ |
H A D | linux_stats.c | 705 int error, dirfd, flags; in linux_statx() local 713 dirfd = (args->dirfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dirfd; in linux_statx() 714 error = linux_kern_statat(td, flags, dirfd, args->pathname, in linux_statx()
|
/freebsd/sys/kern/ |
H A D | uipc_syscalls.c | 195 kern_bindat(struct thread *td, int dirfd, int fd, struct sockaddr *sa) in kern_bindat() argument 202 if (dirfd == AT_FDCWD) { in kern_bindat() 211 AUDIT_ARG_SOCKADDR(td, dirfd, sa); in kern_bindat() 224 if (dirfd == AT_FDCWD) in kern_bindat() 227 error = sobindat(dirfd, so, sa, td); in kern_bindat() 468 kern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa) in kern_connectat() argument 475 if (dirfd == AT_FDCWD) { in kern_connectat() 484 AUDIT_ARG_SOCKADDR(td, dirfd, sa); in kern_connectat() 502 error = soconnectat(dirfd, so, sa, td); in kern_connectat()
|
/freebsd/usr.sbin/cron/cron/ |
H A D | database.c | 83 ret = fstatat(dirfd(dir), dp->d_name, &st, 0); in load_database() 134 if (fstatat(dirfd(dir), dp->d_name, &st, 0) == 0 && in load_database()
|