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

Function __prep_server

test/zcrx.c:433–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433static int __prep_server(struct t_executor *ctx, unsigned config_flags)
434{
435 struct io_uring_zcrx_ifq_reg *zcrx_reg = &ctx->reg.zcrx;
436 char *rqp;
437 int ret;
438
439 ret = t_create_ring(128, &ctx->ring, RING_FLAGS);
440 if (ret != T_SETUP_OK) {
441 fprintf(stderr, "ring create failed: %d\n", ret);
442 return -1;
443 }
444
445 default_reg(&ctx->reg, config_flags);
446 rqp = (char *)(uintptr_t)ctx->reg.rq_region.user_addr;
447 memset(rqp, 0, get_rq_size(0));
448
449 ret = io_uring_register_ifq(&ctx->ring, zcrx_reg);
450 if (ret) {
451 fprintf(stderr, "Can't register zcrx %i\n", ret);
452 return ret;
453 }
454
455 ctx->rq.khead = (unsigned int *)((char *)rqp + zcrx_reg->offsets.head);
456 ctx->rq.ktail = (unsigned int *)((char *)rqp + zcrx_reg->offsets.tail);
457 ctx->rq.rqes = (struct io_uring_zcrx_rqe *)((char *)rqp + zcrx_reg->offsets.rqes);
458 ctx->rq.rq_tail = 0;
459 ctx->rq.ring_entries = zcrx_reg->rq_entries;
460
461 ret = t_create_socket_pair(ctx->fds, true);
462 if (ret) {
463 fprintf(stderr, "t_create_socket_pair failed: %d\n", ret);
464 return ret;
465 }
466
467 return 0;
468}
469
470static int prep_server(struct t_executor *ctx)
471{

Callers 2

prep_serverFunction · 0.85
test_recvFunction · 0.85

Calls 5

t_create_ringFunction · 0.85
default_regFunction · 0.85
get_rq_sizeFunction · 0.85
io_uring_register_ifqFunction · 0.85
t_create_socket_pairFunction · 0.85

Tested by 1

test_recvFunction · 0.68