From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/stat/futimesat.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/stat/futimesat.c (limited to 'src/stat/futimesat.c') diff --git a/src/stat/futimesat.c b/src/stat/futimesat.c new file mode 100644 index 0000000..4bdb1c2 --- /dev/null +++ b/src/stat/futimesat.c @@ -0,0 +1,22 @@ +#define _GNU_SOURCE +#include +#include +#include +#include "syscall.h" + +int __futimesat(int dirfd, const char *pathname, const struct timeval times[2]) +{ + struct timespec ts[2]; + if (times) { + int i; + for (i=0; i<2; i++) { + if (times[i].tv_usec >= 1000000ULL) + return __syscall_ret(-EINVAL); + ts[i].tv_sec = times[i].tv_sec; + ts[i].tv_nsec = times[i].tv_usec * 1000; + } + } + return utimensat(dirfd, pathname, times ? ts : 0, 0); +} + +weak_alias(__futimesat, futimesat); -- cgit v1.2.3