From 86a0e5dbb64b936a70e0795546c6f4686a1ab4f8 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Wed, 18 Apr 2007 18:08:12 +0000 Subject: [PATCH] Implement settimeofday() for Linuxulator/amd64. Submitted by: Scot Hetzel (swhetzel at gmail dot com) --- sys/amd64/linux32/linux32_dummy.c | 1 - sys/amd64/linux32/linux32_machdep.c | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/sys/amd64/linux32/linux32_dummy.c b/sys/amd64/linux32/linux32_dummy.c index 5f4b797b5831..43d4573be9c7 100644 --- a/sys/amd64/linux32/linux32_dummy.c +++ b/sys/amd64/linux32/linux32_dummy.c @@ -64,7 +64,6 @@ DUMMY(pivot_root); DUMMY(mincore); DUMMY(fadvise64); DUMMY(ptrace); -DUMMY(settimeofday); DUMMY(lookup_dcookie); DUMMY(epoll_create); DUMMY(epoll_ctl); diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index b9edd84f97d3..320b5fba912a 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -1177,6 +1177,33 @@ linux_gettimeofday(struct thread *td, struct linux_gettimeofday_args *uap) return (error); } +int +linux_settimeofday(struct thread *td, struct linux_settimeofday_args *uap) +{ + l_timeval atv32; + struct timeval atv, *tvp; + struct timezone atz, *tzp; + int error; + + if (uap->tp) { + error = copyin(uap->tp, &atv32, sizeof(atv32)); + if (error) + return (error); + atv.tv_sec = atv32.tv_sec; + atv.tv_usec = atv32.tv_usec; + tvp = &atv; + } else + tvp = NULL; + if (uap->tzp) { + error = copyin(uap->tzp, &atz, sizeof(atz)); + if (error) + return (error); + tzp = &atz; + } else + tzp = NULL; + return (kern_settimeofday(td, tvp, tzp)); +} + int linux_getrusage(struct thread *td, struct linux_getrusage_args *uap) {