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

Function test_inet_send

test/send-zerocopy.c:508–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506}
507
508static int test_inet_send(struct io_uring *ring)
509{
510 struct send_conf conf;
511 struct sockaddr_storage addr;
512 int sock_client = -1, sock_server = -1;
513 int ret, j, i;
514 int buf_index;
515
516 for (j = 0; j < 32; j++) {
517 bool ipv6 = j & 1;
518 bool client_connect = j & 2;
519 bool msg_zc_set = j & 4;
520 bool tcp = j & 8;
521 bool swap_sockets = j & 16;
522
523 if (tcp && !client_connect)
524 continue;
525 if (swap_sockets && !tcp)
526 continue;
527#ifndef SO_ZEROCOPY
528 if (msg_zc_set)
529 continue;
530#endif
531 ret = create_socketpair_ip(&addr, &sock_client, &sock_server, ipv6,
532 client_connect, msg_zc_set, tcp);
533 if (ret) {
534 fprintf(stderr, "sock prep failed %d\n", ret);
535 return 1;
536 }
537 if (swap_sockets) {
538 int tmp_sock = sock_client;
539
540 sock_client = sock_server;
541 sock_server = tmp_sock;
542 }
543
544 for (i = 0; i < 1024; i++) {
545 bool regbuf;
546
547 conf.use_sendmsg = i & 1;
548 conf.poll_first = i & 2;
549 conf.fixed_buf = i & 4;
550 conf.addr = (i & 8) ? &addr : NULL;
551 conf.cork = i & 16;
552 conf.mix_register = i & 32;
553 conf.force_async = i & 64;
554 conf.zc = i & 128;
555 conf.iovec = i & 256;
556 conf.long_iovec = i & 512;
557 conf.tcp = tcp;
558 regbuf = conf.mix_register || conf.fixed_buf;
559
560 if (!tcp && conf.long_iovec)
561 continue;
562 if (conf.use_sendmsg && regbuf && !has_regvec)
563 continue;
564 if (conf.iovec && (!conf.use_sendmsg || conf.cork))
565 continue;

Callers 1

mainFunction · 0.85

Calls 2

create_socketpair_ipFunction · 0.85
do_test_inet_sendFunction · 0.85

Tested by

no test coverage detected