diff mbox series

[liburing,v2,2/5] liburing: Add helper to prepare IORING_OP_LISTEN command

Message ID 20240723231733.31884-3-krisman@suse.de (mailing list archive)
State New
Headers show
Series IORING_OP_BIND/LISTEN support | expand

Commit Message

Gabriel Krisman Bertazi July 23, 2024, 11:17 p.m. UTC
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 src/include/liburing.h          | 6 ++++++
 src/include/liburing/io_uring.h | 1 +
 src/liburing-ffi.map            | 1 +
 3 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 04cb65c..c935efa 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -676,6 +676,12 @@  IOURINGINLINE void io_uring_prep_bind(struct io_uring_sqe *sqe, int fd,
 	io_uring_prep_rw(IORING_OP_BIND, sqe, fd, addr, 0, addrlen);
 }
 
+IOURINGINLINE void io_uring_prep_listen(struct io_uring_sqe *sqe, int fd,
+				      int backlog)
+{
+	io_uring_prep_rw(IORING_OP_LISTEN, sqe, fd, 0, backlog, 0);
+}
+
 IOURINGINLINE void io_uring_prep_files_update(struct io_uring_sqe *sqe,
 					      int *fds, unsigned nr_fds,
 					      int offset)
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index 177ace6..f99d41f 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -258,6 +258,7 @@  enum io_uring_op {
 	IORING_OP_FIXED_FD_INSTALL,
 	IORING_OP_FTRUNCATE,
 	IORING_OP_BIND,
+	IORING_OP_LISTEN,
 
 	/* this goes last, obviously */
 	IORING_OP_LAST,
diff --git a/src/liburing-ffi.map b/src/liburing-ffi.map
index de2cb09..0cbf14c 100644
--- a/src/liburing-ffi.map
+++ b/src/liburing-ffi.map
@@ -202,4 +202,5 @@  LIBURING_2.7 {
 		io_uring_prep_fadvise64;
 		io_uring_prep_madvise64;
 		io_uring_prep_bind;
+		io_uring_prep_listen;
 } LIBURING_2.6;