diff options
author | Vladimir Azarov <avm@intermediate-node.net> | 2024-10-01 15:47:05 +0200 |
---|---|---|
committer | Vladimir Azarov <avm@intermediate-node.net> | 2024-10-01 15:47:05 +0200 |
commit | 4abab5ad6c8465a7528ccdd5f49367da05f78bbd (patch) | |
tree | ebf009bf1376a5a223a915bc27cbbd791a1316bc /src/stat/futimesat.c |
Initial version
Diffstat (limited to 'src/stat/futimesat.c')
-rw-r--r-- | src/stat/futimesat.c | 22 |
1 files changed, 22 insertions, 0 deletions
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 <sys/time.h> +#include <sys/stat.h> +#include <errno.h> +#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); |