Drop support for old readonly adjtime
This commit is contained in:
parent
da1097095c
commit
50de930730
3 changed files with 16 additions and 39 deletions
43
sys_linux.c
43
sys_linux.c
|
@ -106,8 +106,7 @@ static int version_patchlevel;
|
||||||
/* Flag indicating whether adjtimex() returns the remaining time adjustment
|
/* Flag indicating whether adjtimex() returns the remaining time adjustment
|
||||||
or not. If not we have to read the outstanding adjustment by setting it to
|
or not. If not we have to read the outstanding adjustment by setting it to
|
||||||
zero, examining the return value and setting the outstanding adjustment back
|
zero, examining the return value and setting the outstanding adjustment back
|
||||||
again. If 1, txc.modes equal to zero is used to read the time. If 2,
|
again. */
|
||||||
txc.modes is set to ADJ_OFFSET_SS_READ. */
|
|
||||||
|
|
||||||
static int have_readonly_adjtime;
|
static int have_readonly_adjtime;
|
||||||
|
|
||||||
|
@ -766,29 +765,19 @@ get_offset_correction(struct timeval *raw,
|
||||||
if (!slow_slewing) {
|
if (!slow_slewing) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
} else {
|
} else {
|
||||||
switch (have_readonly_adjtime) {
|
if (have_readonly_adjtime) {
|
||||||
case 2:
|
if (TMX_GetOffsetLeft(&offset) < 0) {
|
||||||
if (TMX_GetOffsetLeft(&offset) < 0) {
|
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
||||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
}
|
||||||
}
|
} else {
|
||||||
break;
|
toffset = 0;
|
||||||
case 0:
|
if (TMX_ApplyOffset(&toffset) < 0) {
|
||||||
toffset = 0;
|
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
||||||
if (TMX_ApplyOffset(&toffset) < 0) {
|
}
|
||||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
offset = toffset;
|
||||||
}
|
if (TMX_ApplyOffset(&toffset) < 0) {
|
||||||
offset = toffset;
|
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
||||||
if (TMX_ApplyOffset(&toffset) < 0) {
|
}
|
||||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (TMX_GetOffsetLeftOld(&offset) < 0) {
|
|
||||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
|
@ -1006,7 +995,7 @@ get_version_specific_details(void)
|
||||||
if (kernelvercmp(major, minor, patch, 2, 6, 27) < 0) {
|
if (kernelvercmp(major, minor, patch, 2, 6, 27) < 0) {
|
||||||
have_readonly_adjtime = 0;
|
have_readonly_adjtime = 0;
|
||||||
} else {
|
} else {
|
||||||
have_readonly_adjtime = 2;
|
have_readonly_adjtime = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ADJ_NANO support */
|
/* ADJ_NANO support */
|
||||||
|
@ -1051,7 +1040,7 @@ SYS_Linux_Initialise(void)
|
||||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_readonly_adjtime == 2 && (TMX_GetOffsetLeft(&offset) < 0 || offset)) {
|
if (have_readonly_adjtime && (TMX_GetOffsetLeft(&offset) < 0 || offset)) {
|
||||||
LOG(LOGS_INFO, LOGF_SysLinux, "adjtimex() doesn't support ADJ_OFFSET_SS_READ");
|
LOG(LOGS_INFO, LOGF_SysLinux, "adjtimex() doesn't support ADJ_OFFSET_SS_READ");
|
||||||
have_readonly_adjtime = 0;
|
have_readonly_adjtime = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,17 +96,6 @@ TMX_GetFrequency(double *freq)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
TMX_GetOffsetLeftOld(long *offset)
|
|
||||||
{
|
|
||||||
struct timex txc;
|
|
||||||
int result;
|
|
||||||
txc.modes = 0; /* pure read */
|
|
||||||
result = adjtimex(&txc);
|
|
||||||
*offset = txc.offset;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TMX_GetOffsetLeft(long *offset)
|
TMX_GetOffsetLeft(long *offset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,6 @@ int TMX_SetTick(long tick);
|
||||||
int TMX_ApplyOffset(long *offset);
|
int TMX_ApplyOffset(long *offset);
|
||||||
int TMX_SetFrequency(double *freq, long tick);
|
int TMX_SetFrequency(double *freq, long tick);
|
||||||
int TMX_GetFrequency(double *freq);
|
int TMX_GetFrequency(double *freq);
|
||||||
int TMX_GetOffsetLeftOld(long *offset);
|
|
||||||
int TMX_GetOffsetLeft(long *offset);
|
int TMX_GetOffsetLeft(long *offset);
|
||||||
int TMX_ReadCurrentParams(struct tmx_params *params);
|
int TMX_ReadCurrentParams(struct tmx_params *params);
|
||||||
int TMX_SetLeap(int leap);
|
int TMX_SetLeap(int leap);
|
||||||
|
|
Loading…
Reference in a new issue