commit 64562a0e9334bd29dee3f10d351cdd24c0e14d29
parent 34cdb4d7e0f6785d9925fa3efb4d6441a53196ac
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 19 May 2021 16:48:07 -0400
linux::io_uring: add accept
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/linux/io_uring/sqe.ha b/linux/io_uring/sqe.ha
@@ -253,3 +253,17 @@ export fn timeout_update(
sqe.timeout_flags = to_flags | timeout_flags::UPDATE;
sqe.addr2 = ts;
};
+
+// Prepares a socket accept operation for an [[sqe]]. Equivalent to accept4(2).
+export fn accept(
+ sqe: *sqe,
+ fd: int,
+ addr: nullable *rt::sockaddr,
+ addrlen: nullable *uint,
+ aflags: uint,
+ flags: sqe_flags...
+) void = {
+ preprw(sqe, op::ACCEPT, fd, addr, 0, 0, flags...);
+ sqe.accept_flags = aflags;
+ sqe.addr2 = addrlen;
+};