]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/unistd/fdatasync.c
WASI libc prototype implementation.
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / unistd / fdatasync.c
1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #include <wasi/core.h>
6 #include <errno.h>
7 #include <unistd.h>
8
9 int fdatasync(int fildes) {
10 __wasi_errno_t error = __wasi_fd_datasync(fildes);
11 if (error != 0) {
12 errno = error == ENOTCAPABLE ? EBADF : error;
13 return -1;
14 }
15 return 0;
16 }