commit 3138010ed9c5db7114dc528e3b4c74ff5c33d975
parent 8e30311e2d96b10a0d1218ccf08169dc8e9f1068
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 23 May 2021 12:25:46 -0400
linux::io_uring: add link_timeout
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/linux/io_uring/sqe.ha b/linux/io_uring/sqe.ha
@@ -256,6 +256,21 @@ export fn timeout_update(
sqe.addr2 = ts;
};
+// Prepares a timeout operation for an [[sqe]] which is linked to the previous
+// SQE, effectively setting an upper limit on how long that SQE can take to
+// complete. "ts" should be a timespec describing the desired timeout. The
+// caller must call [[setuser]] to provide a user data field in order to use
+// [[timeout_remove]] to cancel this timeout later.
+export fn link_timeout(
+ sqe: *sqe,
+ ts: *rt::timespec,
+ to_flags: timeout_flags,
+ flags: flags...
+) void = {
+ preprw(sqe, op::LINK_TIMEOUT, 0, ts, 1, 0, flags...);
+ sqe.timeout_flags = to_flags;
+};
+
// Prepares a socket accept operation for an [[sqe]]. Equivalent to accept4(2).
export fn accept(
sqe: *sqe,