commit 99260d6a4bd5dc01e4aeb0852cacda38747484f5
parent 3138010ed9c5db7114dc528e3b4c74ff5c33d975
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 23 May 2021 12:25:54 -0400
linux::io_uring: add openat
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
@@ -285,6 +285,20 @@ export fn accept(
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...);