Home
last modified time | relevance | path

Searched refs:fd1 (Results 1 – 25 of 71) sorted by relevance

123

/freebsd-14.2/tests/sys/file/
H A Ddup_test.c97 if ((fd2 = dup2(fd1, fd1 + 1)) < 0) in main()
143 if ((fd2 = dup2(fd1, fd1)) < 0) in main()
149 if (fd2 != fd1) in main()
190 if ((fd2 = fcntl(fd1, F_DUP2FD, fd1 + 1)) < 0) in main()
215 if ((fd2 = fcntl(fd1, F_DUP2FD, fd1)) < 0) in main()
221 if (fd2 != fd1) in main()
269 if ((fd2 = fcntl(fd1, F_DUP2FD_CLOEXEC, fd1 + 1)) < 0) in main()
309 if ((fd2 = dup3(fd1, fd1 + 1, O_CLOEXEC)) < 0) in main()
334 if ((fd2 = dup3(fd1, fd1 + 1, 0)) < 0) in main()
360 if (dup3(fd1, fd1, O_CLOEXEC) != -1) in main()
[all …]
/freebsd-14.2/lib/libutil/tests/
H A Dflopen_test.c97 int fd1, fd2; in test_flopen_lock_self() local
100 fd1 = flopen(fn, O_RDWR|O_CREAT, 0640); in test_flopen_lock_self()
101 if (fd1 < 0) { in test_flopen_lock_self()
109 close(fd1); in test_flopen_lock_self()
123 volatile int fd1, fd2; in test_flopen_lock_other() local
126 fd1 = flopen(fn, O_RDWR|O_CREAT, 0640); in test_flopen_lock_other()
127 if (fd1 < 0) { in test_flopen_lock_other()
140 close(fd1); in test_flopen_lock_other()
155 volatile int fd1, fd2; in test_flopen_lock_child() local
159 if (fd1 < 0) { in test_flopen_lock_child()
[all …]
/freebsd-14.2/tools/tools/netrate/juggle/
H A Djuggle.c244 if (message_send(fd1) < 0) in juggle()
257 if (message_recv(fd1) < 0) in juggle()
345 if (message_send(fd1) < 0) in thread_juggle()
350 if (message_recv(fd1) < 0) in thread_juggle()
406 if (message_recv(fd1) < 0) { in process_juggle()
418 if (message_send(fd1) < 0) { in process_juggle()
483 int fd1, fd2, i, j, p; in main() local
517 juggle(fd1, fd2, p); in main()
520 process_juggle(fd1, fd2, p); in main()
524 thread_juggle(fd1, fd2, p); in main()
[all …]
/freebsd-14.2/tests/sys/fs/fusefs/
H A Dcopy_file_range.cc163 int fd1, fd2; in TEST_F() local
210 int fd1, fd2; in TEST_F() local
264 leak(fd1); 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
637 leak(fd1); in TEST_F()
732 leak(fd1); in TEST_F()
[all …]
H A Dunlink.cc71 int fd1; in TEST_F() local
78 fd1 = open(FULLPATH1, O_RDONLY); in TEST_F()
79 ASSERT_LE(0, fd1) << strerror(errno); in TEST_F()
81 ASSERT_EQ(0, fstat(fd1, &sb_old)) << strerror(errno); in TEST_F()
83 ASSERT_EQ(0, fstat(fd1, &sb_new)) << strerror(errno); in TEST_F()
87 leak(fd1); in TEST_F()
H A Dfsync.cc269 int fd1, fd2; in TEST_F() local
276 fd1 = open(FULLPATH, O_WRONLY); in TEST_F()
277 ASSERT_LE(0, fd1) << strerror(errno); in TEST_F()
280 ASSERT_EQ(bufsize, write(fd1, CONTENTS, bufsize)) << strerror(errno); in TEST_F()
281 ASSERT_EQ(0, fsync(fd1)) << strerror(errno); in TEST_F()
283 leak(fd1); in TEST_F()
/freebsd-14.2/tools/test/stress2/misc/
H A Drdwr.sh67 int fd1, fd2;
73 if ((fd1 = open("/dev/null", O_RDWR, 0)) == -1)
91 if (write(fd1, p, len) != len)
97 if (pwrite(fd1, p, len, 0) != len)
105 if (writev(fd1, &iov, 1) != len)
111 if (pwritev(fd1, &iov, 1, 0) != len)
114 close(fd1);
H A Dkevent.sh66 static int fd1[2];
82 EV_SET(&ev[n], fd1[1], EVFILT_WRITE,
104 EV_SET(&ev[n], fd1[1], EVFILT_WRITE,
127 close(fd1[0]);
128 close(fd1[1]);
146 if (pipe(fd1) == -1)
H A Dkevent2.sh63 static int fd1[2];
78 EV_SET(&ev[n], fd1[1], EVFILT_WRITE,
100 EV_SET(&ev[n], fd1[1], EVFILT_WRITE,
109 close(fd1[1]);
128 close(fd1[0]);
142 if (pipe(fd1) == -1)
H A Dpmc5.sh65 static int fd1[2];
82 // if (pmc_configure_logfile(fd1[1]) < 0)
108 if (pipe(fd1) == -1)
115 EV_SET(&ev[n], fd1[1], EVFILT_WRITE,
122 EV_SET(&ev[n], fd1[1], EVFILT_WRITE,
H A Dpmc4.sh61 static int fd1[2];
94 if (pipe(fd1) == -1)
101 EV_SET(&ev[n], fd1[1], EVFILT_WRITE,
108 EV_SET(&ev[n], fd1[1], EVFILT_WRITE,
/freebsd-14.2/contrib/netbsd-tests/lib/libc/sys/
H A Dt_dup.c60 int fd, fd1, fd2; in check_mode() local
74 ATF_REQUIRE(fd1 >= 0); in check_mode()
78 fd = dup(fd1); in check_mode()
80 fd = dup2(fd1, fd2); in check_mode()
82 fd = dup3(fd1, fd2, O_CLOEXEC); in check_mode()
99 (void)close(fd1); in check_mode()
114 int fd, fd1, fd2; in ATF_TC_BODY() local
116 fd1 = open("/etc/passwd", O_RDONLY); in ATF_TC_BODY()
119 ATF_REQUIRE(fd1 >= 0); in ATF_TC_BODY()
122 fd = dup2(fd1, fd2); in ATF_TC_BODY()
[all …]
/freebsd-14.2/contrib/netbsd-tests/kernel/kqueue/read/
H A Dt_file2.c56 int fd1, fd2, kq; in ATF_TC_BODY() local
59 RL(fd1 = open("afile", O_RDONLY|O_CREAT, 0644)); in ATF_TC_BODY()
63 RL(lseek(fd1, 0, SEEK_END)); in ATF_TC_BODY()
68 EV_SET(&event[0], fd1, EVFILT_READ, EV_ADD|EV_ENABLE, 0, 0, 0); in ATF_TC_BODY()
71 RL(dup2(fd2, fd1)); in ATF_TC_BODY()
/freebsd-14.2/tests/sys/fifo/
H A Dfifo_misc.c70 cleanfifo(const char *fifoname, int fd1, int fd2) in cleanfifo() argument
73 if (fd1 != -1) in cleanfifo()
74 close(fd1); in cleanfifo()
83 int error, fd1, fd2; in openfifo() local
85 fd1 = open(fifoname, O_RDONLY | O_NONBLOCK); in openfifo()
86 if (fd1 < 0) in openfifo()
91 close(fd1); in openfifo()
95 *reader_fdp = fd1; in openfifo()
/freebsd-14.2/tests/sys/kern/
H A Dkern_descrip_test.c58 int fd1, fd2; in ATF_TC_BODY() local
61 ATF_REQUIRE((fd1 = open(AFILE, O_CREAT, 0644)) != -1); in ATF_TC_BODY()
63 ATF_REQUIRE(dup2(fd1, fd2) != -1); in ATF_TC_BODY()
64 ATF_REQUIRE(fstat(fd1, &sb1) != -1); in ATF_TC_BODY()
77 int fd1, fd2, ret; in ATF_TC_BODY() local
79 ATF_REQUIRE((fd1 = open(AFILE, O_CREAT, 0644)) != -1); in ATF_TC_BODY()
81 ret = dup2(fd1, fd2); in ATF_TC_BODY()
/freebsd-14.2/usr.bin/cmp/
H A Dcmp.c113 int ch, fd1, fd2, oflag; in main() local
179 fd1 = STDIN_FILENO; in main()
181 } else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) { in main()
214 if (fd1 == -1) { in main()
233 if (fstat(fd1, &sb1)) { in main()
257 ret = c_special(fd1, file1, skip1, fd2, file2, skip2, limit); in main()
265 ret = c_regular(fd1, file1, skip1, sb1.st_size, in main()
H A Dregular.c61 c_regular(int fd1, const char *file1, off_t skip1, off_t len1, in c_regular() argument
95 if ((m1 = remmap(NULL, fd1, off1)) == NULL) { in c_regular()
96 return (c_special(fd1, file1, skip1, fd2, file2, skip2, limit)); in c_regular()
101 return (c_special(fd1, file1, skip1, fd2, file2, skip2, limit)); in c_regular()
104 if (caph_rights_limit(fd1, cap_rights_init(&rights, CAP_MMAP_R)) < 0) in c_regular()
152 if ((p1 = m1 = remmap(m1, fd1, off1)) == NULL) { in c_regular()
/freebsd-14.2/sys/contrib/openzfs/tests/zfs-tests/cmd/
H A Dget_diff.c45 int fd1, fd2; in main() local
55 if ((fd1 = open(fname1, O_LARGEFILE | O_RDONLY)) < 0) { in main()
67 while ((bytes = pread(fd1, buf1, DEV_BSIZE, off)) > 0) { in main()
104 (void) close(fd1); in main()
/freebsd-14.2/tools/regression/sockets/accept_fd_leak/
H A Daccept_fd_leak.c68 int fd1, fd2, fd3, i, listen_port, s, status; in main() local
75 fd1 = dup(STDIN_FILENO); in main()
77 if (fd2 != fd1 + 1) in main()
134 printf("not ok 1 - (%d, %d, %d)\n", fd1, fd2, fd3); in main()
152 close(fd1); in main()
208 printf("not ok 2 - (%d, %d, %d)\n", fd1, fd2, fd3); in main()
/freebsd-14.2/tools/regression/sockets/unix_cmsg/
H A Dt_cmsgcred_sockcred.c42 t_cmsgcred_sockcred_server(int fd1) in t_cmsgcred_sockcred_server() argument
66 if (setsockopt(fd1, 0, LOCAL_CREDS, &val, sizeof(val)) < 0) { in t_cmsgcred_sockcred_server()
75 fd2 = uc_socket_accept(fd1); in t_cmsgcred_sockcred_server()
79 fd2 = fd1; in t_cmsgcred_sockcred_server()
H A Dt_sockcred.c70 t_sockcred_server(int type, int fd1) in t_sockcred_server() argument
93 if (setsockopt(fd1, 0, LOCAL_CREDS, &val, sizeof(val)) < 0) { in t_sockcred_server()
103 fd2 = uc_socket_accept(fd1); in t_sockcred_server()
107 fd2 = fd1; in t_sockcred_server()
H A Dt_cmsg_len.c104 t_cmsg_len_server(int fd1) in t_cmsg_len_server() argument
114 fd2 = uc_socket_accept(fd1); in t_cmsg_len_server()
118 fd2 = fd1; in t_cmsg_len_server()
H A Dt_cmsgcred.c76 t_cmsgcred_server(int fd1) in t_cmsgcred_server() argument
100 fd2 = uc_socket_accept(fd1); in t_cmsgcred_server()
104 fd2 = fd1; in t_cmsgcred_server()
/freebsd-14.2/contrib/ntp/sntp/libevent/test/
H A Dregress_listener.c83 evutil_socket_t fd1, fd2, fd3; in regress_pick_a_port() local
85 fd1 = fd2 = fd3 = EVUTIL_INVALID_SOCKET; in regress_pick_a_port()
121 fd1 = fd2 = fd3 = EVUTIL_INVALID_SOCKET; in regress_pick_a_port()
122 evutil_socket_connect_(&fd1, (struct sockaddr*)&ss1, slen1); in regress_pick_a_port()
135 if (fd1>=0) in regress_pick_a_port()
136 EVUTIL_CLOSESOCKET(fd1); in regress_pick_a_port()
245 evutil_socket_t fd1 = EVUTIL_INVALID_SOCKET, fd2 = EVUTIL_INVALID_SOCKET; in regress_listener_immediate_close() local
260 evutil_socket_connect_(&fd1, (struct sockaddr*)&ss, slen); in regress_listener_immediate_close()
/freebsd-14.2/contrib/libevent/test/
H A Dregress_listener.c83 evutil_socket_t fd1, fd2, fd3; in regress_pick_a_port() local
85 fd1 = fd2 = fd3 = EVUTIL_INVALID_SOCKET; in regress_pick_a_port()
121 fd1 = fd2 = fd3 = EVUTIL_INVALID_SOCKET; in regress_pick_a_port()
122 evutil_socket_connect_(&fd1, (struct sockaddr*)&ss1, slen1); in regress_pick_a_port()
135 if (fd1>=0) in regress_pick_a_port()
136 EVUTIL_CLOSESOCKET(fd1); in regress_pick_a_port()
245 evutil_socket_t fd1 = EVUTIL_INVALID_SOCKET, fd2 = EVUTIL_INVALID_SOCKET; in regress_listener_immediate_close() local
260 evutil_socket_connect_(&fd1, (struct sockaddr*)&ss, slen); in regress_listener_immediate_close()

123