summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraaron <aaron@openbsd.org>1999-12-06 19:36:41 +0000
committeraaron <aaron@openbsd.org>1999-12-06 19:36:41 +0000
commit3b64c0d65d4df58a44bc970ef2655f3c2c9ed27d (patch)
treeb1a10df0c495cf5ac67feea741411d0feaeb44d7
parentsay how long the buffer needs to be (diff)
downloadwireguard-openbsd-3b64c0d65d4df58a44bc970ef2655f3c2c9ed27d.tar.xz
wireguard-openbsd-3b64c0d65d4df58a44bc970ef2655f3c2c9ed27d.zip
Implement compatibility for Linux stime() syscall.
-rw-r--r--sys/compat/linux/linux_misc.c29
-rw-r--r--sys/compat/linux/syscalls.master4
-rw-r--r--sys/kern/kern_time.c6
-rw-r--r--sys/sys/time.h3
4 files changed, 35 insertions, 7 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 97ebc30aed5..599be904272 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_misc.c,v 1.24 1999/06/14 06:47:54 deraadt Exp $ */
+/* $OpenBSD: linux_misc.c,v 1.25 1999/12/06 19:36:41 aaron Exp $ */
/* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */
/*
@@ -1255,3 +1255,30 @@ linux_sys_nice(p, v, retval)
SCARG(&bsa, prio) = SCARG(uap, incr);
return sys_setpriority(p, &bsa, retval);
}
+
+int
+linux_sys_stime(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct linux_sys_time_args /* {
+ linux_time_t *t;
+ } */ *uap = v;
+ struct timeval atv;
+ linux_time_t tt;
+ int error;
+
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
+ return (error);
+
+ if ((error = copyin(SCARG(uap, t), &tt, sizeof(tt))) != 0)
+ return (error);
+
+ atv.tv_sec = tt;
+ atv.tv_usec = 0;
+
+ settime(&atv);
+
+ return 0;
+}
diff --git a/sys/compat/linux/syscalls.master b/sys/compat/linux/syscalls.master
index 0c7ed5adc08..a39816ed466 100644
--- a/sys/compat/linux/syscalls.master
+++ b/sys/compat/linux/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.13 1997/12/10 11:55:28 deraadt Exp $
+ $OpenBSD: syscalls.master,v 1.14 1999/12/06 19:36:42 aaron Exp $
; $NetBSD: syscalls.master,v 1.15 1995/12/18 14:35:10 fvdl Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -73,7 +73,7 @@
22 STD { int linux_sys_umount(char *specialfile); }
23 NOARGS { int sys_setuid(uid_t uid); }
24 NOARGS { uid_t sys_getuid(void); }
-25 UNIMPL stime
+25 STD { int linux_sys_stime(linux_time_t *t); }
26 UNIMPL ptrace
27 STD { int linux_sys_alarm(unsigned int secs); }
28 OBSOL ofstat
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 801933e4a0c..9c75482325e 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_time.c,v 1.14 1999/06/06 19:21:34 deraadt Exp $ */
+/* $OpenBSD: kern_time.c,v 1.15 1999/12/06 19:36:42 aaron Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
@@ -55,7 +55,7 @@
#include <machine/cpu.h>
-static void settime __P((struct timeval *));
+void settime __P((struct timeval *));
/*
* Time of day and interval timer support.
@@ -68,7 +68,7 @@ static void settime __P((struct timeval *));
*/
/* This function is used by clock_settime and settimeofday */
-static void
+void
settime(tv)
struct timeval *tv;
{
diff --git a/sys/sys/time.h b/sys/sys/time.h
index 216a0533ca6..fdc90fd6cf8 100644
--- a/sys/sys/time.h
+++ b/sys/sys/time.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: time.h,v 1.8 1998/11/21 03:01:03 d Exp $ */
+/* $OpenBSD: time.h,v 1.9 1999/12/06 19:36:42 aaron Exp $ */
/* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */
/*
@@ -166,6 +166,7 @@ struct clockinfo {
int itimerfix __P((struct timeval *tv));
int itimerdecr __P((struct itimerval *itp, int usec));
void microtime __P((struct timeval *tv));
+void settime __P((struct timeval *tv));
#else /* !_KERNEL */
#include <time.h>