Lines Matching refs:fd
40 int fd; in test_stream_connection_reset() local
42 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_connection_reset()
46 ret = connect(fd, &addr.sa, sizeof(addr.svm)); in test_stream_connection_reset()
60 close(fd); in test_stream_connection_reset()
76 int fd; in test_stream_bind_only_client() local
81 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_bind_only_client()
85 ret = connect(fd, &addr.sa, sizeof(addr.svm)); in test_stream_bind_only_client()
102 close(fd); in test_stream_bind_only_client()
117 int fd; in test_stream_bind_only_server() local
119 fd = socket(AF_VSOCK, SOCK_STREAM, 0); in test_stream_bind_only_server()
121 if (bind(fd, &addr.sa, sizeof(addr.svm)) < 0) { in test_stream_bind_only_server()
132 close(fd); in test_stream_bind_only_server()
137 int fd; in test_stream_client_close_client() local
139 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_client_close_client()
140 if (fd < 0) { in test_stream_client_close_client()
145 send_byte(fd, 1, 0); in test_stream_client_close_client()
146 close(fd); in test_stream_client_close_client()
151 int fd; in test_stream_client_close_server() local
153 fd = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_stream_client_close_server()
154 if (fd < 0) { in test_stream_client_close_server()
162 vsock_wait_remote_close(fd); in test_stream_client_close_server()
164 send_byte(fd, -EPIPE, 0); in test_stream_client_close_server()
165 recv_byte(fd, 1, 0); in test_stream_client_close_server()
166 recv_byte(fd, 0, 0); in test_stream_client_close_server()
167 close(fd); in test_stream_client_close_server()
172 int fd; in test_stream_server_close_client() local
174 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_server_close_client()
175 if (fd < 0) { in test_stream_server_close_client()
183 vsock_wait_remote_close(fd); in test_stream_server_close_client()
185 send_byte(fd, -EPIPE, 0); in test_stream_server_close_client()
186 recv_byte(fd, 1, 0); in test_stream_server_close_client()
187 recv_byte(fd, 0, 0); in test_stream_server_close_client()
188 close(fd); in test_stream_server_close_client()
193 int fd; in test_stream_server_close_server() local
195 fd = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_stream_server_close_server()
196 if (fd < 0) { in test_stream_server_close_server()
201 send_byte(fd, 1, 0); in test_stream_server_close_server()
202 close(fd); in test_stream_server_close_server()
265 int fd; in test_msg_peek_client() local
269 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_msg_peek_client()
271 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_msg_peek_client()
273 if (fd < 0) { in test_msg_peek_client()
283 send_size = send(fd, buf, sizeof(buf), 0); in test_msg_peek_client()
295 close(fd); in test_msg_peek_client()
305 int fd; in test_msg_peek_server() local
308 fd = vsock_seqpacket_accept(VMADDR_CID_ANY, 1234, NULL); in test_msg_peek_server()
310 fd = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_msg_peek_server()
312 if (fd < 0) { in test_msg_peek_server()
318 res = recv(fd, buf_peek, sizeof(buf_peek), MSG_PEEK | MSG_DONTWAIT); in test_msg_peek_server()
332 res = recv(fd, buf_half, sizeof(buf_half), MSG_PEEK); in test_msg_peek_server()
340 res = recv(fd, buf_peek, sizeof(buf_peek), MSG_PEEK); in test_msg_peek_server()
358 res = recv(fd, buf_half, sizeof(buf_half), MSG_PEEK | in test_msg_peek_server()
368 res = recv(fd, buf_normal, sizeof(buf_normal), 0); in test_msg_peek_server()
381 close(fd); in test_msg_peek_server()
403 int fd; in test_seqpacket_msg_bounds_client() local
405 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_msg_bounds_client()
406 if (fd < 0) { in test_seqpacket_msg_bounds_client()
448 send_size = send(fd, buf, buf_size, flags); in test_seqpacket_msg_bounds_client()
475 close(fd); in test_seqpacket_msg_bounds_client()
483 int fd; in test_seqpacket_msg_bounds_server() local
487 fd = vsock_seqpacket_accept(VMADDR_CID_ANY, 1234, NULL); in test_seqpacket_msg_bounds_server()
488 if (fd < 0) { in test_seqpacket_msg_bounds_server()
495 if (setsockopt(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_MAX_SIZE, in test_seqpacket_msg_bounds_server()
501 if (setsockopt(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_SIZE, in test_seqpacket_msg_bounds_server()
526 recv_size = recvmsg(fd, &msg, 0); in test_seqpacket_msg_bounds_server()
543 close(fd); in test_seqpacket_msg_bounds_server()
555 int fd; in test_seqpacket_msg_trunc_client() local
558 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_msg_trunc_client()
559 if (fd < 0) { in test_seqpacket_msg_trunc_client()
564 if (send(fd, buf, sizeof(buf), 0) != sizeof(buf)) { in test_seqpacket_msg_trunc_client()
570 close(fd); in test_seqpacket_msg_trunc_client()
575 int fd; in test_seqpacket_msg_trunc_server() local
580 fd = vsock_seqpacket_accept(VMADDR_CID_ANY, 1234, NULL); in test_seqpacket_msg_trunc_server()
581 if (fd < 0) { in test_seqpacket_msg_trunc_server()
592 ssize_t ret = recvmsg(fd, &msg, MSG_TRUNC); in test_seqpacket_msg_trunc_server()
605 close(fd); in test_seqpacket_msg_trunc_server()
625 int fd; in test_seqpacket_timeout_client() local
631 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_timeout_client()
632 if (fd < 0) { in test_seqpacket_timeout_client()
640 if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv)) == -1) { in test_seqpacket_timeout_client()
647 if (read(fd, &dummy, sizeof(dummy)) != -1) { in test_seqpacket_timeout_client()
669 close(fd); in test_seqpacket_timeout_client()
674 int fd; in test_seqpacket_timeout_server() local
676 fd = vsock_seqpacket_accept(VMADDR_CID_ANY, 1234, NULL); in test_seqpacket_timeout_server()
677 if (fd < 0) { in test_seqpacket_timeout_server()
683 close(fd); in test_seqpacket_timeout_server()
692 int fd; in test_seqpacket_bigmsg_client() local
696 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_bigmsg_client()
697 if (fd < 0) { in test_seqpacket_bigmsg_client()
702 if (getsockopt(fd, AF_VSOCK, SO_VM_SOCKETS_BUFFER_SIZE, in test_seqpacket_bigmsg_client()
716 send_size = send(fd, data, sock_buf_size, 0); in test_seqpacket_bigmsg_client()
732 close(fd); in test_seqpacket_bigmsg_client()
737 int fd; in test_seqpacket_bigmsg_server() local
739 fd = vsock_seqpacket_accept(VMADDR_CID_ANY, 1234, NULL); in test_seqpacket_bigmsg_server()
740 if (fd < 0) { in test_seqpacket_bigmsg_server()
747 close(fd); in test_seqpacket_bigmsg_server()
755 int fd; in test_seqpacket_invalid_rec_buffer_client() local
760 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_invalid_rec_buffer_client()
761 if (fd < 0) { in test_seqpacket_invalid_rec_buffer_client()
781 if (send(fd, buf1, buf_size, 0) != buf_size) { in test_seqpacket_invalid_rec_buffer_client()
786 if (send(fd, buf2, buf_size, 0) != buf_size) { in test_seqpacket_invalid_rec_buffer_client()
791 close(fd); in test_seqpacket_invalid_rec_buffer_client()
796 int fd; in test_seqpacket_invalid_rec_buffer_server() local
806 fd = vsock_seqpacket_accept(VMADDR_CID_ANY, 1234, NULL); in test_seqpacket_invalid_rec_buffer_server()
807 if (fd < 0) { in test_seqpacket_invalid_rec_buffer_server()
832 res = read(fd, broken_buf, buf_size); in test_seqpacket_invalid_rec_buffer_server()
846 res = read(fd, valid_buf, buf_size); in test_seqpacket_invalid_rec_buffer_server()
872 close(fd); in test_seqpacket_invalid_rec_buffer_server()
879 int fd; in test_stream_poll_rcvlowat_server() local
882 fd = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_stream_poll_rcvlowat_server()
883 if (fd < 0) { in test_stream_poll_rcvlowat_server()
889 send_byte(fd, 1, 0); in test_stream_poll_rcvlowat_server()
897 send_byte(fd, 1, 0); in test_stream_poll_rcvlowat_server()
902 close(fd); in test_stream_poll_rcvlowat_server()
912 int fd; in test_stream_poll_rcvlowat_client() local
914 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_poll_rcvlowat_client()
915 if (fd < 0) { in test_stream_poll_rcvlowat_client()
920 if (setsockopt(fd, SOL_SOCKET, SO_RCVLOWAT, in test_stream_poll_rcvlowat_client()
929 fds.fd = fd; in test_stream_poll_rcvlowat_client()
965 read_res = recv(fd, buf, sizeof(buf), MSG_DONTWAIT); in test_stream_poll_rcvlowat_client()
974 close(fd); in test_stream_poll_rcvlowat_client()
983 int fd; in test_inv_buf_client() local
986 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_inv_buf_client()
988 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_inv_buf_client()
990 if (fd < 0) { in test_inv_buf_client()
998 ret = recv(fd, NULL, sizeof(data), 0); in test_inv_buf_client()
1009 ret = recv(fd, data, sizeof(data), MSG_DONTWAIT); in test_inv_buf_client()
1033 close(fd); in test_inv_buf_client()
1040 int fd; in test_inv_buf_server() local
1043 fd = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_inv_buf_server()
1045 fd = vsock_seqpacket_accept(VMADDR_CID_ANY, 1234, NULL); in test_inv_buf_server()
1047 if (fd < 0) { in test_inv_buf_server()
1052 res = send(fd, data, sizeof(data), 0); in test_inv_buf_server()
1062 close(fd); in test_inv_buf_server()
1091 int fd; in test_stream_virtio_skb_merge_client() local
1093 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_virtio_skb_merge_client()
1094 if (fd < 0) { in test_stream_virtio_skb_merge_client()
1100 res = send(fd, HELLO_STR, strlen(HELLO_STR), 0); in test_stream_virtio_skb_merge_client()
1111 res = send(fd, WORLD_STR, strlen(WORLD_STR), 0); in test_stream_virtio_skb_merge_client()
1121 close(fd); in test_stream_virtio_skb_merge_client()
1128 int fd; in test_stream_virtio_skb_merge_server() local
1130 fd = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_stream_virtio_skb_merge_server()
1131 if (fd < 0) { in test_stream_virtio_skb_merge_server()
1139 res = recv(fd, buf, 2, 0); in test_stream_virtio_skb_merge_server()
1148 res = recv(fd, buf + 2, sizeof(buf) - 2, 0); in test_stream_virtio_skb_merge_server()
1154 res = recv(fd, buf, sizeof(buf) - 8 - 2, MSG_DONTWAIT); in test_stream_virtio_skb_merge_server()
1167 close(fd); in test_stream_virtio_skb_merge_server()