]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/sys/stat/fstat.c
Remove __wasilibc_unmodified_upstream markers from libc-bottom-half.
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / sys / stat / fstat.c
1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #include <sys/stat.h>
6
7 #include <wasi/api.h>
8 #include <errno.h>
9
10 #include "stat_impl.h"
11
12 int fstat(int fildes, struct stat *buf) {
13 __wasi_filestat_t internal_stat;
14 __wasi_errno_t error = __wasi_fd_filestat_get(fildes, &internal_stat);
15 if (error != 0) {
16 errno = error;
17 return -1;
18 }
19 to_public_stat(&internal_stat, buf);
20 return 0;
21 }