From: Markos Chandras <markos.chand...@imgtec.com> Signed-off-by: Markos Chandras <markos.chand...@imgtec.com> --- libc/sysdeps/linux/common/utime.c | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/libc/sysdeps/linux/common/utime.c b/libc/sysdeps/linux/common/utime.c index c9fd1bf..d3e12d4 100644 --- a/libc/sysdeps/linux/common/utime.c +++ b/libc/sysdeps/linux/common/utime.c @@ -8,10 +8,30 @@ */ #include <sys/syscall.h> +#include <fcntl.h> +#include <stddef.h> #include <utime.h> -#ifdef __NR_utime +#if defined(__NR_utimensat) && ! defined(__NR_utime) +int utime(const char* file, const struct utimbuf* times) +{ + struct timespec tspecs[2], *ts; + + if (times) { + ts = tspecs; + ts[0].tv_sec = times->actime; + ts[0].tv_nsec = 0; + ts[1].tv_sec = times->modtime; + ts[1].tv_nsec = 0; + } else { + ts = NULL; + } + + return utimensat(AT_FDCWD, file, ts, 0); +} + +#elif defined(__NR_utime) _syscall2(int, utime, const char *, file, const struct utimbuf *, times) #else #include <stdlib.h> -- 1.7.1 _______________________________________________ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc