Add support for the utimensat(2) syscall to bionic.
The kernel has supported this syscall for quite some time now,
but bionic did not. Now that there is a need for it, let's
add it to bionic.
Change-Id: Ifcef3e46f1438d79435b600c4e6063857ab16903
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index 5b8e2b4..7b74a4b 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -162,6 +162,7 @@
#define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 260)
#define __NR_timer_delete (__NR_SYSCALL_BASE + 261)
#define __NR_utimes (__NR_SYSCALL_BASE + 269)
+#define __NR_utimensat (__NR_SYSCALL_BASE + 348)
#define __NR_socket (__NR_SYSCALL_BASE + 281)
#define __NR_socketpair (__NR_SYSCALL_BASE + 288)
#define __NR_bind (__NR_SYSCALL_BASE + 282)
@@ -221,6 +222,7 @@
#define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 262)
#define __NR_timer_delete (__NR_SYSCALL_BASE + 263)
#define __NR_utimes (__NR_SYSCALL_BASE + 271)
+#define __NR_utimensat (__NR_SYSCALL_BASE + 320)
#define __NR_socketcall (__NR_SYSCALL_BASE + 102)
#define __NR_getcpu (__NR_SYSCALL_BASE + 318)
#define __NR_ioprio_set (__NR_SYSCALL_BASE + 289)
@@ -265,6 +267,7 @@
#define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 262)
#define __NR_timer_delete (__NR_SYSCALL_BASE + 263)
#define __NR_utimes (__NR_SYSCALL_BASE + 271)
+#define __NR_utimensat (__NR_SYSCALL_BASE + 320)
#define __NR_socketcall (__NR_SYSCALL_BASE + 102)
#define __NR_socketcall (__NR_SYSCALL_BASE + 102)
#define __NR_socketcall (__NR_SYSCALL_BASE + 102)
diff --git a/libc/include/sys/linux-unistd.h b/libc/include/sys/linux-unistd.h
index f706d00..ae9077f 100644
--- a/libc/include/sys/linux-unistd.h
+++ b/libc/include/sys/linux-unistd.h
@@ -138,6 +138,7 @@
int __timer_getoverrun (timer_t);
int __timer_delete (timer_t);
int utimes (const char*, const struct timeval tvp[2]);
+int utimensat (int, const char *, const struct timespec times[2], int);
int sigaction (int, const struct sigaction *, struct sigaction *);
int sigprocmask (int, const sigset_t *, sigset_t *);
int __sigsuspend (int unused1, int unused2, unsigned mask);
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 091ee6d..87fcfd0 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -103,6 +103,10 @@
extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+# define UTIME_NOW ((1l << 30) - 1l)
+# define UTIME_OMIT ((1l << 30) - 2l)
+extern int utimensat (int fd, const char *path, const struct timespec times[2], int flags);
+
__END_DECLS
#endif /* _SYS_STAT_H_ */