diff options
Diffstat (limited to 'libc-bottom-half/cloudlibc/src/libc/unistd/fsync.c')
-rw-r--r-- | libc-bottom-half/cloudlibc/src/libc/unistd/fsync.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libc-bottom-half/cloudlibc/src/libc/unistd/fsync.c b/libc-bottom-half/cloudlibc/src/libc/unistd/fsync.c new file mode 100644 index 0000000..733e294 --- /dev/null +++ b/libc-bottom-half/cloudlibc/src/libc/unistd/fsync.c @@ -0,0 +1,16 @@ +// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/ +// +// SPDX-License-Identifier: BSD-2-Clause + +#include <wasi/api.h> +#include <errno.h> +#include <unistd.h> + +int fsync(int fildes) { + __wasi_errno_t error = __wasi_fd_sync(fildes); + if (error != 0) { + errno = error == ENOTCAPABLE ? EINVAL : error; + return -1; + } + return 0; +} |