+static inline struct timeval*
+copy_utimes (struct timeval* to, struct Mono_Posix_Timeval *from)
+{
+ if (from) {
+ to[0].tv_sec = from->tv_sec;
+ to[0].tv_usec = from->tv_usec;
+ to[1].tv_sec = from->tv_sec;
+ to[1].tv_usec = from->tv_usec;
+ return to;
+ }
+
+ return NULL;
+}
+
+gint32
+Mono_Posix_Syscall_utimes(const char *filename, struct Mono_Posix_Timeval *tv)
+{
+ struct timeval _tv[2];
+ struct timeval *ptv;
+
+ ptv = copy_utimes (_tv, tv);
+
+ return utimes (filename, ptv);
+}
+
+#ifdef HAVE_LUTIMES
+gint32
+Mono_Posix_Syscall_lutimes(const char *filename, struct Mono_Posix_Timeval *tv)
+{
+ struct timeval _tv[2];
+ struct timeval *ptv;
+
+ ptv = copy_utimes (_tv, tv);
+
+ return lutimes (filename, ptv);
+}
+#endif /* def HAVE_LUTIMES */
+
+gint32
+Mono_Posix_Syscall_futimes(int fd, struct Mono_Posix_Timeval *tv)
+{
+ struct timeval _tv[2];
+ struct timeval *ptv;
+
+ ptv = copy_utimes (_tv, tv);
+
+ return futimes (fd, ptv);
+}
+