A bugfix for DragonFly's adjtime() implementation

Frank W. Josellis frank at dynamical-systems.org
Sun Mar 19 06:40:46 PST 2006


While testing a clock synchronization software on DragonFly I observed a 
problem with the adjtime(2) system call. The retrieved olddelta values 
appeared to be quite incorrect, and the reason for this eventually turned 
out to be an elementary bug which can be fixed by the patch below. Please 
have a look at it, I'd think this case is pretty clear and needs no further 
description.

Frank Josellis


--- patch begins here ---
--- sys/kern/kern_time.c.orig	2005-10-08 14:24:26.000000000 +0200
+++ sys/kern/kern_time.c	2006-03-18 23:53:37.000000000 +0100
@@ -547,7 +547,7 @@
 
 	if (uap->olddelta) {
 		atv.tv_sec = odelta / 1000000000;
-		atv.tv_usec = odelta % 1000000 / 1000;
+		atv.tv_usec = odelta % 1000000000 / 1000;
 		(void) copyout((caddr_t)&atv, (caddr_t)uap->olddelta,
 		    sizeof(struct timeval));
 	}
--- patch ends here ---






More information about the Bugs mailing list