1 #define _GNU_SOURCE 2 #include <sys/time.h> 3 #include <sys/stat.h> 4 #include <errno.h> 5 #include "syscall.h" 6 __futimesat(int dirfd,const char * pathname,const struct timeval times[2])7int __futimesat(int dirfd, const char *pathname, const struct timeval times[2]) 8 { 9 struct timespec ts[2]; 10 if (times) { 11 int i; 12 for (i=0; i<2; i++) { 13 if (times[i].tv_usec >= 1000000ULL) 14 return __syscall_ret(-EINVAL); 15 ts[i].tv_sec = times[i].tv_sec; 16 ts[i].tv_nsec = times[i].tv_usec * 1000; 17 } 18 } 19 return utimensat(dirfd, pathname, times ? ts : 0, 0); 20 } 21 22 weak_alias(__futimesat, futimesat); 23