summaryrefslogtreecommitdiff
path: root/lib/libc/aio/aio_fsync.c
blob: 00d56b4241eca797b5405c2dc4e0903322b54529 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}