[Git][NTPsec/ntpsec][master] Last direct call to adjtimex(2) call gone...
Eric S. Raymond
gitlab at mg.gitlab.com
Wed Oct 12 03:23:16 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
57f9368f by Eric S. Raymond at 2016-10-11T23:22:53-04:00
Last direct call to adjtimex(2) call gone...
...everything goes through ntp_adjtime(2) now. Clean up docs
accordingly.
- - - - -
7 changed files:
- INSTALL
- devel/hacking.txt
- devel/tour.txt
- docs/includes/ntptime-body.txt
- ntpfrob/main.c
- ntpfrob/tickadj.c
- ntptime/ntptime.c
Changes:
=====================================
INSTALL
=====================================
--- a/INSTALL
+++ b/INSTALL
@@ -4,11 +4,10 @@
This software should build on any operating system conformant to
POSIX.1-2001 and ISO/IEC 9899:1999 (C99). In addition, the operating
-system must have either a Linux-like adjtimex(2) call or a BSD-like
-ntp_adjtime(2) call or the older BSD adjtime(2) call. Also, it must
-support the IPv6 API defined in RFC2493 and RFC2553. Finally, it must
-support iterating over active UDP interfaces via getifaddrs(3) or some
-equivalent facility.
+system must have an ntp_adjtime(2) call or the older BSD adjtime(2)
+call. Also, it must support the IPv6 API defined in RFC2493 and
+RFC2553. Finally, it must support iterating over active UDP interfaces
+via getifaddrs(3) or some equivalent facility.
There are some prerequisites. Libraries need the binary installed
to run and in addition, the development headers installed to build.
=====================================
devel/hacking.txt
=====================================
--- a/devel/hacking.txt
+++ b/devel/hacking.txt
@@ -52,8 +52,7 @@ POSIX threads *are* considered part of the standardized API and may be used.
Here are the non-standardized AIs that may be used:
-* Linux-style adjtimex() or BSD-style ntp_gettime(2)/ntp_adjtime(), or
- the older BSD adjtime(2).
+* Eother ntp_adjtime() or the older BSD adjtime(2).
* Berkeley sockets and the IPv6 API defined in RFC2493 and RFC2553.
=====================================
devel/tour.txt
=====================================
--- a/devel/tour.txt
+++ b/devel/tour.txt
@@ -172,7 +172,7 @@ some systems, including Linux) adjtimex(2), or the older BSD
adjtime(2) call.
The clock_gettime(2) and clock_settime(2) calls are standardized in
-POSIX; ntp_adjtime(3) and adjtimex(2) are not, exhibiting some
+POSIX; ntp_adjtime(2) and adjtimex(2) are not, exhibiting some
variability in behavior across platforms. Where adjtimex(2) exists
(notably under Linux), ntp_adjtime(2) is implemented as a thin
userspace wrapper around it.
@@ -219,24 +219,17 @@ applications might notice. The slewing variations in clock speed are so
small that they're generally invisible even to soft-realtime
applications.
-The calls ntp_adjtime(2) and adjtimex(2) are for clock slewing. Both
-use a kernel interface to do this. Both use a control technique called
-a PLL/FLL (phase-locked loop/frequency-locked loop) to do it. The
-difference is that adjtimex(2) adjusts a PLL/FLL implemented in the
-kernel, whereas ntp_adjtime(2) implements clock skewing for a PLL
-running in userspace (in ntpd itself). The KERNEL_PLL code can produce
-much faster convergence from a cold start.
+The call ntp_adjtime(2) is for clock slewing; NTPsec never calls
+adjtimex(2) directly, but it may be used to implement
+ntp_adjtime(2). ntp_adjtime(2)/adjtimex(2) uses a kernel interface to
+do its work, using a control technique called a PLL/FLL (phase-locked
+loop/frequency-locked loop) to do it.
-(Confusingly, ntp_adjtime(2) can be implemented - and often is - as
-a thin userspace wrapper around adjtimex(2). The ntp_adjtime(2)
-implementation uses only a subset of adjtimex(2)'s capabilities.)
-
-The older BSD adjtime(2) is used for slewing as well, but doesn't
+The older BSD adjtime(2) can be used for slewing as well, but doesn't
assume a kernel-level PLL is available. Some platforms, like OpenBSD
-and Mac OS X, use only this call because they lack
-ntp_adjtime(2)/adjtimex(2). Without the PLL calls, convergence to
-good time is observably a lot slower and tracking will accordingly be
-less reliable.
+and Mac OS X, use only this call because they lack ntp_adjtime(2).
+Without the PLL calls, convergence to good time is observably a lot
+slower and tracking will accordingly be less reliable.
Deep-in-the weeds details about the kernel PLL from Hal Murray follow.
If you can follow these you may be qualified to maintain this code...
=====================================
docs/includes/ntptime-body.txt
=====================================
--- a/docs/includes/ntptime-body.txt
+++ b/docs/includes/ntptime-body.txt
@@ -19,10 +19,9 @@ distribution for further details.
A similar display can be obtained using the +{ntpq}+ program
and +kerninfo+ command.
-//FIXME: Is this all modern Unix kernels? Probably.
-This program is useful only with special kernels described in the
-link:kern.html[A Kernel Model for Precision Timekeeping]
-page, featuring the adjtimex(2) system call or local equivalent.
+This program is useful only with kernels featuring the ntp_adjtime(2)
+system call or local equivalent, as described in the link:kern.html[A
+Kernel Model for Precision Timekeeping] page,
== Options ==
=====================================
ntpfrob/main.c
=====================================
--- a/ntpfrob/main.c
+++ b/ntpfrob/main.c
@@ -21,20 +21,10 @@ main(int argc, char **argv)
while ((ch = getopt(argc, argv, "a:Ab:cejp:r")) != EOF) {
switch (ch) {
case 'A':
-#ifdef HAVE_ADJTIMEX
tickadj(mode==json, 0);
-#else
- fputs("ntpfrob: no adjtimex(2) call.\n", stderr);
- exit(0);
-#endif
break;
case 'a':
-#ifdef HAVE_ADJTIMEX
tickadj(mode, atoi(optarg));
-#else
- fputs("ntpfrob: no adjtimex(2) call.\n", stderr);
- exit(0);
-#endif
break;
case 'b':
bumpclock(atoi(optarg));
=====================================
ntpfrob/tickadj.c
=====================================
--- a/ntpfrob/tickadj.c
+++ b/ntpfrob/tickadj.c
@@ -1,6 +1,6 @@
/*
* tickadj - read, and possibly modify, the kernel `tick' and
- * `tickadj' variables', using adjtimex(2). This is
+ * `tickadj' variables', using ntp_adjtime(2). This is
* included only for compatibility with old scripts.
* Its former support for unsafe /dev/kmem operations
* has been removed.
@@ -45,19 +45,19 @@ void tickadj(const bool json, const int newtick)
fprintf(stderr, "ntpfrob: silly value for tick: %d\n", newtick);
exit(1);
}
-#ifdef ADJ_TIMETICK
- txc.modes = ADJ_TIMETICK;
+#ifdef MOD_TIMETICK
+ txc.modes = MOD_TIMETICK;
#else
#ifdef STRUCT_TIMEX_HAS_MODES
txc.modes = ADJ_TICK;
#else
txc.mode = ADJ_TICK;
#endif /* STRUCT_TIMEX_HAS_MODES */
-#endif /* ADJ_TIMETICK */
+#endif /* MOD_TIMETICK */
}
else
{
-#ifdef ADJ_TIMETICK
+#ifdef MOD_TIMETICK
txc.modes = 0;
#else
#ifdef STRUCT_TIMEX_HAS_MODES
@@ -65,12 +65,12 @@ void tickadj(const bool json, const int newtick)
#else
txc.mode = 0;
#endif /* STRUCT_TIMEX_HAS_MODES */
-#endif /* ADJ_TIMETICK */
+#endif /* MOD_TIMETICK */
}
- if (adjtimex(&txc) < 0)
+ if (ntp_adjtime(&txc) < 0)
{
- perror("adjtimex");
+ perror("ntp_adjtime");
}
else
{
=====================================
ntptime/ntptime.c
=====================================
--- a/ntptime/ntptime.c
+++ b/ntptime/ntptime.c
@@ -299,7 +299,7 @@ main(
#ifdef SIGSYS
if (sigsetjmp(env, 1) == 0) {
#endif
- status = ntp_adjtime(&_ntx);
+ status = ntp_adjtime_ns(&_ntx);
if ((status < 0) && (errno == ENOSYS))
--pll_control;
flash = _ntx.status;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/57f9368f05c36c908159f83570c1ccf397ad7b94
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161012/a8fd82f8/attachment.html>
More information about the vc
mailing list