| /freebsd-14.2/tests/sys/file/ |
| H A D | dup_test.c | 103 if (fd2 != fd1 + 1) in main() 149 if (fd2 != fd1) in main() 166 if (fd2 < 10) in main() 168 ++test, fd2); in main() 196 if (fd2 != fd1 + 1) in main() 221 if (fd2 != fd1) in main() 252 if (fd2 < 10) in main() 254 ++test, fd2); in main() 275 if (fd2 != fd1 + 1) in main() 315 if (fd2 != fd1 + 1) in main() [all …]
|
| /freebsd-14.2/lib/libutil/tests/ |
| H A D | flopen_test.c | 97 int fd1, fd2; in test_flopen_lock_self() local 104 fd2 = flopen(fn, O_RDWR|O_NONBLOCK); in test_flopen_lock_self() 105 if (fd2 >= 0) { in test_flopen_lock_self() 107 close(fd2); in test_flopen_lock_self() 123 volatile int fd1, fd2; in test_flopen_lock_other() local 130 fd2 = -42; in test_flopen_lock_other() 133 close(fd2); in test_flopen_lock_other() 136 if (fd2 == -42) in test_flopen_lock_other() 138 if (fd2 >= 0) in test_flopen_lock_other() 155 volatile int fd1, fd2; in test_flopen_lock_child() local [all …]
|
| /freebsd-14.2/tools/tools/netrate/juggle/ |
| H A D | juggle.c | 249 if (message_recv(fd2) < 0) in juggle() 252 if (message_send(fd2) < 0) in juggle() 286 int fd2, i, j; in juggling_thread() local 288 fd2 = *(int *)arg; in juggling_thread() 303 if (message_recv(fd2) < 0) in juggling_thread() 306 if (message_send(fd2) < 0) in juggling_thread() 387 if (message_send(fd2) < 0) { in process_juggle() 396 if (message_send(fd2) < 0) in process_juggle() 483 int fd1, fd2, i, j, p; in main() local 517 juggle(fd1, fd2, p); in main() [all …]
|
| /freebsd-14.2/tools/regression/sockets/unix_cmsg/ |
| H A D | t_cmsgcred.c | 84 int fd2, rv; in t_cmsgcred_server() local 89 fd2 = -1; in t_cmsgcred_server() 100 fd2 = uc_socket_accept(fd1); in t_cmsgcred_server() 101 if (fd2 < 0) in t_cmsgcred_server() 104 fd2 = fd1; in t_cmsgcred_server() 111 if (uc_message_recv(fd2, &msghdr) < 0) { in t_cmsgcred_server() 127 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsgcred_server() 128 if (uc_socket_close(fd2) < 0) in t_cmsgcred_server()
|
| H A D | t_cmsgcred_sockcred.c | 50 int fd2, rv, val; in t_cmsgcred_sockcred_server() local 52 fd2 = -1; in t_cmsgcred_sockcred_server() 75 fd2 = uc_socket_accept(fd1); in t_cmsgcred_sockcred_server() 76 if (fd2 < 0) in t_cmsgcred_sockcred_server() 79 fd2 = fd1; in t_cmsgcred_sockcred_server() 88 if (uc_message_recv(fd2, &msghdr) < 0) { in t_cmsgcred_sockcred_server() 113 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsgcred_sockcred_server() 114 if (uc_socket_close(fd2) < 0) in t_cmsgcred_sockcred_server()
|
| H A D | t_sockcred.c | 78 int fd2, rv, val; in t_sockcred_server() local 80 fd2 = -1; in t_sockcred_server() 103 fd2 = uc_socket_accept(fd1); in t_sockcred_server() 104 if (fd2 < 0) in t_sockcred_server() 107 fd2 = fd1; in t_sockcred_server() 112 if (setsockopt(fd2, 0, LOCAL_CREDS, &val, sizeof(val)) < 0) { in t_sockcred_server() 125 if (uc_message_recv(fd2, &msghdr) < 0) { in t_sockcred_server() 146 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_sockcred_server() 147 if (uc_socket_close(fd2) < 0) in t_sockcred_server()
|
| H A D | t_cmsg_len.c | 106 int fd2, rv; in t_cmsg_len_server() local 114 fd2 = uc_socket_accept(fd1); in t_cmsg_len_server() 115 if (fd2 < 0) in t_cmsg_len_server() 118 fd2 = fd1; in t_cmsg_len_server() 125 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsg_len_server() 126 if (uc_socket_close(fd2) < 0) in t_cmsg_len_server()
|
| H A D | t_peercred.c | 119 int fd2, rv; in t_peercred_server() local 124 fd2 = uc_socket_accept(fd1); in t_peercred_server() 125 if (fd2 < 0) in t_peercred_server() 129 if (getsockopt(fd2, 0, LOCAL_PEERCRED, &xucred, &len) < 0) { in t_peercred_server() 142 if (uc_socket_close(fd2) < 0) in t_peercred_server()
|
| H A D | t_xxxtime.c.in | 106 int fd2, rv; variable 111 fd2 = -1; 122 fd2 = uc_socket_accept(fd1); 123 if (fd2 < 0) 126 fd2 = fd1; 133 if (uc_message_recv(fd2, &msghdr) < 0) { 149 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) 150 if (uc_socket_close(fd2) < 0)
|
| /freebsd-14.2/tools/test/stress2/misc/ |
| H A D | rdwr.sh | 67 int fd1, fd2; 76 if ((fd2 = open("/dev/zero", O_RDWR)) == -1) 84 if ((p = mmap(0, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd2, 0)) == 88 if (read(fd2, p, len) != len) 94 if (pread(fd2, p, len, 0) != len) 102 if (readv(fd2, &iov, 1) != len) 108 if (preadv(fd2, &iov, 1, 0) != len) 115 close(fd2);
|
| H A D | dup2.sh | 55 int error, fd2, i; 59 fd2 = arc4random() % 1000000; 60 if (dup2(1, fd2) == -1) { 62 warn("dup2(1, %d)", fd2); 67 close(fd2);
|
| H A D | devfd.sh | 73 int fd[3], fd2[3]; 100 if (fd2[j] != -1) 101 close(fd2[j]); 103 if ((fd2[j] = open(path, O_RDONLY)) != -1) 104 fchflags(fd2[j], UF_NODUMP);
|
| /freebsd-14.2/tests/sys/fs/fusefs/ |
| H A D | copy_file_range.cc | 163 int fd1, fd2; in TEST_F() local 210 int fd1, fd2; in TEST_F() local 265 leak(fd2); in TEST_F() 287 int fd1, fd2; in TEST_F() local 411 int fd1, fd2; in TEST_F() local 458 int fd1, fd2; in TEST_F() local 502 int fd1, fd2; in TEST_F() local 593 int fd1, fd2; in TEST_F() local 638 leak(fd2); in TEST_F() 733 leak(fd2); in TEST_F() [all …]
|
| H A D | flush.cc | 95 int fd, fd2; in TEST_F() local 105 fd2 = open(FULLPATH, O_WRONLY); in TEST_F() 106 ASSERT_LE(0, fd2) << strerror(errno); in TEST_F() 108 EXPECT_EQ(0, close(fd2)) << strerror(errno); in TEST_F() 201 int fd, fd2; in TEST_F() local 237 fd2 = open(FULLPATH, O_WRONLY); in TEST_F() 238 ASSERT_LE(0, fd2) << strerror(errno); in TEST_F() 239 ASSERT_EQ(0, close(fd2)) << strerror(errno); in TEST_F() 241 leak(fd2); in TEST_F()
|
| H A D | release.cc | 80 int fd, fd2; in TEST_F() local 90 fd2 = dup(fd); in TEST_F() 91 ASSERT_LE(0, fd2) << strerror(errno); in TEST_F() 93 ASSERT_EQ(0, close(fd2)) << strerror(errno); in TEST_F() 155 int fd, fd2; in TEST_F() local 166 fd2 = open(FULLPATH, O_WRONLY); in TEST_F() 167 ASSERT_LE(0, fd2) << strerror(errno); in TEST_F() 169 ASSERT_EQ(0, close(fd2)) << strerror(errno); in TEST_F()
|
| /freebsd-14.2/contrib/netbsd-tests/lib/libc/sys/ |
| H A D | t_dup.c | 60 int fd, fd1, fd2; in check_mode() local 75 ATF_REQUIRE(fd2 >= 0); in check_mode() 80 fd = dup2(fd1, fd2); in check_mode() 82 fd = dup3(fd1, fd2, O_CLOEXEC); in check_mode() 100 (void)close(fd2); in check_mode() 114 int fd, fd1, fd2; in ATF_TC_BODY() local 117 fd2 = open("/etc/passwd", O_RDONLY); in ATF_TC_BODY() 120 ATF_REQUIRE(fd2 >= 0); in ATF_TC_BODY() 122 fd = dup2(fd1, fd2); in ATF_TC_BODY() 125 if (fd != fd2) in ATF_TC_BODY() [all …]
|
| /freebsd-14.2/tools/regression/sockets/accept_fd_leak/ |
| H A D | accept_fd_leak.c | 68 int fd1, fd2, fd3, i, listen_port, s, status; in main() local 76 fd2 = dup(STDIN_FILENO); in main() 77 if (fd2 != fd1 + 1) in main() 133 if (fd3 != fd2 + 2) in main() 134 printf("not ok 1 - (%d, %d, %d)\n", fd1, fd2, fd3); in main() 153 close(fd2); in main() 207 if (fd3 != fd2 + 2) in main() 208 printf("not ok 2 - (%d, %d, %d)\n", fd1, fd2, fd3); in main()
|
| /freebsd-14.2/usr.bin/cmp/ |
| H A D | cmp.c | 113 int ch, fd1, fd2, oflag; in main() local 192 fd2 = STDIN_FILENO; in main() 194 } else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) { in main() 215 if (fd2 == -1) { in main() 222 } else if (fd2 == -1) { in main() 242 if (fstat(fd2, &sb2)) { in main() 257 ret = c_special(fd1, file1, skip1, fd2, file2, skip2, limit); in main() 266 fd2, file2, skip2, sb2.st_size, limit); in main()
|
| /freebsd-14.2/tests/sys/kern/ |
| H A D | kern_descrip_test.c | 58 int fd1, fd2; in ATF_TC_BODY() local 62 fd2 = 27; in ATF_TC_BODY() 63 ATF_REQUIRE(dup2(fd1, fd2) != -1); in ATF_TC_BODY() 65 ATF_REQUIRE(fstat(fd2, &sb2) != -1); in ATF_TC_BODY() 77 int fd1, fd2, ret; in ATF_TC_BODY() local 80 fd2 = INT_MAX; in ATF_TC_BODY() 81 ret = dup2(fd1, fd2); in ATF_TC_BODY()
|
| /freebsd-14.2/lib/libc/gen/ |
| H A D | opendir.c | 118 int fd2, incr, len, n, saved_errno, space; in _filldir() local 148 if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1) in _filldir() 153 if (pos == -1 || lseek(fd2, pos, SEEK_SET) == -1) { in _filldir() 155 _close(fd2); in _filldir() 172 _close(fd2); in _filldir() 179 n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); in _filldir() 186 _close(fd2); in _filldir() 191 _close(fd2); in _filldir()
|
| /freebsd-14.2/tools/regression/nfsmmap/test2/ |
| H A D | test2.c | 8 int fd, fd2; in main() local 38 fd2 = open("test2.scratch", O_RDWR|O_CREAT, 0666); in main() 39 if (fd2 < 0) in main() 42 if (write(fd2, addr, 4096) < 0) in main()
|
| /freebsd-14.2/tools/regression/nfsmmap/test1/ |
| H A D | test1.c | 8 int fd, fd2; in main() local 40 fd2 = open("test1.scratch", O_RDWR|O_CREAT, 0666); in main() 41 if (fd2 < 0) in main() 44 if (write(fd2, addr, 4096) < 0) in main()
|
| /freebsd-14.2/tests/sys/fifo/ |
| H A D | fifo_misc.c | 70 cleanfifo(const char *fifoname, int fd1, int fd2) in cleanfifo() argument 75 if (fd2 != -1) in cleanfifo() 76 close(fd2); in cleanfifo() 83 int error, fd1, fd2; in openfifo() local 88 fd2 = open(fifoname, O_WRONLY | O_NONBLOCK); in openfifo() 89 if (fd2 < 0) { in openfifo() 96 *writer_fdp = fd2; in openfifo()
|
| /freebsd-14.2/stand/kboot/kboot/arch/aarch64/ |
| H A D | load_addr.c | 112 int len, offset, fd2 = -1; in do_memory_from_fdt() local 194 fd2 = open("host:/dev/mem", O_RDONLY); in do_memory_from_fdt() 195 if (fd2 < 0) { in do_memory_from_fdt() 199 if (lseek(fd2, mmap_pa, SEEK_SET) < 0) { in do_memory_from_fdt() 203 len = read(fd2, map, sz); in do_memory_from_fdt() 213 close(fd2); in do_memory_from_fdt() 222 close(fd2); in do_memory_from_fdt()
|
| /freebsd-14.2/sys/contrib/openzfs/tests/zfs-tests/cmd/ |
| H A D | get_diff.c | 45 int fd1, fd2; in main() local 62 if ((fd2 = open(fname2, O_LARGEFILE | O_RDONLY)) < 0) { in main() 68 if (pread(fd2, buf2, DEV_BSIZE, off) < 0) { in main() 105 (void) close(fd2); in main()
|