From owner-freebsd-emulation@FreeBSD.ORG Thu Dec 14 15:35:13 2006 Return-Path: X-Original-To: emulation@freebsd.org Delivered-To: freebsd-emulation@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7659116A412 for ; Thu, 14 Dec 2006 15:35:13 +0000 (UTC) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.176.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3C3EF43ED1 for ; Thu, 14 Dec 2006 15:29:20 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.8/8.13.7) with ESMTP id kBEFUUve036792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 14 Dec 2006 16:30:30 +0100 (CET) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.8/8.13.3/Submit) id kBEFUUP9036791; Thu, 14 Dec 2006 16:30:30 +0100 (CET) Date: Thu, 14 Dec 2006 16:30:29 +0100 From: Divacky Roman To: Scot Hetzel Message-ID: <20061214153029.GA36558@stud.fit.vutbr.cz> References: <790a9fff0612140333ofd0891el59f767329f291371@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <790a9fff0612140333ofd0891el59f767329f291371@mail.gmail.com> User-Agent: Mutt/1.4.2.2i X-Scanned-By: MIMEDefang 2.57 on 147.229.176.14 Cc: emulation@freebsd.org Subject: Re: linuxolator: utimes implementation X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2006 15:35:13 -0000 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