linuxolator: implement settimeofday call on FreeBSD/amd64
Jung-uk Kim
jkim at FreeBSD.org
Wed Apr 18 17:44:01 UTC 2007
On Wednesday 18 April 2007 01:19 pm, Scot Hetzel wrote:
> On 12/19/06, Divacky Roman <xdivac02 at 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
More information about the freebsd-emulation
mailing list