summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/io_uring_enter.245
-rw-r--r--src/liburing.h3
-rw-r--r--src/queue.c4
-rw-r--r--src/syscall.c4
4 files changed, 50 insertions, 6 deletions
diff --git a/man/io_uring_enter.2 b/man/io_uring_enter.2
index eeabced..d0d12ad 100644
--- a/man/io_uring_enter.2
+++ b/man/io_uring_enter.2
@@ -13,7 +13,8 @@ io_uring_enter \- initiate and/or complete asynchronous I/O
.BR "#include <linux/io_uring.h>"
.PP
.BI "int io_uring_enter(unsigned int " fd ", unsigned int " to_submit ,
-.BI " unsigned int " min_complete ", unsigned int " flags)
+.BI " unsigned int " min_complete ", unsigned int " flags ,
+.BI " sigset_t *" sig ", size_t " sigsz)
.fi
.PP
.SH DESCRIPTION
@@ -52,6 +53,48 @@ flag in
as for IRQ driven I/O, the application can just check the completion
queue without entering the kernel.
+.I sig
+is a pointer to a signal mask (see
+.BR sigprocmask (2));
+.I sigsz
+is the size of the
+.I sig
+argument. If
+.I sig
+is not NULL,
+.BR io_uring_enter ()
+first replaces the current signal mask by the one pointed to by
+.I sig,
+then waits for events to become available in the completion queue, and
+then restores the original signal mask. The following
+.BI io_uring_enter ()
+call:
+.PP
+.in +4n
+.EX
+ret = io_uring_enter(fd, 0, 1,
+ IORING_ENTER_GETEVENTS, &sig, sigsz);
+.EE
+.in
+.PP
+is equivalent to
+.I atomically
+executing the following calls:
+.PP
+.in +4n
+.EX
+pthread_sigmask(SIG_SETMASK, &sig, &orig);
+ret = io_uring_enter(fd, 0, 1, IORING_ENTER_GETEVENTS, NULL, 0);
+pthread_sigmask(SIG_SETMASK, &orig, NULL);
+.EE
+.in
+.PP
+See the description of
+.BR pselect (2)
+for an explanation of why the
+.I sig
+parameter is necessary.
+
Submission queue entries are represented using the following data
structure:
.PP
diff --git a/src/liburing.h b/src/liburing.h
index 9917b5b..9c8c13e 100644
--- a/src/liburing.h
+++ b/src/liburing.h
@@ -2,6 +2,7 @@
#define LIB_URING_H
#include <sys/uio.h>
+#include <signal.h>
#include "compat.h"
#include "io_uring.h"
@@ -46,7 +47,7 @@ struct io_uring {
*/
extern int io_uring_setup(unsigned entries, struct io_uring_params *p);
extern int io_uring_enter(unsigned fd, unsigned to_submit,
- unsigned min_complete, unsigned flags);
+ unsigned min_complete, unsigned flags, sigset_t *sig, size_t sigsz);
extern int io_uring_register(int fd, unsigned int opcode, void *arg,
unsigned int nr_args);
diff --git a/src/queue.c b/src/queue.c
index b8788b3..f2b73a4 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -29,7 +29,7 @@ static int __io_uring_get_completion(struct io_uring *ring,
if (!wait)
break;
ret = io_uring_enter(ring->ring_fd, 0, 1,
- IORING_ENTER_GETEVENTS);
+ IORING_ENTER_GETEVENTS, NULL, _NSIG / 8);
if (ret < 0)
return -errno;
} while (1);
@@ -112,7 +112,7 @@ int io_uring_submit(struct io_uring *ring)
submit:
return io_uring_enter(ring->ring_fd, submitted, 0,
- IORING_ENTER_GETEVENTS);
+ IORING_ENTER_GETEVENTS, NULL, _NSIG / 8);
}
/*
diff --git a/src/syscall.c b/src/syscall.c
index a9e648e..aa82c3b 100644
--- a/src/syscall.c
+++ b/src/syscall.c
@@ -33,8 +33,8 @@ int io_uring_setup(unsigned int entries, struct io_uring_params *p)
}
int io_uring_enter(int fd, unsigned int to_submit, unsigned int min_complete,
- unsigned int flags)
+ unsigned int flags, sigset_t *sig, size_t sigsz)
{
return syscall(__NR_sys_io_uring_enter, fd, to_submit, min_complete,
- flags, NULL, 0);
+ flags, sig, sigsz);
}