Skip to content

Commit d27f14c

Browse files
committed
Add io_uring_register_sync_msg() helper
This helpers helps issue a sync MSG_RING request, as done via IORING_REGISTER_SEND_MSG_RING. It requires the SQE to be cleared and initialized with io_uring_prep_msg_ring(), just like a normal async MSG_RING request would be. It does not require a source ring, as no source ring is used - the result of the operation (what would've been cqe->res if the async approach would've been used) is returned directly from io_uring_register_sync_msg(). Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3ca5acc commit d27f14c

4 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/include/liburing.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ int io_uring_unregister_buf_ring(struct io_uring *ring, int bgid);
286286
int io_uring_buf_ring_head(struct io_uring *ring, int buf_group, uint16_t *head);
287287
int io_uring_register_sync_cancel(struct io_uring *ring,
288288
struct io_uring_sync_cancel_reg *reg);
289+
int io_uring_register_sync_msg(struct io_uring_sqe *sqe);
289290

290291
int io_uring_register_file_alloc_range(struct io_uring *ring,
291292
unsigned off, unsigned len);

src/liburing-ffi.map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,5 @@ LIBURING_2.11 {
242242
global:
243243
io_uring_memory_size;
244244
io_uring_memory_size_params;
245+
io_uring_register_sync_msg;
245246
} LIBURING_2.10;

src/liburing.map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,5 @@ LIBURING_2.11 {
124124
global:
125125
io_uring_memory_size;
126126
io_uring_memory_size_params;
127+
io_uring_register_sync_msg;
127128
} LIBURING_2.10;

src/register.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@ int io_uring_register_sync_cancel(struct io_uring *ring,
368368
return do_register(ring, IORING_REGISTER_SYNC_CANCEL, reg, 1);
369369
}
370370

371+
int io_uring_register_sync_msg(struct io_uring_sqe *sqe)
372+
{
373+
return __sys_io_uring_register(-1, IORING_REGISTER_SEND_MSG_RING, sqe, 1);
374+
}
375+
371376
int io_uring_register_file_alloc_range(struct io_uring *ring,
372377
unsigned off, unsigned len)
373378
{

0 commit comments

Comments
 (0)