summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/liburing.h2
-rw-r--r--src/liburing.map2
-rw-r--r--src/register.c24
3 files changed, 28 insertions, 0 deletions
diff --git a/src/liburing.h b/src/liburing.h
index ca854b6..d3fcd15 100644
--- a/src/liburing.h
+++ b/src/liburing.h
@@ -84,6 +84,8 @@ extern int io_uring_unregister_buffers(struct io_uring *ring);
extern int io_uring_register_files(struct io_uring *ring, const int *files,
unsigned nr_files);
extern int io_uring_unregister_files(struct io_uring *ring);
+extern int io_uring_register_eventfd(struct io_uring *ring, int fd);
+extern int io_uring_unregister_eventfd(struct io_uring *ring);
#define io_uring_for_each_cqe(ring, head, cqe) \
for (head = *(ring)->cq.khead; \
diff --git a/src/liburing.map b/src/liburing.map
index 302443c..b37a146 100644
--- a/src/liburing.map
+++ b/src/liburing.map
@@ -16,6 +16,8 @@ LIBURING_0.1 {
io_uring_unregister_buffers;
io_uring_register_files;
io_uring_unregister_files;
+ io_uring_register_eventfd;
+ io_uring_unregister_eventfd;
local:
*;
diff --git a/src/register.c b/src/register.c
index b993fa9..7561575 100644
--- a/src/register.c
+++ b/src/register.c
@@ -58,3 +58,27 @@ int io_uring_unregister_files(struct io_uring *ring)
return 0;
}
+
+int io_uring_register_eventfd(struct io_uring *ring, int event_fd)
+{
+ int ret;
+
+ ret = io_uring_register(ring->ring_fd, IORING_REGISTER_EVENTFD,
+ &event_fd, 1);
+ if (ret < 0)
+ return -errno;
+
+ return 0;
+}
+
+int io_uring_unregister_eventfd(struct io_uring *ring)
+{
+ int ret;
+
+ ret = io_uring_register(ring->ring_fd, IORING_UNREGISTER_EVENTFD, NULL,
+ 0);
+ if (ret < 0)
+ return -errno;
+
+ return 0;
+}