mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 19:05:06 -05:00
Add option to ignore initstepslew and makestep directives
When chronyd is started with -R, the initstepslew directive and the makestep directive with a positive limit will be ignored. This is useful when restarting chronyd to avoid unnecessary clock adjustments. It can be used with -r.
This commit is contained in:
19
conf.c
19
conf.c
@@ -117,6 +117,7 @@ static void parse_leapsectz(const char *);
|
||||
/* ================================================== */
|
||||
/* Configuration variables */
|
||||
|
||||
static int restarted = 0;
|
||||
static char *rtc_device = "/dev/rtc";
|
||||
static int acquisition_port = 0; /* 0 means let kernel choose port */
|
||||
static int ntp_port = 123;
|
||||
@@ -325,6 +326,14 @@ static AllowDeny cmd_auth_list = {&cmd_auth_list, &cmd_auth_list};
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
CNF_SetRestarted(int r)
|
||||
{
|
||||
restarted = r;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
/* Read the configuration file */
|
||||
void
|
||||
CNF_ReadFile(const char *filename)
|
||||
@@ -853,6 +862,11 @@ parse_initstepslew(const char *line)
|
||||
int threshold;
|
||||
IPAddr ip_addr;
|
||||
|
||||
/* Ignore the line if chronyd was started with -R. */
|
||||
if (restarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
n_init_srcs = 0;
|
||||
p = line;
|
||||
|
||||
@@ -955,6 +969,11 @@ parse_makestep(const char *line)
|
||||
"Could not read threshold or update limit for stepping clock at line %d\n",
|
||||
line_number);
|
||||
}
|
||||
|
||||
/* Disable limited makestep if chronyd was started with -R. */
|
||||
if (restarted && make_step_limit > 0) {
|
||||
make_step_limit = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
Reference in New Issue
Block a user