]> git.proxmox.com Git - wasi-libc.git/blame - libc-bottom-half/cloudlibc/src/libc/unistd/fdatasync.c
Wasi snapshot preview1 (#140)
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / unistd / fdatasync.c
CommitLineData
320054e8
DG
1// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2//
3// SPDX-License-Identifier: BSD-2-Clause
4
446cb3f1 5#include <wasi/api.h>
320054e8
DG
6#include <errno.h>
7#include <unistd.h>
8
9int 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}