/freebsd/tools/regression/capsicum/syscalls/ |
H A D | cap_fcntls_limit.c | 44 fcntl_tests_0(int fd) 49 CHECK(cap_fcntls_get(fd, &fcntlrights) == 0); in fcntl_tests_0() 52 CHECK(fcntl(fd, F_GETFD) == 0); in fcntl_tests_0() 53 CHECK(fcntl(fd, F_SETFD, FD_CLOEXEC) == 0); in fcntl_tests_0() 54 CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC); in fcntl_tests_0() 55 CHECK(fcntl(fd, F_SETFD, 0) == 0); in fcntl_tests_0() 56 CHECK(fcntl(fd, F_GETFD) == 0); in fcntl_tests_0() 58 CHECK(fcntl(fd, F_GETFL) == O_RDWR); in fcntl_tests_0() 59 CHECK(fcntl(fd, F_SETFL, O_NONBLOCK) == 0); in fcntl_tests_0() 60 CHECK(fcntl(fd, F_GETF in fcntl_tests_0() 45 fcntl_tests_0(int fd) fcntl_tests_0() argument 154 fcntl_tests_1(int fd) fcntl_tests_1() argument 206 fcntl_tests_2(int fd) fcntl_tests_2() argument 255 int fd; fcntl_tests_send_0() local 281 int fd; fcntl_tests_recv_0() local 410 int fd, pfd, sp[2]; main() local [all...] |
H A D | cap_ioctls_limit.c | 46 ioctl_tests_0(int fd) 50 CHECK(cap_ioctls_get(fd, NULL, 0) == CAP_IOCTLS_ALL); in ioctl_tests_0() 52 CHECK(fcntl(fd, F_GETFD) == 0); in ioctl_tests_0() 53 CHECK(ioctl(fd, FIOCLEX) == 0); in ioctl_tests_0() 54 CHECK(fcntl(fd, F_GETFD) == FD_CLOEXEC); in ioctl_tests_0() 55 CHECK(ioctl(fd, FIONCLEX) == 0); in ioctl_tests_0() 56 CHECK(fcntl(fd, F_GETFD) == 0); in ioctl_tests_0() 60 CHECK(cap_ioctls_limit(fd, cmds, nitems(cmds)) == 0); in ioctl_tests_0() 62 CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == nitems(cmds)); in ioctl_tests_0() 67 CHECK(cap_ioctls_limit(fd, cmd in ioctl_tests_0() 47 ioctl_tests_0(int fd) ioctl_tests_0() argument 128 ioctl_tests_1(int fd) ioctl_tests_1() argument 174 ioctl_tests_2(int fd) ioctl_tests_2() argument 216 int fd; ioctl_tests_send_0() local 245 int fd; ioctl_tests_recv_0() local 316 int fd, pfd, sp[2]; main() local [all...] |
/freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/ |
H A D | zpool_split_devices.ksh | 36 rm -fd $FILEDEV_PREFIX* $altroot 41 for filedev in "${fd[@]}"; do 52 typeset -A fd 53 fd[01]="$FILEDEV_PREFIX-01" 54 fd[02]="$FILEDEV_PREFIX-02" 55 fd[03]="$FILEDEV_PREFIX-03" 56 fd[11]="$FILEDEV_PREFIX-11" 57 fd[12]="$FILEDEV_PREFIX-12" 58 fd[13]="$FILEDEV_PREFIX-13" 61 typeset poolconfs=("mirror ${fd[01]} ${fd[02]}" [all …]
|
/freebsd/tests/sys/kern/ |
H A D | kcov.c | 61 int fd; in open_kcov() local 63 fd = open("/dev/kcov", O_RDWR); in open_kcov() 64 if (fd == -1) in open_kcov() 67 return (fd); in open_kcov() 78 int fd; in ATF_TC_BODY() local 80 fd = open_kcov(); in ATF_TC_BODY() 82 ATF_CHECK(ioctl(fd, KIOSETBUFSIZE, 0) == -1); in ATF_TC_BODY() 83 ATF_CHECK(ioctl(fd, KIOSETBUFSIZE, 1) == -1); in ATF_TC_BODY() 84 ATF_CHECK(ioctl(fd, KIOSETBUFSIZE, 2) == 0); in ATF_TC_BODY() 85 ATF_CHECK(ioctl(fd, KIOSETBUFSIZE, 2) == -1); in ATF_TC_BODY() [all …]
|
/freebsd/sys/net/route/ |
H A D | fib_algo.c | 80 * fd - fib data - instance of an flm bound to specific routing table 195 static bool rebuild_fd(struct fib_data *fd, const char *reason); 196 static bool rebuild_fd_flm(struct fib_data *fd, struct fib_lookup_module *flm_new); 199 static bool is_idx_free(struct fib_data *fd, uint32_t index); 203 static uint32_t fib_ref_nhop(struct fib_data *fd, struct nhop_object *nh); 204 static void fib_unref_nhop(struct fib_data *fd, struct nhop_object *nh); 415 fib_printf(int level, struct fib_data *fd, const char *func, char *fmt, ...) in fib_printf() argument 427 _ALGO_PRINTF(fd->fd_fibnum, fd->fd_family, fd->fd_flm->flm_name, in fib_printf() 428 fd->fd_gen, func, "%s", buf); in fib_printf() 486 callout_calc_delay_ms(struct fib_data *fd) in callout_calc_delay_ms() argument [all …]
|
/freebsd/tools/regression/poll/ |
H A D | pipeselect.c | 19 #define SETUP(fd, rfds, tv) do { \ argument 21 FD_SET((fd), &(rfds)); \ 59 child(int fd, int num) in child() argument 67 fd = open(FIFONAME, O_RDONLY | O_NONBLOCK); in child() 68 if (fd < 0) in child() 71 if (fd >= FD_SETSIZE) in child() 72 errx(1, "fd = %d too large for select()", fd); in child() 75 SETUP(fd, rfds, tv); in child() 76 if (select(fd + 1, &rfds, NULL, NULL, &tv) < 0) in child() 90 report(num++, "0", 1, FD_ISSET(fd, &rfds)); in child() [all …]
|
/freebsd/contrib/capsicum-test/ |
H A D | ioctl.cc | 19 int fd = open("/etc/passwd", O_RDONLY); in TEST() local 20 EXPECT_OK(fd); in TEST() 21 int fd_no = dup(fd); in TEST() 23 EXPECT_OK(cap_rights_limit(fd, &rights_ioctl)); in TEST() 28 EXPECT_OK(ioctl(fd, FIONREAD, &bytes)); in TEST() 32 EXPECT_OK(ioctl(fd, FIOCLEX, &one)); in TEST() 35 close(fd); in TEST() 41 int fd = open("/etc/passwd", O_RDONLY); in TEST() local 42 EXPECT_OK(fd); in TEST() 44 // Restrict the ioctl(2) subrights of a normal FD. in TEST() [all …]
|
/freebsd/tests/sys/posixshm/ |
H A D | memfd_test.c | 41 int fd; in ATF_TC_BODY() local 44 ATF_REQUIRE((fd = memfd_create("...", 0)) != -1); in ATF_TC_BODY() 47 ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf)); in ATF_TC_BODY() 48 ATF_REQUIRE(fstat(fd, &sb) == 0); in ATF_TC_BODY() 52 ATF_REQUIRE(ftruncate(fd, 2 * (sizeof(buf) - 1)) == 0); in ATF_TC_BODY() 55 ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf)); in ATF_TC_BODY() 58 ATF_REQUIRE(fstat(fd, &sb) == 0); in ATF_TC_BODY() 61 close(fd); in ATF_TC_BODY() 82 int fd; in ATF_TC_BODY() local 84 ATF_REQUIRE((fd = memfd_create("...", 0)) != -1); in ATF_TC_BODY() [all …]
|
H A D | posixshm_test.c | 90 int fd; in shm_open_should_fail() local 92 fd = shm_open(path, flags, mode); in shm_open_should_fail() 93 ATF_CHECK_MSG(fd == -1, "shm_open didn't fail"); in shm_open_should_fail() 113 * Open the test object and write a value to the first byte. Returns valid fd 120 int fd, pagesize; in scribble_object() local 124 fd = shm_open(path, O_CREAT|O_EXCL|O_RDWR, 0777); in scribble_object() 125 if (fd < 0 && errno == EEXIST) { in scribble_object() 128 fd = shm_open(test_path, O_CREAT | O_EXCL | O_RDWR, 0777); in scribble_object() 130 if (fd < 0) in scribble_object() 132 if (ftruncate(fd, pagesize) < 0) in scribble_object() [all …]
|
/freebsd/tools/tools/ath/athprom/ |
H A D | athprom.c | 61 static void parseTemplate(FILE *ftemplate, FILE *fd); 76 FILE *fd; in opentemplate() local 81 fd = fopen(filename, "r"); in opentemplate() 82 if (fd == NULL && errno == ENOENT) { in opentemplate() 86 fd = fopen(filename, "r"); in opentemplate() 87 if (fd != NULL) /* XXX verbose */ in opentemplate() 90 return fd; in opentemplate() 96 FILE *fd = NULL; in main() local 114 fd = fopen(optarg, "r"); in main() 115 if (fd == NULL) in main() [all …]
|
/freebsd/sys/dev/fdc/ |
H A D | fdc.c | 93 /* configuration flags for fd */ 308 fdsettype(struct fd_data *fd, struct fd_type *ft) in fdsettype() argument 310 fd->ft = ft; in fdsettype() 312 fd->sectorsize = 128 << fd->ft->secsize; in fdsettype() 559 if (fdc_cmd(fdc, 2, NE7CMD_SENSED, fdc->fd->fdsu, 1, &st3)) in fdc_sense_drive() 620 fd_select(struct fd_data *fd) in fd_select() argument 625 fdc = fd->fdc; in fd_select() 627 fdc->fdout |= FDO_FDMAEN | FDO_FRST | fd->fdsu; in fd_select() 634 struct fd_data *fd; in fd_turnon() local 638 fd = arg; in fd_turnon() [all …]
|
/freebsd/tests/sys/fs/fusefs/ |
H A D | write.cc | 242 int fd; in TEST_F() local 250 fd = open(FULLPATH, O_WRONLY); in TEST_F() 251 ASSERT_LE(0, fd) << strerror(errno); in TEST_F() 254 iocb.aio_fildes = fd; in TEST_F() 260 leak(fd); in TEST_F() 285 int fd; in TEST_F() local 292 fd = open(FULLPATH, O_RDWR | O_APPEND); in TEST_F() 293 ASSERT_LE(0, fd) << strerror(errno); in TEST_F() 295 ASSERT_EQ(BUFSIZE, write(fd, CONTENTS, BUFSIZE)) << strerror(errno); in TEST_F() 296 leak(fd); in TEST_F() [all …]
|
H A D | read.cc | 171 int fd; in TEST_F() local 180 fd = open(FULLPATH, O_RDONLY); in TEST_F() 181 ASSERT_LE(0, fd) << strerror(errno); in TEST_F() 184 iocb.aio_fildes = fd; in TEST_F() 192 leak(fd); in TEST_F() 204 int fd; in TEST_F() local 239 fd = open(FULLPATH, O_RDONLY); in TEST_F() 240 ASSERT_LE(0, fd) << strerror(errno); in TEST_F() 248 iocb0.aio_fildes = fd; in TEST_F() 255 iocb1.aio_fildes = fd; in TEST_F() [all …]
|
H A D | fallocate.cc | 190 int fd; in TEST_F() local 199 fd = open(FULLPATH, O_RDWR); in TEST_F() 200 ASSERT_LE(0, fd) << strerror(errno); in TEST_F() 201 EXPECT_EQ(0, fspacectl(fd, SPACECTL_DEALLOC, &rqsr, 0, NULL)); in TEST_F() 206 EXPECT_EQ(0, fspacectl(fd, SPACECTL_DEALLOC, &rqsr, 0, NULL)); in TEST_F() 209 EXPECT_EQ(EINVAL, posix_fallocate(fd, off1, len1)); in TEST_F() 211 leak(fd); in TEST_F() 230 int fd; in TEST_F() local 244 fd = open(FULLPATH, O_RDWR); in TEST_F() 245 ASSERT_LE(0, fd) << strerror(errno); in TEST_F() [all …]
|
H A D | locks.cc | 139 int fd; in TEST_F() local 144 fd = open(FULLPATH, O_RDWR); in TEST_F() 145 ASSERT_LE(0, fd) << strerror(errno); in TEST_F() 146 ASSERT_EQ(0, flock(fd, LOCK_EX)) << strerror(errno); in TEST_F() 147 leak(fd); in TEST_F() 160 int fd; in TEST_F() local 165 fd = open(FULLPATH, O_RDWR); in TEST_F() 166 ASSERT_LE(0, fd) << strerror(errno); in TEST_F() 167 ASSERT_EQ(0, flock(fd, LOCK_EX)) << strerror(errno); in TEST_F() 168 leak(fd); in TEST_F() [all …]
|
/freebsd/lib/libgeom/ |
H A D | geom_util.c | 53 int fd; in g_open() local 55 path = g_device_path_open(name, &fd, dowrite); in g_open() 58 return (fd); in g_open() 62 g_close(int fd) in g_close() argument 65 return (close(fd)); in g_close() 69 g_ioctl_arg(int fd, unsigned long cmd, void *arg) in g_ioctl_arg() argument 74 ret = ioctl(fd, cmd, arg); in g_ioctl_arg() 76 ret = ioctl(fd, cmd); in g_ioctl_arg() 81 g_ioctl(int fd, unsigned long cmd) in g_ioctl() argument 84 return (g_ioctl_arg(fd, cmd, NULL)); in g_ioctl() [all …]
|
/freebsd/contrib/netbsd-tests/fs/vfs/ |
H A D | t_io.c | 53 int fd; in holywrite() local 57 RL(fd = rump_sys_open("file", O_RDWR|O_CREAT|O_TRUNC, 0666)); in holywrite() 60 RL(rump_sys_pwrite(fd, buf, 1, getpagesize())); in holywrite() 63 RL(rump_sys_pwrite(fd, buf, 2, getpagesize()-1)); in holywrite() 68 RL(rump_sys_pread(fd, b2, therange, 0)); in holywrite() 75 rump_sys_close(fd); in holywrite() 84 int fd; in extendbody() local 87 RL(fd = rump_sys_open("testfile", in extendbody() 89 RL(rump_sys_ftruncate(fd, seekcnt)); in extendbody() 90 RL(rump_sys_fstat(fd, &sb)); in extendbody() [all …]
|
/freebsd/contrib/ofed/librdmacm/ |
H A D | preload.c | 90 int (*fxstat)(int ver, int fd, struct stat *buf); 120 int fd; member 285 static void fd_store(int index, int fd, enum fd_type type, enum fd_fork_state state) in fd_store() argument 290 fdi->fd = fd; in fd_store() 295 static inline enum fd_type fd_get(int index, int *fd) in fd_get() argument 301 *fd = fdi->fd; in fd_get() 305 *fd = index; in fd_get() 315 return fdi ? fdi->fd : index; in fd_getd() 334 static enum fd_type fd_close(int index, int *fd) in fd_close() argument 342 *fd = fdi->fd; in fd_close() [all …]
|
/freebsd/tests/sys/file/ |
H A D | closefrom_test.c | 132 int fd; in devnull() local 134 fd = open(_PATH_DEVNULL, O_RDONLY); in devnull() 135 if (fd < 0) in devnull() 137 return (fd); in devnull() 145 int fd, flags, i, start; in main() local 149 /* We'd better start up with fd's 0, 1, and 2 open. */ in main() 156 fd = highest_fd(); in main() 157 if (start != fd) in main() 158 fail("highest_fd", "bad descriptor %d != %d", start, fd); in main() 161 /* Try to use closefrom() for just closing fd 3. */ in main() [all …]
|
/freebsd/contrib/llvm-project/compiler-rt/lib/tsan/rtl/ |
H A D | tsan_fd.cpp | 51 static bool bogusfd(int fd) { in bogusfd() argument 52 // Apparently a bogus fd value. in bogusfd() 53 return fd < 0 || fd >= kTableSize; in bogusfd() 80 static FdDesc *fddesc(ThreadState *thr, uptr pc, int fd) { in fddesc() argument 81 CHECK_GE(fd, 0); in fddesc() 82 CHECK_LT(fd, kTableSize); in fddesc() 83 atomic_uintptr_t *pl1 = &fdctx.tab[fd / kTableSizeL2]; in fddesc() 97 return &fds[fd % kTableSizeL2]; in fddesc() 101 static void init(ThreadState *thr, uptr pc, int fd, FdSync *s, in init() argument 103 FdDesc *d = fddesc(thr, pc, fd); in init() [all …]
|
/freebsd/contrib/ntp/libntp/ |
H A D | socket.c | 21 #define ioctl(fd, opt, val) ioctlsocket(fd, opt, (u_long *)(val)) argument 36 * - keep a current socket fd boundary initialized with 43 * if failure and boundary == 0 return old fd 44 * - on success close old fd return new fd 47 * - fds will be moved above the socket fd boundary 55 SOCKET fd in move_fd() argument 81 REQUIRE((int)fd >= 0); in move_fd() 100 if (fd > in move_fd() 129 make_socket_nonblocking(SOCKET fd) make_socket_nonblocking() argument [all...] |
/freebsd/libexec/tftpd/tests/ |
H A D | functional.c | 433 write_all(int fd, const void *buf, size_t nbytes) in write_all() argument 438 r = write(fd, buf, nbytes); in write_all() 455 int fd; variable 467 fd = open("abspath.txt", O_CREAT | O_RDONLY, 0644); 468 ATF_REQUIRE(fd >= 0); 469 close(fd); 499 int fd; variable 502 fd = open("small.txt", O_RDWR | O_CREAT, 0644); 503 ATF_REQUIRE(fd >= 0); 504 write_all(fd, contents, strlen(contents) + 1); [all …]
|
/freebsd/sys/contrib/openzfs/tests/zfs-tests/cmd/ |
H A D | mmap_seek.c | 49 seek_data(int fd, off_t offset, off_t expected) in seek_data() argument 51 off_t data_offset = lseek(fd, offset, SEEK_DATA); in seek_data() 53 fprintf(stderr, "lseek(fd, %d, SEEK_DATA) = %d (expected %d)\n", in seek_data() 60 seek_hole(int fd, off_t offset, off_t expected) in seek_hole() argument 62 off_t hole_offset = lseek(fd, offset, SEEK_HOLE); in seek_hole() 64 fprintf(stderr, "lseek(fd, %d, SEEK_HOLE) = %d (expected %d)\n", in seek_hole() 84 int fd = open(file_path, O_RDWR | O_CREAT, 0666); in main() local 85 if (fd == -1) { in main() 100 err = ftruncate(fd, file_size); in main() 107 MAP_SHARED, fd, 0)) == MAP_FAILED) { in main() [all …]
|
/freebsd/tools/regression/security/open_to_operation/ |
H A D | open_to_operation.c | 203 int dfd, fd, i, mode; in check_dup() local 210 fd = open(path, mode); in check_dup() 211 if (fd < 0) { in check_dup() 215 dfd = dup(fd); in check_dup() 221 close(fd); in check_dup() 229 int dfd, fd, i, mode; in check_dup2() local 236 fd = open(path, mode); in check_dup2() 237 if (fd < 0) { in check_dup2() 241 dfd = dup2(fd, 500); /* Arbitrary but high number. */ in check_dup2() 247 close(fd); in check_dup2() [all …]
|
/freebsd/lib/libcasper/services/cap_fileargs/tests/ |
H A D | fileargs_test.c | 93 int fd; in test_file_open() local 95 fd = fileargs_open(fa, file); in test_file_open() 96 if (fd < 0) in test_file_open() 100 *fdp = fd; in test_file_open() 202 test_file_mode(int fd, int mode) in test_file_mode() argument 206 flags = fcntl(fd, F_GETFL, 0); in test_file_mode() 217 test_file_cap(int fd, cap_rights_t *rights) in test_file_cap() argument 221 ATF_REQUIRE(cap_rights_get(fd, &fdrights) == 0); in test_file_cap() 227 test_file_write(int fd) in test_file_write() argument 232 if (write(fd, &buf, sizeof(buf)) != sizeof(buf)) { in test_file_write() [all …]
|