Date: Wed, 18 Apr 2007 13:43:54 -0400 From: Jung-uk Kim <jkim@FreeBSD.org> To: freebsd-emulation@FreeBSD.org Cc: Alexander Leidinger <Alexander@leidinger.net>, Divacky Roman <rdivacky@FreeBSD.org>, Scot Hetzel <swhetzel@gmail.com> Subject: Re: linuxolator: implement settimeofday call on FreeBSD/amd64 Message-ID: <200704181343.57111.jkim@FreeBSD.org> In-Reply-To: <790a9fff0704181019m37456143o36c82bd24f7dfe9c@mail.gmail.com> References: <790a9fff0612190922t1f4a3fa1m44092944485297f7@mail.gmail.com> <20061219180156.GA87609@stud.fit.vutbr.cz> <790a9fff0704181019m37456143o36c82bd24f7dfe9c@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 18 April 2007 01:19 pm, Scot Hetzel wrote: > On 12/19/06, Divacky Roman <xdivac02@stud.fit.vutbr.cz> wrote: > > On Tue, Dec 19, 2006 at 11:22:56AM -0600, Scot Hetzel wrote: > > > I noticed that the settimeofday call in the linuxolator is > > > implemented on FreeBSD/i386, but it is missing from > > > FreeBSD/amd64. The attached patch implements the function on > > > FreeBSD/amd64. > > > > makes me wonder... what is MD on this code? I dont see anything > > I finally figured out what is MD for the settimeofday call. > > On FreeBSD/i386: > > struct l_timeval = struct timeval > > for FreeBSD/amd64 > > struct l_timeval < struct timeval > > The reason for this difference is tv_sec is 32 bits on i386 and 64 > bits on amd64. > > amd64/include/_types.h: > typedef __int64_t __time_t; /* time()... */ > > i386/include/_types.h: > typedef __int32_t __time_t; /* time()... */ > > sys/_types.h: > typedef long __suseconds_t; /* microseconds (signed) > */ > > sys/_timeval.h: > typedef __time_t time_t; > typedef __suseconds_t suseconds_t; /* microseconds (signed) > */ > > struct timeval { > time_t tv_sec; /* seconds */ > suseconds_t tv_usec; /* and microseconds */ > }; > > The reason we can't use freebsd's settimeofday call directly (as > done in the i386 linuxolator) in the linuxolator for amd64 is that > the freebsd settimeofday function uses copyin, and since the > l_timeval stuct is < timeval struct, it ends up copying the tv_usec > value into tv_sec. Correct. > Attached is the current patch to add the settimeofday call to the > linuxolator for amd64. It looks okay but it has style changes as well. I will do some clean up and check it in directly to CVS. Thanks, Jung-uk Kim
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704181343.57111.jkim>