xenconsoled: replace gettimeofday with clock_gettime
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 30 Jul 2008 08:18:35 +0000 (09:18 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 30 Jul 2008 08:18:35 +0000 (09:18 +0100)
commitdd6832985c0ac4dd71b961010fb09916aa69d75a
tree90ded31f3acc43202c8a33101dfc63ef9257fb4c
parent67e5041100ce387699722aec096a37e6d58a290e
xenconsoled: replace gettimeofday with clock_gettime

Currently if someone changes the date on the host, xenconsoled may
behave incorrectly due to the use of gettimeofday for the rate control
algorithm. For example I was able to hang the console connected to a
guest just setting the date forward 20 years. To solve the problem we
need to use a time source that doesn't change start point, that is
clock_gettime with CLOCK_MONOTONIC. The only bad side effect is that
it introduces a dependency to librt, but I think is well worth it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
tools/console/Makefile
tools/console/daemon/io.c