sys_macosx: remove adjtime() check
Remove the runtime checking of adjtime(). adjtime() was broken in beta releases of macOS 10.13 but is ok now.
This commit is contained in:
parent
e8bc41e862
commit
f176193d35
1 changed files with 2 additions and 40 deletions
42
sys_macosx.c
42
sys_macosx.c
|
@ -49,10 +49,8 @@
|
||||||
#ifdef HAVE_MACOS_SYS_TIMEX
|
#ifdef HAVE_MACOS_SYS_TIMEX
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include "sys_netbsd.h"
|
#include "sys_netbsd.h"
|
||||||
#include "sys_timex.h"
|
|
||||||
|
|
||||||
static int have_ntp_adjtime = 0;
|
static int have_ntp_adjtime = 0;
|
||||||
static int have_bad_adjtime = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
@ -453,45 +451,13 @@ legacy_MacOSX_Finalise(void)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
#ifdef HAVE_MACOS_SYS_TIMEX
|
|
||||||
/*
|
|
||||||
Test adjtime() to see if Apple have fixed the signed/unsigned bug
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
test_adjtime()
|
|
||||||
{
|
|
||||||
struct timeval tv1 = {-1, 0};
|
|
||||||
struct timeval tv2 = {0, 0};
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
if (PRV_AdjustTime(&tv1, &tv) != 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (PRV_AdjustTime(&tv2, &tv) != 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (tv.tv_sec < -1 || tv.tv_sec > 1) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ================================================== */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SYS_MacOSX_Initialise(void)
|
SYS_MacOSX_Initialise(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MACOS_SYS_TIMEX
|
#ifdef HAVE_MACOS_SYS_TIMEX
|
||||||
have_ntp_adjtime = (dlsym(RTLD_NEXT, "ntp_adjtime") != NULL);
|
have_ntp_adjtime = (dlsym(RTLD_NEXT, "ntp_adjtime") != NULL);
|
||||||
if (have_ntp_adjtime) {
|
if (have_ntp_adjtime) {
|
||||||
have_bad_adjtime = !test_adjtime();
|
SYS_NetBSD_Initialise();
|
||||||
if (have_bad_adjtime) {
|
|
||||||
LOG(LOGS_WARN, "adjtime() is buggy - using timex driver");
|
|
||||||
SYS_Timex_Initialise();
|
|
||||||
} else {
|
|
||||||
SYS_NetBSD_Initialise();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -505,11 +471,7 @@ SYS_MacOSX_Finalise(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MACOS_SYS_TIMEX
|
#ifdef HAVE_MACOS_SYS_TIMEX
|
||||||
if (have_ntp_adjtime) {
|
if (have_ntp_adjtime) {
|
||||||
if (have_bad_adjtime) {
|
SYS_NetBSD_Finalise();
|
||||||
SYS_Timex_Finalise();
|
|
||||||
} else {
|
|
||||||
SYS_NetBSD_Finalise();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue