MCPcopy Create free account
hub / github.com/axboe/liburing / test_sendzc

Function test_sendzc

test/vec-regbuf.c:221–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221static int test_sendzc(struct buf_desc *bd, struct iovec *vecs, int nr_vec, int fd_wr)
222{
223 unsigned buf_idx = bd->buf_idx;
224 struct io_uring *ring = &bd->ring;
225 struct io_uring_sqe *sqe;
226 struct io_uring_cqe *cqe;
227 int ret, cqe_ret, more;
228 struct msghdr msghdr;
229
230 memset(&msghdr, 0, sizeof(msghdr));
231 msghdr.msg_iov = vecs;
232 msghdr.msg_iovlen = nr_vec;
233
234 sqe = io_uring_get_sqe(ring);
235 if (bd->fixed)
236 io_uring_prep_sendmsg_zc_fixed(sqe, fd_wr, &msghdr, 0, buf_idx);
237 else
238 io_uring_prep_sendmsg_zc(sqe, fd_wr, &msghdr, 0);
239
240 ret = io_uring_submit(ring);
241 if (ret != 1) {
242 fprintf(stderr, "submit failed %i\n", ret);
243 exit(1);
244 }
245 ret = io_uring_wait_cqe(ring, &cqe);
246 if (ret) {
247 fprintf(stderr, "wait_cqe=%d\n", ret);
248 exit(1);
249 }
250
251 cqe_ret = cqe->res;
252 more = cqe->flags & IORING_CQE_F_MORE;
253 io_uring_cqe_seen(ring, cqe);
254
255 if (more) {
256 ret = io_uring_wait_cqe(ring, &cqe);
257 if (ret) {
258 fprintf(stderr, "wait_cqe=%d\n", ret);
259 exit(1);
260 }
261 io_uring_cqe_seen(ring, cqe);
262 }
263 return cqe_ret;
264}
265
266static int test_vec(struct buf_desc *bd, struct iovec *vecs, int nr_vec,
267 bool expect_fail, int *cqe_ret)

Callers 1

test_vecFunction · 0.85

Calls 3

io_uring_submitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected