summaryrefslogtreecommitdiffstats
path: root/usr/klibc/futimesat.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/futimesat.c')
-rw-r--r--usr/klibc/futimesat.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr/klibc/futimesat.c b/usr/klibc/futimesat.c
new file mode 100644
index 0000000..f4da4ba
--- /dev/null
+++ b/usr/klibc/futimesat.c
@@ -0,0 +1,18 @@
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+
+int futimesat(int dirfd, const char *filename, const struct timeval tvp[2])
+{
+ struct timespec ts[2];
+
+ if (tvp) {
+ ts[0].tv_sec = tvp[0].tv_sec;
+ ts[0].tv_nsec = tvp[0].tv_usec * 1000;
+ ts[1].tv_sec = tvp[1].tv_sec;
+ ts[1].tv_nsec = tvp[1].tv_usec * 1000;
+ }
+
+ return utimensat(dirfd, filename, &ts[0], 0);
+}