1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10 #include <sys/syscall.h>
13 #if defined __NR_utimensat && !defined __NR_utimes
16 int utimes(const char *file, const struct timeval tvp[2])
18 struct timespec ts[2], *times;
21 times[0].tv_sec = tvp[0].tv_sec;
22 times[0].tv_nsec = tvp[0].tv_usec * 1000;
23 times[1].tv_sec = tvp[1].tv_sec;
24 times[1].tv_nsec = tvp[1].tv_usec * 1000;
29 return utimensat(AT_FDCWD, file, times, 0);
32 #elif defined __NR_utimes
33 _syscall2(int, utimes, const char *, file, const struct timeval *, tvp)
34 #elif defined __NR_utime
39 int utimes(const char *file, const struct timeval tvp[2])
41 struct utimbuf buf, *times;
45 times->actime = tvp[0].tv_sec;
46 times->modtime = tvp[1].tv_sec;
50 return utime(file, times);
54 #if defined __NR_utimensat || defined __NR_utimes || defined __NR_utime
55 libc_hidden_def(utimes)