Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2006 16:30:29 +0100
From:      Divacky Roman <xdivac02@stud.fit.vutbr.cz>
To:        Scot Hetzel <swhetzel@gmail.com>
Cc:        emulation@freebsd.org
Subject:   Re: linuxolator: utimes implementation
Message-ID:  <20061214153029.GA36558@stud.fit.vutbr.cz>
In-Reply-To: <790a9fff0612140333ofd0891el59f767329f291371@mail.gmail.com>
References:  <790a9fff0612140333ofd0891el59f767329f291371@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061214153029.GA36558>