Searched refs:fd2 (Results 1 - 25 of 84) sorted by relevance

1234

/freebsd-current/tools/test/stress2/misc/
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 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 Dpts2.sh64 int fd, fd2, slave;
75 if ((fd2 = open(sl, O_RDONLY | O_EXLOCK)) == -1)
H A Dkevent.sh67 static int fd2[2];
85 EV_SET(&ev[n], fd2[1], EVFILT_WRITE,
129 close(fd2[0]);
130 close(fd2[1]);
148 if (pipe(fd2) == -1)
H A Dkevent2.sh64 static int fd2[2];
81 EV_SET(&ev[n], fd2[1], EVFILT_WRITE,
110 close(fd2[1]);
129 close(fd2[0]);
144 if (pipe(fd2) == -1)
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);
H A Ddup.sh76 int fd, fd2, i, j, last;
86 if ((fd2 = dup(fd)) == -1) {
91 last = fd2;
/freebsd-current/tests/sys/file/
H A Ddup_test.c81 int orgfd, fd1, fd2, test = 0; local
97 if ((fd2 = dup2(fd1, fd1 + 1)) < 0)
103 if (fd2 != fd1 + 1)
111 if (fcntl(fd2, F_GETFD) != 0)
143 if ((fd2 = dup2(fd1, fd1)) < 0)
149 if (fd2 != fd1)
158 if (fcntl(fd2, F_GETFD) == 0)
164 if ((fd2 = fcntl(fd1, F_DUPFD, 10)) < 0)
166 if (fd2 < 10)
168 ++test, fd2);
[all...]
/freebsd-current/lib/libutil/tests/
H A Dflopen_test.c96 int fd1, fd2; local
103 fd2 = flopen(fn, O_RDWR|O_NONBLOCK);
104 if (fd2 >= 0) {
106 close(fd2);
122 volatile int fd1, fd2; local
129 fd2 = -42;
131 fd2 = flopen(fn, O_RDWR|O_NONBLOCK);
132 close(fd2);
135 if (fd2 == -42)
137 if (fd2 >
154 volatile int fd1, fd2; local
[all...]
/freebsd-current/tools/regression/nfsmmap/test1/
H A Dtest1.c8 int fd, fd2; local
40 fd2 = open("test1.scratch", O_RDWR|O_CREAT, 0666);
41 if (fd2 < 0)
44 if (write(fd2, addr, 4096) < 0)
/freebsd-current/tools/regression/nfsmmap/test2/
H A Dtest2.c8 int fd, fd2; local
38 fd2 = open("test2.scratch", O_RDWR|O_CREAT, 0666);
39 if (fd2 < 0)
42 if (write(fd2, addr, 4096) < 0)
/freebsd-current/tools/regression/sockets/unix_cmsg/
H A Dt_cmsgcred_sockcred.c49 int fd2, rv, val; local
51 fd2 = -1;
74 fd2 = uc_socket_accept(fd1);
75 if (fd2 < 0)
78 fd2 = fd1;
87 if (uc_message_recv(fd2, &msghdr) < 0) {
112 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0)
113 if (uc_socket_close(fd2) < 0)
H A Dt_cmsgcred.c83 int fd2, rv; local
88 fd2 = -1;
99 fd2 = uc_socket_accept(fd1);
100 if (fd2 < 0)
103 fd2 = fd1;
110 if (uc_message_recv(fd2, &msghdr) < 0) {
126 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0)
127 if (uc_socket_close(fd2) < 0)
H A Dt_sockcred.c77 int fd2, rv, val; local
79 fd2 = -1;
102 fd2 = uc_socket_accept(fd1);
103 if (fd2 < 0)
106 fd2 = fd1;
111 if (setsockopt(fd2, 0, LOCAL_CREDS, &val, sizeof(val)) < 0) {
124 if (uc_message_recv(fd2, &msghdr) < 0) {
145 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0)
146 if (uc_socket_close(fd2) < 0)
H A Dt_cmsg_len.c105 int fd2, rv; local
113 fd2 = uc_socket_accept(fd1);
114 if (fd2 < 0)
117 fd2 = fd1;
124 if (uc_cfg.sock_type == SOCK_STREAM && fd2 >= 0)
125 if (uc_socket_close(fd2) < 0)
H A Dt_peercred.c118 int fd2, rv; local
123 fd2 = uc_socket_accept(fd1);
124 if (fd2 < 0)
128 if (getsockopt(fd2, 0, LOCAL_PEERCRED, &xucred, &len) < 0) {
141 if (uc_socket_close(fd2) < 0)
/freebsd-current/contrib/netbsd-tests/kernel/kqueue/read/
H A Dt_file2.c56 int fd1, fd2, kq; local
60 RL(fd2 = open("bfile", O_RDONLY|O_CREAT, 0644));
71 RL(dup2(fd2, fd1));
/freebsd-current/sys/contrib/openzfs/tests/zfs-tests/cmd/
H A Dget_diff.c45 int fd1, fd2; local
62 if ((fd2 = open(fname2, O_LARGEFILE | O_RDONLY)) < 0) {
68 if (pread(fd2, buf2, DEV_BSIZE, off) < 0) {
105 (void) close(fd2);
/freebsd-current/tools/regression/sockets/accept_fd_leak/
H A Daccept_fd_leak.c68 int fd1, fd2, fd3, i, listen_port, s, status; local
76 fd2 = dup(STDIN_FILENO);
77 if (fd2 != fd1 + 1)
129 * Allocate a file descriptor and make sure it's fd2+2. 2 because
133 if (fd3 != fd2 + 2)
134 printf("not ok 1 - (%d, %d, %d)\n", fd1, fd2, fd3);
153 close(fd2);
203 * Allocate a file descriptor and make sure it's fd2+2. 2 because
207 if (fd3 != fd2 + 2)
208 printf("not ok 2 - (%d, %d, %d)\n", fd1, fd2, fd
[all...]
/freebsd-current/usr.bin/cmp/
H A Dcmp.c100 int ch, fd1, fd2, oflag; local
178 fd2 = STDIN_FILENO;
180 } else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) {
201 if (fd2 == -1) {
208 } else if (fd2 == -1) {
228 if (fstat(fd2, &sb2)) {
243 c_special(fd1, file1, skip1, fd2, file2, skip2, limit);
252 fd2, file2, skip2, sb2.st_size, limit);
H A Dspecial.c43 int fd2, const char *file2, off_t skip2, off_t limit)
52 if (caph_limit_stream(fd2, CAPH_READ) < 0)
60 if ((fp2 = fdopen(fd2, "r")) == NULL)
42 c_special(int fd1, const char *file1, off_t skip1, int fd2, const char *file2, off_t skip2, off_t limit) argument
/freebsd-current/tools/tools/netrate/juggle/
H A Djuggle.c75 * Number of message cycles -- into fd1, out of fd2, into fd2, and out of
233 juggle(int fd1, int fd2, int pipeline) argument
249 if (message_recv(fd2) < 0)
250 err(-1, "message_recv fd2");
252 if (message_send(fd2) < 0)
253 err(-1, "message_send fd2");
286 int fd2, i, j; local
288 fd2 = *(int *)arg;
303 if (message_recv(fd2) <
315 thread_juggle(int fd1, int fd2, int pipeline) argument
374 process_juggle(int fd1, int fd2, int pipeline) argument
483 int fd1, fd2, i, j, p; local
[all...]
/freebsd-current/contrib/netbsd-tests/lib/libc/sys/
H A Dt_dup.c60 int fd, fd1, fd2; local
72 fd2 = open("/etc/passwd", O_RDONLY);
75 ATF_REQUIRE(fd2 >= 0);
80 fd = dup2(fd1, fd2);
82 fd = dup3(fd1, fd2, O_CLOEXEC);
100 (void)close(fd2);
114 int fd, fd1, fd2; local
117 fd2 = open("/etc/passwd", O_RDONLY);
120 ATF_REQUIRE(fd2 >= 0);
122 fd = dup2(fd1, fd2);
[all...]
/freebsd-current/tests/sys/kern/
H A Dkern_descrip_test.c57 int fd1, fd2; local
61 fd2 = 27;
62 ATF_REQUIRE(dup2(fd1, fd2) != -1);
64 ATF_REQUIRE(fstat(fd2, &sb2) != -1);
76 int fd1, fd2, ret; local
79 fd2 = INT_MAX;
80 ret = dup2(fd1, fd2);
/freebsd-current/tests/sys/fs/fusefs/
H A Dcopy_file_range.cc163 int fd1, fd2; local
185 fd2 = open(FULLPATH2, O_WRONLY);
186 ASSERT_EQ(-1, copy_file_range(fd1, &start1, fd2, &start2, len, 0));
210 int fd1, fd2; local
240 fd2 = open(FULLPATH2, O_RDWR);
244 ASSERT_EQ(m_maxbcachebuf, pread(fd2, buf, m_maxbcachebuf, start2))
249 ASSERT_EQ(len, copy_file_range(fd1, &start1, fd2, &start2, len, 0));
257 ASSERT_EQ(m_maxbcachebuf, pread(fd2, buf, m_maxbcachebuf, start2))
265 leak(fd2);
287 int fd1, fd2; local
411 int fd1, fd2; local
458 int fd1, fd2; local
502 int fd1, fd2; local
593 int fd1, fd2; local
704 int fd1, fd2; local
756 int fd1, fd2; local
[all...]

Completed in 273 milliseconds

1234