Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Dec 2006 11:22:56 -0600
From:      "Scot Hetzel" <swhetzel@gmail.com>
To:        freebsd-emulation@freebsd.org
Subject:   linuxolator: implement settimeofday call on FreeBSD/amd64
Message-ID:  <790a9fff0612190922t1f4a3fa1m44092944485297f7@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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.

I have run this change thru the LTP testcases settimeofday01, and
settimeofday02.

Currently, it is failing one test in settimeofday01 due to it taking
24-30 minutes to complete and hangs the system for that duration of
time.  The test expects the difference between what it set the time to
(100 sec, 100 msec) and what it gets back from gettimeofday to be
within -500 and +500 msec.

So far it looks to be a bug in the FreeBSD kern_settimeofday function,
and not in the code that I used to implement the linux_settimeofday
function.  As I had rewritten the testcase to run on FreeBSD, and it
also hung the system for the same amount of time.

Scot

-- 
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.

[-- Attachment #2 --]
--- amd64/linux32/linux32_dummy.c-orig	28 Oct 2006 10:59:59 -0000
+++ amd64/linux32/linux32_dummy.c	17 Dec 2006 09:45:35 -0000
@@ -65,7 +63,6 @@
 DUMMY(mincore);
 DUMMY(fadvise64);
 DUMMY(ptrace);
-DUMMY(settimeofday);
 DUMMY(lookup_dcookie);
 DUMMY(epoll_create);
 DUMMY(epoll_ctl);
--- amd64/linux32/linux32_machdep.c-orig	Mon Dec 18 03:19:31 2006
+++ amd64/linux32/linux32_machdep.c	Sun Dec 17 23:14:37 2006
@@ -1097,6 +1097,33 @@
 }
 
 int
+linux_settimeofday(struct thread *td, struct linux_settimeofday_args *uap)
+{
+	l_timeval tv32;
+	struct timeval tv, *tvp;
+	struct timezone tz, *tzp;
+	int error;
+
+	if (uap->tp) {
+		error = copyin(uap->tp, &tv32, sizeof(tv32));
+		if (error)
+			return (error);
+		tv.tv_sec = tv32.tv_sec;
+		tv.tv_usec = tv32.tv_usec;
+		tvp = &tv;
+	} else
+		tvp = NULL;
+	if (uap->tzp) {
+		error = copyin(uap->tzp, &tz, sizeof(tz));
+		if (error)
+			return (error);
+		tzp = &tz;
+	} else
+		tzp = NULL;
+	return (kern_settimeofday(td, tvp, tzp));
+}
+
+int
 linux_getrusage(struct thread *td, struct linux_getrusage_args *uap)
 {
 	struct l_rusage s32;

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