diff options
author | Mark Papadakis <mpapadakis@phaistosnetworks.gr> | 2020-04-12 18:49:51 +0300 |
---|---|---|
committer | Mark Papadakis <mpapadakis@phaistosnetworks.gr> | 2020-04-12 18:49:51 +0300 |
commit | 388ccdfc1b03f7f319f04867b6636df0985a7eb6 (patch) | |
tree | 1bc564afae0bfd18117f7151b05fa26a188776ba | |
parent | 71d4e9ef41c093757a5148612150d96824996d86 (diff) | |
download | liburing-388ccdfc1b03f7f319f04867b6636df0985a7eb6.tar.gz liburing-388ccdfc1b03f7f319f04867b6636df0985a7eb6.tar.bz2 |
Utility function io_uring_register_eventfd_async
A new handy utility function for IORING_REGISTER_EVENTFD_ASYNC OP
Signed-off-by: Mark Papadakis <markpapadakis@gmail.com>
-rw-r--r-- | src/include/liburing.h | 1 | ||||
-rw-r--r-- | src/liburing.map | 2 | ||||
-rw-r--r-- | src/register.c | 12 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/include/liburing.h b/src/include/liburing.h index eaeda86..d2a16f6 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -102,6 +102,7 @@ extern int io_uring_unregister_files(struct io_uring *ring); extern int io_uring_register_files_update(struct io_uring *ring, unsigned off, int *files, unsigned nr_files); extern int io_uring_register_eventfd(struct io_uring *ring, int fd); +extern int io_uring_register_eventfd_async(struct io_uring *ring, int fd); extern int io_uring_unregister_eventfd(struct io_uring *ring); extern int io_uring_register_probe(struct io_uring *ring, struct io_uring_probe *p, unsigned nr); diff --git a/src/liburing.map b/src/liburing.map index 055058f..8281f3d 100644 --- a/src/liburing.map +++ b/src/liburing.map @@ -51,4 +51,6 @@ LIBURING_0.5 { } LIBURING_0.4; LIBURING_0.6 { + global: + io_uring_register_eventfd_async; } LIBURING_0.5; diff --git a/src/register.c b/src/register.c index f50473b..327a8ce 100644 --- a/src/register.c +++ b/src/register.c @@ -111,6 +111,18 @@ int io_uring_unregister_eventfd(struct io_uring *ring) return 0; } +int io_uring_register_eventfd_async(struct io_uring *ring, int event_fd) +{ + int ret; + + ret = __sys_io_uring_register(ring->ring_fd, IORING_REGISTER_EVENTFD_ASYNC, + &event_fd, 1); + if (ret < 0) + return -errno; + + return 0; +} + int io_uring_register_probe(struct io_uring *ring, struct io_uring_probe *p, unsigned int nr_ops) { |