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_utimensat(int fd
, const char *path
, const struct timespec times
[2],
18 // Convert timestamps and extract NOW/OMIT flags.
19 __wasi_timestamp_t st_atim
;
20 __wasi_timestamp_t st_mtim
;
21 __wasi_fstflags_t flags
;
22 if (!utimens_get_timestamps(times
, &st_atim
, &st_mtim
, &flags
)) {
27 // Create lookup properties.
28 __wasi_lookupflags_t lookup_flags
= 0;
29 if ((flag
& AT_SYMLINK_NOFOLLOW
) == 0)
30 lookup_flags
|= __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW
;
32 // Perform system call.
33 __wasi_errno_t error
=
34 __wasi_path_filestat_set_times(fd
, lookup_flags
, path
, strlen(path
), st_atim
, st_mtim
, flags
);
36 errno
= errno_fixup_directory(fd
, error
);