sys: add null driver

Add a new clock driver that doesn't actually try to adjust the clock.
It allows chronyd to run without the capability to adjust/set the system
clock, e.g. in some containers. It can be enabled by the -x option.
This commit is contained in:
Miroslav Lichvar
2017-03-09 18:16:56 +01:00
parent 0ff449e6a6
commit c44346096c
7 changed files with 202 additions and 5 deletions

16
sys.c
View File

@@ -30,6 +30,7 @@
#include "sysincl.h"
#include "sys.h"
#include "sys_null.h"
#include "logging.h"
#if defined(LINUX)
@@ -44,9 +45,18 @@
/* ================================================== */
static int null_driver;
/* ================================================== */
void
SYS_Initialise(void)
SYS_Initialise(int clock_control)
{
null_driver = !clock_control;
if (null_driver) {
SYS_Null_Initialise();
return;
}
#if defined(LINUX)
SYS_Linux_Initialise();
#elif defined(SOLARIS)
@@ -65,6 +75,10 @@ SYS_Initialise(void)
void
SYS_Finalise(void)
{
if (null_driver) {
SYS_Null_Finalise();
return;
}
#if defined(LINUX)
SYS_Linux_Finalise();
#elif defined(SOLARIS)