From 5b4213195eddb38e7bed024daf4c148943b852fb Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 19 May 2021 16:48:07 -0400 Subject: [PATCH] linux::io_uring: add accept Signed-off-by: Drew DeVault --- io_uring/sqe.ha | 14 ++++++++++++++ diff --git a/io_uring/sqe.ha b/io_uring/sqe.ha index 975f71e49db23dd77ae09f1e6cca46ae62207b2f..ef4a8fc7e994ce89550afaa00a4af79e84aa9f2e 100644 --- a/io_uring/sqe.ha +++ b/io_uring/sqe.ha @@ -253,3 +253,17 @@ preprw(sqe, op::TIMEOUT_REMOVE, 0, user_data, 0, events, flags...); 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; +}; -- 2.48.1