62 lines · plain
1// SPDX-License-Identifier: GPL-2.02// epoll zerocopy test:3//4// EPOLLERR is known to be not edge-triggered unlike EPOLLIN and EPOLLOUT but5// it is not level-triggered either.6//7// fire two sends with MSG_ZEROCOPY and receive the acks. confirm that EPOLLERR8// is correctly fired only once, when EPOLLET is set. send another packet with9// MSG_ZEROCOPY. confirm that EPOLLERR is correctly fired again only once.10`./defaults.sh`11 12 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 313 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 014 +0 setsockopt(3, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 015 +0 bind(3, ..., ...) = 016 +0 listen(3, 1) = 017 18 +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>19 +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>20 +0 < . 1:1(0) ack 1 win 25721 22 +0 accept(3, ..., ...) = 423 24 +0 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 025 +0 epoll_create(1) = 526 +0 epoll_ctl(5, EPOLL_CTL_ADD, 4, {events=EPOLLOUT|EPOLLET, fd=4}) = 027 +0 epoll_wait(5, {events=EPOLLOUT, fd=4}, 1, 0) = 128 29 +0 send(4, ..., 4000, MSG_ZEROCOPY) = 400030 +0 > P. 1:4001(4000) ack 131 +0 < . 1:1(0) ack 4001 win 25732 33 +0 send(4, ..., 4000, MSG_ZEROCOPY) = 400034 +0 > P. 4001:8001(4000) ack 135 +0 < . 1:1(0) ack 8001 win 25736 37// receive only one EPOLLERR for the two sends above.38 +0 epoll_wait(5, {events=EPOLLERR|EPOLLOUT, fd=4}, 1, 0) = 139 +0 epoll_wait(5, {events=0, ptr=0}, 1, 0) = 040 41 +0 send(4, ..., 4000, MSG_ZEROCOPY) = 400042 +0 > P. 8001:12001(4000) ack 143 +0 < . 1:1(0) ack 12001 win 25744 45// receive only one EPOLLERR for the third send above.46 +0 epoll_wait(5, {events=EPOLLERR|EPOLLOUT, fd=4}, 1, 0) = 147 +0 epoll_wait(5, {events=0, ptr=0}, 1, 0) = 048 49 +0 recvmsg(4, {msg_name(...)=...,50 msg_iov(1)=[{...,0}],51 msg_flags=MSG_ERRQUEUE,52 msg_control=[53 {cmsg_level=CMSG_LEVEL_IP,54 cmsg_type=CMSG_TYPE_RECVERR,55 cmsg_data={ee_errno=0,56 ee_origin=SO_EE_ORIGIN_ZEROCOPY,57 ee_type=0,58 ee_code=SO_EE_CODE_ZEROCOPY_COPIED,59 ee_info=0,60 ee_data=2}}61 ]}, MSG_ERRQUEUE) = 062