Add io_uring_{register,unregister}_personality() helpers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/src/include/liburing.h b/src/include/liburing.h
index b0909b2..83d11dd 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -104,6 +104,8 @@
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);
+extern int io_uring_register_personality(struct io_uring *ring);
+extern int io_uring_unregister_personality(struct io_uring *ring, int id);
/*
* Helper for the peek/wait single cqe functions. Exported because of that,
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index bca5568..79c75a4 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -210,6 +210,8 @@
#define IORING_REGISTER_FILES_UPDATE 6
#define IORING_REGISTER_EVENTFD_ASYNC 7
#define IORING_REGISTER_PROBE 8
+#define IORING_REGISTER_PERSONALITY 9
+#define IORING_UNREGISTER_PERSONALITY 10
struct io_uring_files_update {
__u32 offset;
diff --git a/src/liburing.map b/src/liburing.map
index 0c17c1f..b45f373 100644
--- a/src/liburing.map
+++ b/src/liburing.map
@@ -70,4 +70,6 @@
global:
io_uring_ring_dontfork;
io_uring_register_probe;
+ io_uring_register_personality;
+ io_uring_unregister_personality;
} LIBURING_0.3;
diff --git a/src/register.c b/src/register.c
index 73daaf8..c179b8a 100644
--- a/src/register.c
+++ b/src/register.c
@@ -110,3 +110,27 @@
return 0;
}
+
+int io_uring_register_personality(struct io_uring *ring)
+{
+ int ret;
+
+ ret = __sys_io_uring_register(ring->ring_fd, IORING_REGISTER_PERSONALITY,
+ NULL, 0);
+ if (ret < 0)
+ return -errno;
+
+ return ret;
+}
+
+int io_uring_unregister_personality(struct io_uring *ring, int id)
+{
+ int ret;
+
+ ret = __sys_io_uring_register(ring->ring_fd, IORING_UNREGISTER_PERSONALITY,
+ NULL, id);
+ if (ret < 0)
+ return -errno;
+
+ return ret;
+}