summaryrefslogtreecommitdiff
path: root/lib/libc/aio/aio_fsync.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/aio/aio_fsync.c')
-rw-r--r--lib/libc/aio/aio_fsync.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/libc/aio/aio_fsync.c b/lib/libc/aio/aio_fsync.c
new file mode 100644
index 00000000..00d56b42
--- /dev/null
+++ b/lib/libc/aio/aio_fsync.c
@@ -0,0 +1,26 @@
+#include <__aio.h>
+#include <aio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <io_uring.h>
+
+int aio_fsync(int op, struct aiocb *aiocbp)
+{
+ int opcode;
+ struct aio_request *req;
+
+ req = __aio_lookup(aiocbp);
+
+ if (req == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (op == O_DSYNC) {
+ opcode = IORING_OP_FSYNC | IORING_FSYNC_DATASYNC;
+ } else {
+ opcode = IORING_OP_FSYNC;
+ }
+
+ return __aio_request(req, opcode);
+}