From 36e0f7b3947c6fda4bd29568e67e0e8d9e301a7f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 23 May 2021 12:25:54 -0400 Subject: [PATCH] linux::io_uring: add openat Signed-off-by: Drew DeVault --- io_uring/sqe.ha | 14 ++++++++++++++ diff --git a/io_uring/sqe.ha b/io_uring/sqe.ha index c2517d8cdc568b48134a011c0485231fa9e8aedb..eae9f0b0cf7ab4ffffc445bf21a0fa0ecbdbea87 100644 --- a/io_uring/sqe.ha +++ b/io_uring/sqe.ha @@ -285,6 +285,20 @@ sqe.accept_flags = aflags; sqe.addr2 = addrlen; }; +// Prepares an [[sqe]] operation which opens a file. The path must be a C +// string, i.e. NUL terminated; see [[strings::to_c]]. +export fn openat( + sqe: *sqe, + dirfd: int, + path: *const char, + oflags: int, + mode: uint, + flags: flags... +) void = { + preprw(sqe, op::OPENAT, dirfd, path, mode, 0, flags...); + sqe.open_flags = oflags: u32; +}; + // Prepares an [[sqe]] operation which closes a file descriptor. export fn close(sqe: *sqe, fd: int, flags: flags...) void = { preprw(sqe, op::CLOSE, fd, null, 0, 0, flags...); -- 2.48.1