- make settime take timespec.

- avoid wrapping of time in settime.
- pass struct proc down so that we can log a detailed message.
This commit is contained in:
christos 2005-12-05 00:16:33 +00:00
parent dd25e265f4
commit 184ad089a7
3 changed files with 18 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc_notalpha.c,v 1.74 2005/05/03 16:26:28 manu Exp $ */
/* $NetBSD: linux_misc_notalpha.c,v 1.75 2005/12/05 00:16:34 christos Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.74 2005/05/03 16:26:28 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.75 2005/12/05 00:16:34 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -393,7 +393,7 @@ linux_sys_stime(l, v, retval)
linux_time_t *t;
} */ *uap = v;
struct proc *p = l->l_proc;
struct timeval atv;
struct timespec ats;
linux_time_t tt;
int error;
@ -403,10 +403,10 @@ linux_sys_stime(l, v, retval)
if ((error = copyin(&tt, SCARG(uap, t), sizeof tt)) != 0)
return error;
atv.tv_sec = tt;
atv.tv_usec = 0;
ats.tv_sec = tt;
ats.tv_nsec = 0;
if ((error = settime(&atv)))
if ((error = settime(p, &ats)))
return (error);
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: clockctl.c,v 1.13 2005/02/27 00:26:58 perry Exp $ */
/* $NetBSD: clockctl.c,v 1.14 2005/12/05 00:16:34 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.13 2005/02/27 00:26:58 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.14 2005/12/05 00:16:34 christos Exp $");
#include "opt_ntp.h"
@ -103,7 +103,7 @@ clockctlioctl(dev, cmd, data, flags, p)
struct sys_clock_settime_args *args =
(struct sys_clock_settime_args *)data;
error = clock_settime1(SCARG(args, clock_id),
error = clock_settime1(p, SCARG(args, clock_id),
SCARG(args, tp));
if (error)
return (error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_sysctl.c,v 1.56 2005/10/08 06:35:56 yamt Exp $ */
/* $NetBSD: init_sysctl.c,v 1.57 2005/12/05 00:16:34 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.56 2005/10/08 06:35:56 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.57 2005/12/05 00:16:34 christos Exp $");
#include "opt_sysv.h"
#include "opt_multiprocessor.h"
@ -1075,8 +1075,8 @@ sysctl_kern_maxvnodes(SYSCTLFN_ARGS)
static int
sysctl_kern_rtc_offset(SYSCTLFN_ARGS)
{
struct timeval tv, delta;
int s, error, new_rtc_offset;
struct timespec ts, delta;
int error, new_rtc_offset;
struct sysctlnode node;
new_rtc_offset = rtc_offset;
@ -1092,14 +1092,12 @@ sysctl_kern_rtc_offset(SYSCTLFN_ARGS)
return (0);
/* if we change the offset, adjust the time */
s = splclock();
tv = time;
splx(s);
delta.tv_sec = 60*(new_rtc_offset - rtc_offset);
delta.tv_usec = 0;
timeradd(&tv, &delta, &tv);
nanotime(&ts);
delta.tv_sec = 60 * (new_rtc_offset - rtc_offset);
delta.tv_nsec = 0;
timespecadd(&ts, &delta, &ts);
rtc_offset = new_rtc_offset;
settime(&tv);
settime(l->l_proc, &ts);
return (0);
}