1 // SPDX-License-Identifier: GPL-2.0
2 // epoll zerocopy test:
4 // EPOLLERR is known to be not edge-triggered unlike EPOLLIN and EPOLLOUT but
5 // it is not level-triggered either.
7 // fire two sends with MSG_ZEROCOPY and receive the acks. confirm that EPOLLERR
8 // is correctly fired only once, when EPOLLET is set. send another packet with
9 // MSG_ZEROCOPY. confirm that EPOLLERR is correctly fired again only once.
12 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
13 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
14 +0 setsockopt(3, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 0
15 +0 bind(3, ..., ...) = 0
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 257
22 +0 accept(3, ..., ...) = 4
24 +0 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
25 +0 epoll_create(1) = 5
26 +0 epoll_ctl(5, EPOLL_CTL_ADD, 4, {events=EPOLLOUT|EPOLLET, fd=4}) = 0
27 +0 epoll_wait(5, {events=EPOLLOUT, fd=4}, 1, 0) = 1
29 +0 send(4, ..., 4000, MSG_ZEROCOPY) = 4000
30 +0 > P. 1:4001(4000) ack 1
31 +0 < . 1:1(0) ack 4001 win 257
33 +0 send(4, ..., 4000, MSG_ZEROCOPY) = 4000
34 +0 > P. 4001:8001(4000) ack 1
35 +0 < . 1:1(0) ack 8001 win 257
37 // receive only one EPOLLERR for the two sends above.
38 +0 epoll_wait(5, {events=EPOLLERR|EPOLLOUT, fd=4}, 1, 0) = 1
39 +0 epoll_wait(5, {events=0, ptr=0}, 1, 0) = 0
41 +0 send(4, ..., 4000, MSG_ZEROCOPY) = 4000
42 +0 > P. 8001:12001(4000) ack 1
43 +0 < . 1:1(0) ack 12001 win 257
45 // receive only one EPOLLERR for the third send above.
46 +0 epoll_wait(5, {events=EPOLLERR|EPOLLOUT, fd=4}, 1, 0) = 1
47 +0 epoll_wait(5, {events=0, ptr=0}, 1, 0) = 0
49 +0 recvmsg(4, {msg_name(...)=...,
51 msg_flags=MSG_ERRQUEUE,
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,
58 ee_code=SO_EE_CODE_ZEROCOPY_COPIED,