| /freebsd-12.1/tests/sys/file/ |
| H A D | dup_test.c | 105 if (fd2 != fd1 + 1) in main() 151 if (fd2 != fd1) in main() 168 if (fd2 < 10) in main() 170 ++test, fd2); in main() 198 if (fd2 != fd1 + 1) in main() 223 if (fd2 != fd1) in main() 254 if (fd2 < 10) in main() 256 ++test, fd2); in main() 277 if (fd2 != fd1 + 1) in main() 317 if (fd2 != fd1 + 1) in main() [all …]
|
| /freebsd-12.1/lib/libutil/tests/ |
| H A D | flopen_test.c | 99 int fd1, fd2; in test_flopen_lock_self() local 106 fd2 = flopen(fn, O_RDWR|O_NONBLOCK); in test_flopen_lock_self() 107 if (fd2 >= 0) { in test_flopen_lock_self() 109 close(fd2); in test_flopen_lock_self() 125 volatile int fd1, fd2; in test_flopen_lock_other() local 132 fd2 = -42; in test_flopen_lock_other() 135 close(fd2); in test_flopen_lock_other() 138 if (fd2 == -42) in test_flopen_lock_other() 140 if (fd2 >= 0) in test_flopen_lock_other() 157 volatile int fd1, fd2; in test_flopen_lock_child() local [all …]
|
| /freebsd-12.1/tools/tools/netrate/juggle/ |
| H A D | juggle.c | 251 if (message_recv(fd2) < 0) in juggle() 254 if (message_send(fd2) < 0) in juggle() 288 int fd2, i, j; in juggling_thread() local 290 fd2 = *(int *)arg; in juggling_thread() 305 if (message_recv(fd2) < 0) in juggling_thread() 308 if (message_send(fd2) < 0) in juggling_thread() 389 if (message_send(fd2) < 0) { in process_juggle() 398 if (message_send(fd2) < 0) in process_juggle() 485 int fd1, fd2, i, j, p; in main() local 519 juggle(fd1, fd2, p); in main() [all …]
|
| /freebsd-12.1/tools/regression/sockets/unix_cmsg/ |
| H A D | t_cmsgcred.c | 86 int fd2, rv; in t_cmsgcred_server() local 91 fd2 = -1; in t_cmsgcred_server() 102 fd2 = uc_socket_accept(fd1); in t_cmsgcred_server() 103 if (fd2 < 0) in t_cmsgcred_server() 106 fd2 = fd1; in t_cmsgcred_server() 113 if (uc_message_recv(fd2, &msghdr) < 0) { in t_cmsgcred_server() 129 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsgcred_server() 130 if (uc_socket_close(fd2) < 0) in t_cmsgcred_server()
|
| H A D | t_cmsgcred_sockcred.c | 52 int fd2, rv, val; in t_cmsgcred_sockcred_server() local 54 fd2 = -1; in t_cmsgcred_sockcred_server() 77 fd2 = uc_socket_accept(fd1); in t_cmsgcred_sockcred_server() 78 if (fd2 < 0) in t_cmsgcred_sockcred_server() 81 fd2 = fd1; in t_cmsgcred_sockcred_server() 90 if (uc_message_recv(fd2, &msghdr) < 0) { in t_cmsgcred_sockcred_server() 115 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsgcred_sockcred_server() 116 if (uc_socket_close(fd2) < 0) in t_cmsgcred_sockcred_server()
|
| H A D | t_sockcred.c | 80 int fd2, rv, val; in t_sockcred_server() local 82 fd2 = -1; in t_sockcred_server() 105 fd2 = uc_socket_accept(fd1); in t_sockcred_server() 106 if (fd2 < 0) in t_sockcred_server() 109 fd2 = fd1; in t_sockcred_server() 114 if (setsockopt(fd2, 0, LOCAL_CREDS, &val, sizeof(val)) < 0) { in t_sockcred_server() 127 if (uc_message_recv(fd2, &msghdr) < 0) { in t_sockcred_server() 148 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_sockcred_server() 149 if (uc_socket_close(fd2) < 0) in t_sockcred_server()
|
| H A D | t_cmsg_len.c | 108 int fd2, rv; in t_cmsg_len_server() local 116 fd2 = uc_socket_accept(fd1); in t_cmsg_len_server() 117 if (fd2 < 0) in t_cmsg_len_server() 120 fd2 = fd1; in t_cmsg_len_server() 127 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsg_len_server() 128 if (uc_socket_close(fd2) < 0) in t_cmsg_len_server()
|
| H A D | t_peercred.c | 121 int fd2, rv; in t_peercred_server() local 126 fd2 = uc_socket_accept(fd1); in t_peercred_server() 127 if (fd2 < 0) in t_peercred_server() 131 if (getsockopt(fd2, 0, LOCAL_PEERCRED, &xucred, &len) < 0) { in t_peercred_server() 144 if (uc_socket_close(fd2) < 0) in t_peercred_server()
|
| H A D | t_xxxtime.c.in | 108 int fd2, rv; variable 113 fd2 = -1; 124 fd2 = uc_socket_accept(fd1); 125 if (fd2 < 0) 128 fd2 = fd1; 135 if (uc_message_recv(fd2, &msghdr) < 0) { 151 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) 152 if (uc_socket_close(fd2) < 0)
|
| /freebsd-12.1/usr.bin/cmp/ |
| H A D | cmp.c | 81 int ch, fd1, fd2, oflag, special; in main() local 137 fd2 = 0; in main() 140 else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) { in main() 151 if (fd2 == -1) { in main() 158 } else if (fd2 == -1) { in main() 168 if (cap_rights_limit(fd2, &rights) < 0 && errno != ENOSYS) in main() 175 if (cap_fcntls_limit(fd2, fcntls) < 0 && errno != ENOSYS) in main() 204 if (fstat(fd2, &sb2)) { in main() 216 c_special(fd1, file1, skip1, fd2, file2, skip2); in main() 225 fd2, file2, skip2, sb2.st_size); in main()
|
| H A D | regular.c | 62 int fd2, const char *file2, off_t skip2, off_t len2) in c_regular() argument 95 c_special(fd1, file1, skip1, fd2, file2, skip2); in c_regular() 99 if ((m2 = remmap(NULL, fd2, off2)) == NULL) { in c_regular() 101 c_special(fd1, file1, skip1, fd2, file2, skip2); in c_regular() 137 if ((p2 = m2 = remmap(m2, fd2, off2)) == NULL) { in c_regular()
|
| /freebsd-12.1/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-12.1/tests/sys/fs/fusefs/ |
| H A D | flush.cc | 97 int fd, fd2; in TEST_F() local 107 fd2 = open(FULLPATH, O_WRONLY); in TEST_F() 108 EXPECT_LE(0, fd2) << strerror(errno); in TEST_F() 110 EXPECT_EQ(0, close(fd2)) << strerror(errno); in TEST_F() 203 int fd, fd2; in TEST_F() local 229 fd2 = open(FULLPATH, O_WRONLY); in TEST_F() 230 ASSERT_LE(0, fd2) << strerror(errno); in TEST_F() 231 ASSERT_EQ(0, close(fd2)) << strerror(errno); in TEST_F() 233 leak(fd2); in TEST_F()
|
| H A D | release.cc | 82 int fd, fd2; in TEST_F() local 92 fd2 = dup(fd); in TEST_F() 93 ASSERT_LE(0, fd2) << strerror(errno); in TEST_F() 95 ASSERT_EQ(0, close(fd2)) << strerror(errno); in TEST_F() 157 int fd, fd2; in TEST_F() local 168 fd2 = open(FULLPATH, O_WRONLY); in TEST_F() 169 EXPECT_LE(0, fd2) << strerror(errno); in TEST_F() 171 ASSERT_EQ(0, close(fd2)) << strerror(errno); in TEST_F()
|
| /freebsd-12.1/tools/regression/sockets/accept_fd_leak/ |
| H A D | accept_fd_leak.c | 70 int fd1, fd2, fd3, i, listen_port, s, status; in main() local 78 fd2 = dup(STDIN_FILENO); in main() 79 if (fd2 != fd1 + 1) in main() 135 if (fd3 != fd2 + 2) in main() 136 printf("not ok 1 - (%d, %d, %d)\n", fd1, fd2, fd3); in main() 155 close(fd2); in main() 209 if (fd3 != fd2 + 2) in main() 210 printf("not ok 2 - (%d, %d, %d)\n", fd1, fd2, fd3); in main()
|
| /freebsd-12.1/tests/sys/kern/ |
| H A D | kern_descrip_test.c | 54 int fd1, fd2; in ATF_TC_BODY() local 58 fd2 = 27; in ATF_TC_BODY() 59 ATF_REQUIRE(dup2(fd1, fd2) != -1); in ATF_TC_BODY() 61 ATF_REQUIRE(fstat(fd2, &sb2) != -1); in ATF_TC_BODY() 73 int fd1, fd2, ret; in ATF_TC_BODY() local 76 fd2 = INT_MAX; in ATF_TC_BODY() 77 ret = dup2(fd1, fd2); in ATF_TC_BODY()
|
| /freebsd-12.1/lib/libc/gen/ |
| H A D | opendir.c | 122 int fd2, incr, len, n, saved_errno, space; in _filldir() local 152 if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1) in _filldir() 157 if (pos == -1 || lseek(fd2, pos, SEEK_SET) == -1) { in _filldir() 159 _close(fd2); in _filldir() 176 _close(fd2); in _filldir() 183 n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); in _filldir() 190 _close(fd2); in _filldir() 195 _close(fd2); in _filldir()
|
| /freebsd-12.1/tests/sys/fifo/ |
| H A D | fifo_misc.c | 72 cleanfifo(const char *fifoname, int fd1, int fd2) in cleanfifo() argument 77 if (fd2 != -1) in cleanfifo() 78 close(fd2); in cleanfifo() 85 int error, fd1, fd2; in openfifo() local 90 fd2 = open(fifoname, O_WRONLY | O_NONBLOCK); in openfifo() 91 if (fd2 < 0) { in openfifo() 98 *writer_fdp = fd2; in openfifo()
|
| /freebsd-12.1/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-12.1/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-12.1/contrib/netbsd-tests/kernel/kqueue/read/ |
| H A D | t_file2.c | 56 int fd1, fd2, kq; in ATF_TC_BODY() local 60 RL(fd2 = open("bfile", O_RDONLY|O_CREAT, 0644)); in ATF_TC_BODY() 71 RL(dup2(fd2, fd1)); in ATF_TC_BODY()
|
| /freebsd-12.1/contrib/ntp/sntp/libevent/test/ |
| H A D | regress_listener.c | 81 evutil_socket_t fd1 = -1, fd2 = -1, fd3 = -1; in regress_pick_a_port() local 117 fd1 = fd2 = fd3 = -1; in regress_pick_a_port() 119 evutil_socket_connect_(&fd2, (struct sockaddr*)&ss1, slen1); in regress_pick_a_port() 133 if (fd2>=0) in regress_pick_a_port() 134 EVUTIL_CLOSESOCKET(fd2); in regress_pick_a_port()
|
| /freebsd-12.1/contrib/libevent/test/ |
| H A D | regress_listener.c | 84 evutil_socket_t fd1 = -1, fd2 = -1, fd3 = -1; in regress_pick_a_port() local 120 fd1 = fd2 = fd3 = -1; in regress_pick_a_port() 122 evutil_socket_connect_(&fd2, (struct sockaddr*)&ss1, slen1); in regress_pick_a_port() 136 if (fd2>=0) in regress_pick_a_port() 137 EVUTIL_CLOSESOCKET(fd2); in regress_pick_a_port()
|
| /freebsd-12.1/tools/regression/security/cap_test/ |
| H A D | cap_test_capmode.c | 71 int fd_close, fd_dir, fd_file, fd_socket, fd2[2]; in test_capmode() local 181 if (pipe(fd2) == 0) { in test_capmode() 182 close(fd2[0]); in test_capmode() 183 close(fd2[1]); in test_capmode()
|
| /freebsd-12.1/tools/regression/poll/ |
| H A D | pipepoll.c | 93 int fd2, res; in child() local 198 fd2 = open(FIFONAME, O_RDONLY | O_NONBLOCK); in child() 199 if (fd2 < 0) in child() 201 pfd.fd = fd2; in child() 209 close(fd2); in child()
|