linuxolator: implement settimeofday call on FreeBSD/amd64
Scot Hetzel
swhetzel at gmail.com
Wed Apr 18 17:19:11 UTC 2007
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.
Attached is the current patch to add the settimeofday call to the
linuxolator for amd64.
Scot
--
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p4-amd64-settimeofday.diff
Type: text/x-diff
Size: 4048 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20070418/b3ae458b/p4-amd64-settimeofday.bin
More information about the freebsd-emulation
mailing list