Home
last modified time | relevance | path

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

123

/freebsd/tests/sys/file/
H A Ddup_test.c81 int orgfd, fd1, fd2, test = 0; in main() local
88 if ((fd1 = dup(orgfd)) < 0) in main()
93 if (fcntl(fd1, F_SETFD, 1) != 0) in main()
97 if ((fd2 = dup2(fd1, fd1 + 1)) < 0) in main()
103 if (fd2 != fd1 + 1) in main()
143 if ((fd2 = dup2(fd1, fd1)) < 0) in main()
149 if (fd2 != fd1) in main()
164 if ((fd2 = fcntl(fd1, F_DUPFD, 10)) < 0) in main()
184 if ((fd2 = dup2(fd1, rlp.rlim_cur + 1)) >= 0) in main()
190 if ((fd2 = fcntl(fd1, F_DUP2FD, fd1 + 1)) < 0) in main()
[all …]
/freebsd/lib/libutil/tests/
H A Dflopen_test.c96 int fd1, fd2; in test_flopen_lock_self() local
99 fd1 = flopen(fn, O_RDWR|O_CREAT, 0640); in test_flopen_lock_self()
100 if (fd1 < 0) { in test_flopen_lock_self()
108 close(fd1); in test_flopen_lock_self()
122 volatile int fd1, fd2; in test_flopen_lock_other() local
125 fd1 = flopen(fn, O_RDWR|O_CREAT, 0640); in test_flopen_lock_other()
126 if (fd1 < 0) { in test_flopen_lock_other()
139 close(fd1); in test_flopen_lock_other()
154 volatile int fd1, fd2; in test_flopen_lock_child() local
157 fd1 = flopen(fn, O_RDWR|O_CREAT, 0640); in test_flopen_lock_child()
[all …]
/freebsd/tools/tools/netrate/juggle/
H A Djuggle.c233 juggle(int fd1, int fd2, int pipeline) in juggle() argument
244 if (message_send(fd1) < 0) in juggle()
257 if (message_recv(fd1) < 0) in juggle()
315 thread_juggle(int fd1, int fd2, int pipeline) in thread_juggle() argument
345 if (message_send(fd1) < 0) in thread_juggle()
350 if (message_recv(fd1) < 0) in thread_juggle()
374 process_juggle(int fd1, int fd2, int pipeline) in process_juggle() argument
406 if (message_recv(fd1) < 0) { in process_juggle()
418 if (message_send(fd1) < 0) { in process_juggle()
427 if (message_recv(fd1) < 0) { in process_juggle()
[all …]
/freebsd/tests/sys/fs/fusefs/
H A Dcopy_file_range.cc163 int fd1, fd2; in TEST_F() local
184 fd1 = open(FULLPATH1, O_RDONLY); in TEST_F()
186 ASSERT_EQ(-1, copy_file_range(fd1, &start1, fd2, &start2, len, 0)); in TEST_F()
210 int fd1, fd2; in TEST_F() local
239 fd1 = open(FULLPATH1, O_RDONLY); in TEST_F()
249 ASSERT_EQ(len, copy_file_range(fd1, &start1, fd2, &start2, len, 0)); in TEST_F()
264 leak(fd1); in TEST_F()
287 int fd1, fd2; in TEST_F() local
317 fd1 = open(FULLPATH1, O_RDONLY); in TEST_F()
318 ASSERT_GE(fd1, 0); in TEST_F()
[all …]
H A Dunlink.cc71 int fd1; in TEST_F()
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()
72 int fd1; TEST_F() local
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/contrib/netbsd-tests/lib/libc/sys/
H A Dt_dup.c60 int fd, fd1, fd2; in check_mode() local
71 fd1 = open(path, mode[i] | O_CREAT, perm[j]); in check_mode()
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()
93 ATF_REQUIRE(fstat(fd1, &st1) == 0); 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()
[all …]
/freebsd/tools/test/stress2/misc/
H A Drdwr.sh82 int fd1, fd2;
89 if ((fd1 = open("/dev/null", O_RDWR, 0)) == -1)
107 if ((r = write(fd1, p, len)) != len)
113 if ((r = pwrite(fd1, p, len, 0)) != len)
121 if ((r = writev(fd1, &iov, 1)) != len)
127 if ((r = pwritev(fd1, &iov, 1, 0)) != len)
130 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/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/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/tests/sys/kern/
H A Dkern_descrip_test.c57 int fd1, fd2; in ATF_TC_BODY() local
60 ATF_REQUIRE((fd1 = open(AFILE, O_CREAT, 0644)) != -1); in ATF_TC_BODY()
62 ATF_REQUIRE(dup2(fd1, fd2) != -1); in ATF_TC_BODY()
63 ATF_REQUIRE(fstat(fd1, &sb1) != -1); in ATF_TC_BODY()
76 int fd1, fd2, ret; in ATF_TC_BODY() local
78 ATF_REQUIRE((fd1 = open(AFILE, O_CREAT, 0644)) != -1); in ATF_TC_BODY()
80 ret = dup2(fd1, fd2); in ATF_TC_BODY()
/freebsd/usr.bin/cmp/
H A Dcmp.c100 int ch, fd1, fd2, oflag; in main() local
166 fd1 = STDIN_FILENO; in main()
168 } else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) { in main()
201 if (fd1 == -1) { in main()
220 if (fstat(fd1, &sb1)) { in main()
244 ret = c_special(fd1, file1, skip1, fd2, file2, skip2, limit); in main()
252 ret = c_regular(fd1, file1, skip1, sb1.st_size, in main()
H A Dregular.c54 c_regular(int fd1, const char *file1, off_t skip1, off_t len1, in c_regular() argument
88 if ((m1 = remmap(NULL, fd1, off1)) == NULL) { in c_regular()
89 return (c_special(fd1, file1, skip1, fd2, file2, skip2, limit)); in c_regular()
94 return (c_special(fd1, file1, skip1, fd2, file2, skip2, limit)); in c_regular()
97 if (caph_rights_limit(fd1, cap_rights_init(&rights, CAP_MMAP_R)) < 0) in c_regular()
145 if ((p1 = m1 = remmap(m1, fd1, off1)) == NULL) { in c_regular()
/freebsd/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/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/tools/regression/sockets/unix_cmsg/
H A Dt_cmsgcred_sockcred.c41 t_cmsgcred_sockcred_server(int fd1) in t_cmsgcred_sockcred_server() argument
65 if (setsockopt(fd1, 0, LOCAL_CREDS, &val, sizeof(val)) < 0) { in t_cmsgcred_sockcred_server()
74 fd2 = uc_socket_accept(fd1); in t_cmsgcred_sockcred_server()
78 fd2 = fd1; in t_cmsgcred_sockcred_server()
H A Dt_sockcred.c69 t_sockcred_server(int type, int fd1) in t_sockcred_server() argument
92 if (setsockopt(fd1, 0, LOCAL_CREDS, &val, sizeof(val)) < 0) { in t_sockcred_server()
102 fd2 = uc_socket_accept(fd1); in t_sockcred_server()
106 fd2 = fd1; in t_sockcred_server()
H A Dt_cmsg_len.c103 t_cmsg_len_server(int fd1) in t_cmsg_len_server() argument
113 fd2 = uc_socket_accept(fd1); in t_cmsg_len_server()
117 fd2 = fd1; in t_cmsg_len_server()
H A Dt_cmsgcred.c75 t_cmsgcred_server(int fd1) in t_cmsgcred_server() argument
99 fd2 = uc_socket_accept(fd1); in t_cmsgcred_server()
103 fd2 = fd1; in t_cmsgcred_server()
/freebsd/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/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