linuxolator: utimes implementation
Divacky Roman
xdivac02 at stud.fit.vutbr.cz
Thu Dec 14 07:35:13 PST 2006
On Thu, Dec 14, 2006 at 05:33:40AM -0600, Scot Hetzel wrote:
> While I was running the the tests for ltp-full-20061121, I noticed
> that the utimes function wasn't implemented in the linuxolator.
>
> I looked up the man page and found that it was similar to the utime
> function, except that it allows a program to set an inode down to the
> microsecond.
>
> Merging together the linux_utime and freebsd32_utimes functions, I was
> able to create the linux_utimes function.
what about this patch instead (only relevant part):
Index: linux_misc.c
===================================================================
RCS file: /home/ncvs/src/sys/compat/linux/linux_misc.c,v
retrieving revision 1.199
diff -u -r1.199 linux_misc.c
--- linux_misc.c 4 Dec 2006 22:46:09 -0000 1.199
+++ linux_misc.c 14 Dec 2006 15:29:37 -0000
@@ -785,6 +785,38 @@
LFREEPATH(fname);
return (error);
}
+
+int
+linux_utimes(struct thread *td, struct linux_utimes_args *args)
+{
+ l_timeval ltv[2];
+ struct timeval tv[2], *tvp = NULL;
+ char *fname;
+ int error;
+
+ LCONVPATHEXIST(td, args->fname, &fname);
+
+#ifdef DEBUG
+ if (ldebug(utimes))
+ printf(ARGS(utimes, "%s, *"), fname);
+#endif
+
+ if (args->tptr != NULL) {
+ if ((error = copyin(args->tptr, ltv, sizeof ltv))) {
+ LFREEPATH(fname);
+ return (error);
+ }
+ tv[0].tv_sec = ltv[0].tv_sec;
+ tv[0].tv_usec = ltv[0].tv_usec;
+ tv[1].tv_sec = ltv[1].tv_sec;
+ tv[1].tv_usec = ltv[1].tv_usec;
+ tvp = tv;
+ }
+
+ error = kern_utimes(td, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE);
+ LFREEPATH(fname);
+ return (error);
+}
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
#define __WCLONE 0x80000000
More information about the freebsd-emulation
mailing list