1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
3 // SPDX-License-Identifier: BSD-2-Clause
5 #include <common/errno.h>
14 #include "stat_impl.h"
16 int __wasilibc_nocwd_fstatat(int fd
, const char *restrict path
, struct stat
*restrict buf
,
18 // Create lookup properties.
19 __wasi_lookupflags_t lookup_flags
= 0;
20 if ((flag
& AT_SYMLINK_NOFOLLOW
) == 0)
21 lookup_flags
|= __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW
;
23 // Perform system call.
24 __wasi_filestat_t internal_stat
;
25 __wasi_errno_t error
=
26 __wasi_path_filestat_get(fd
, lookup_flags
, path
, &internal_stat
);
28 errno
= errno_fixup_directory(fd
, error
);
31 to_public_stat(&internal_stat
, buf
);