Home
last modified time | relevance | path

Searched refs:fd2 (Results 1 – 25 of 89) sorted by relevance

1234

/freebsd/tests/sys/file/
H A Ddup_test.c81 int orgfd, fd1, fd2, test = 0; in main() local
97 if ((fd2 = dup2(fd1, fd1 + 1)) < 0) in main()
103 if (fd2 != fd1 + 1) in main()
111 if (fcntl(fd2, F_GETFD) != 0) in main()
143 if ((fd2 = dup2(fd1, fd1)) < 0) in main()
149 if (fd2 != fd1) in main()
158 if (fcntl(fd2, F_GETFD) == 0) in main()
164 if ((fd2 = fcntl(fd1, F_DUPFD, 10)) < 0) in main()
166 if (fd2 < 10) in main()
168 ++test, fd2); in main()
[all …]
/freebsd/lib/libutil/tests/
H A Dflopen_test.c96 int fd1, fd2; in test_flopen_lock_self() local
103 fd2 = flopen(fn, O_RDWR|O_NONBLOCK); in test_flopen_lock_self()
104 if (fd2 >= 0) { in test_flopen_lock_self()
106 close(fd2); in test_flopen_lock_self()
122 volatile int fd1, fd2; in test_flopen_lock_other() local
129 fd2 = -42; in test_flopen_lock_other()
131 fd2 = flopen(fn, O_RDWR|O_NONBLOCK); in test_flopen_lock_other()
132 close(fd2); in test_flopen_lock_other()
135 if (fd2 == -42) in test_flopen_lock_other()
137 if (fd2 >= 0) in test_flopen_lock_other()
[all …]
/freebsd/tools/tools/netrate/juggle/
H A Djuggle.c233 juggle(int fd1, int fd2, int pipeline) in juggle() argument
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()
315 thread_juggle(int fd1, int fd2, int pipeline) in thread_juggle() argument
326 if (pthread_create(&thread, NULL, juggling_thread, &fd2) != 0) in thread_juggle()
374 process_juggle(int fd1, int fd2, int pipeline) in process_juggle() argument
[all …]
/freebsd/tools/regression/sockets/unix_cmsg/
H A Dt_cmsgcred_sockcred.c49 int fd2, rv, val; in t_cmsgcred_sockcred_server() local
51 fd2 = -1; in t_cmsgcred_sockcred_server()
74 fd2 = uc_socket_accept(fd1); in t_cmsgcred_sockcred_server()
75 if (fd2 < 0) in t_cmsgcred_sockcred_server()
78 fd2 = fd1; in t_cmsgcred_sockcred_server()
87 if (uc_message_recv(fd2, &msghdr) < 0) { in t_cmsgcred_sockcred_server()
112 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsgcred_sockcred_server()
113 if (uc_socket_close(fd2) < 0) in t_cmsgcred_sockcred_server()
H A Dt_cmsgcred.c83 int fd2, rv; in t_cmsgcred_server() local
88 fd2 = -1; in t_cmsgcred_server()
99 fd2 = uc_socket_accept(fd1); in t_cmsgcred_server()
100 if (fd2 < 0) in t_cmsgcred_server()
103 fd2 = fd1; in t_cmsgcred_server()
110 if (uc_message_recv(fd2, &msghdr) < 0) { in t_cmsgcred_server()
126 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsgcred_server()
127 if (uc_socket_close(fd2) < 0) in t_cmsgcred_server()
H A Dt_sockcred.c77 int fd2, rv, val; in t_sockcred_server() local
79 fd2 = -1; in t_sockcred_server()
102 fd2 = uc_socket_accept(fd1); in t_sockcred_server()
103 if (fd2 < 0) in t_sockcred_server()
106 fd2 = fd1; in t_sockcred_server()
111 if (setsockopt(fd2, 0, LOCAL_CREDS, &val, sizeof(val)) < 0) { in t_sockcred_server()
124 if (uc_message_recv(fd2, &msghdr) < 0) { in t_sockcred_server()
145 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_sockcred_server()
146 if (uc_socket_close(fd2) < 0) in t_sockcred_server()
H A Dt_cmsg_len.c105 int fd2, rv; in t_cmsg_len_server() local
113 fd2 = uc_socket_accept(fd1); in t_cmsg_len_server()
114 if (fd2 < 0) in t_cmsg_len_server()
117 fd2 = fd1; in t_cmsg_len_server()
124 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0) in t_cmsg_len_server()
125 if (uc_socket_close(fd2) < 0) in t_cmsg_len_server()
H A Dt_peercred.c118 int fd2, rv; in t_peercred_server() local
123 fd2 = uc_socket_accept(fd1); in t_peercred_server()
124 if (fd2 < 0) in t_peercred_server()
128 if (getsockopt(fd2, 0, LOCAL_PEERCRED, &xucred, &len) < 0) { in t_peercred_server()
141 if (uc_socket_close(fd2) < 0) in t_peercred_server()
/freebsd/tests/sys/fs/fusefs/
H A Dcopy_file_range.cc163 int fd1, fd2; in TEST_F() local
185 fd2 = open(FULLPATH2, O_WRONLY); 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
240 fd2 = open(FULLPATH2, O_RDWR); in TEST_F()
244 ASSERT_EQ(m_maxbcachebuf, pread(fd2, buf, m_maxbcachebuf, start2)) in TEST_F()
249 ASSERT_EQ(len, copy_file_range(fd1, &start1, fd2, &start2, len, 0)); in TEST_F()
257 ASSERT_EQ(m_maxbcachebuf, pread(fd2, buf, m_maxbcachebuf, start2)) in TEST_F()
265 leak(fd2); in TEST_F()
287 int fd1, fd2; in TEST_F() local
[all …]
H A Dflush.cc95 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 Drelease.cc80 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/tools/test/stress2/misc/
H A Drdwr.sh82 int fd1, fd2;
92 if ((fd2 = open("/dev/zero", O_RDWR)) == -1)
100 if ((p = mmap(0, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd2, 0)) ==
104 if ((r = read(fd2, p, len)) != len)
110 if ((r = pread(fd2, p, len, 0)) != len)
118 if ((r = readv(fd2, &iov, 1)) != len)
124 if ((r = preadv(fd2, &iov, 1, 0)) != len)
131 close(fd2);
H A Ddup2.sh55 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 Ddevfd.sh73 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/contrib/netbsd-tests/lib/libc/sys/
H A Dt_dup.c60 int fd, fd1, fd2; in check_mode() local
72 fd2 = open("/etc/passwd", O_RDONLY); in check_mode()
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()
[all …]
/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
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/usr.bin/cmp/
H A Dcmp.c100 int ch, fd1, fd2, oflag; in main() local
179 fd2 = STDIN_FILENO; in main()
181 } else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) { in main()
202 if (fd2 == -1) { in main()
209 } else if (fd2 == -1) { in main()
229 if (fstat(fd2, &sb2)) { in main()
244 ret = c_special(fd1, file1, skip1, fd2, file2, skip2, limit); in main()
253 fd2, file2, skip2, sb2.st_size, limit); in main()
H A Dregular.c55 int fd2, const char *file2, off_t skip2, off_t len2, off_t limit) in c_regular() argument
89 return (c_special(fd1, file1, skip1, fd2, file2, skip2, limit)); in c_regular()
92 if ((m2 = remmap(NULL, fd2, off2)) == NULL) { in c_regular()
94 return (c_special(fd1, file1, skip1, fd2, file2, skip2, limit)); in c_regular()
99 if (caph_rights_limit(fd2, cap_rights_init(&rights, CAP_MMAP_R)) < 0) in c_regular()
153 if ((p2 = m2 = remmap(m2, fd2, off2)) == NULL) { in c_regular()
/freebsd/stand/kboot/kboot/arch/aarch64/
H A Dload_addr.c112 int len, offset, fd2 = -1; in do_memory_from_fdt()
194 fd2 = open("host:/dev/mem", O_RDONLY); in bi_loadsmap()
195 if (fd2 < 0) { in bi_loadsmap()
199 if (lseek(fd2, mmap_pa, SEEK_SET) < 0) { in bi_loadsmap()
203 len = read(fd2, map, sz); in bi_loadsmap()
213 close(fd2);
222 close(fd2);
31 int len, offset, fd2 = -1; do_memory_from_fdt() local
/freebsd/tests/sys/kern/
H A Dkern_descrip_test.c57 int fd1, fd2; in ATF_TC_BODY() local
61 fd2 = 27; in ATF_TC_BODY()
62 ATF_REQUIRE(dup2(fd1, fd2) != -1); in ATF_TC_BODY()
64 ATF_REQUIRE(fstat(fd2, &sb2) != -1); in ATF_TC_BODY()
76 int fd1, fd2, ret; in ATF_TC_BODY() local
79 fd2 = INT_MAX; in ATF_TC_BODY()
80 ret = dup2(fd1, fd2); in ATF_TC_BODY()
/freebsd/lib/libc/gen/
H A Dopendir.c116 int fd2, incr, len, n, saved_errno, space; in _filldir() local
146 if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1) in _filldir()
151 if (pos == -1 || lseek(fd2, pos, SEEK_SET) == -1) { in _filldir()
153 _close(fd2); in _filldir()
170 _close(fd2); in _filldir()
177 n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); in _filldir()
184 _close(fd2); in _filldir()
189 _close(fd2); in _filldir()
/freebsd/tools/regression/nfsmmap/test2/
H A Dtest2.c8 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/tools/regression/nfsmmap/test1/
H A Dtest1.c8 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/tests/sys/fifo/
H A Dfifo_misc.c70 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/sys/contrib/openzfs/tests/zfs-tests/cmd/
H A Dget_diff.c45 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()

1234