| [chrony-dev] [RFC PATCH v1 04/17] configure: Add configuration parameters for auxiliary clock support on Linux |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: [chrony-dev] [RFC PATCH v1 04/17] configure: Add configuration parameters for auxiliary clock support on Linux
- From: Christopher S M Hall <christopher.s.hall@xxxxxxxxx>
- Date: Sat, 6 Dec 2025 06:10:50 +0000
- Cc: christopher.s.hall@xxxxxxxxx, david.zage@xxxxxxxxx, yoong.siang.song@xxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765002154; x=1796538154; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RZ2FPdz/CC9sWVcw5A5GGogUQl1Yj8Ic1zWEky7nQOY=; b=e2OWNaoGLbaot2Fx673Zoat700ylJSpx2MT59+QbF1fPtu9vy+KIIhVo jyaf9utCTnhRZaY6Ixo0uxwC6h4rmIAn7vqUG6fCu9uKbdga7lqqz7Ywt Ghwgolwh9ZyRzp/zVagW4XN7s0vVBwzJLhiWTlJH2GlH0kzlvOqI8Q1Rv oDcFwYFshpdjKLCffReoXyQ8MnSgn4CoxjieqtuypD2NY8lnSI1NH29zW 2fK5DFLpyQpubG9Wh+t6et+FNqoHMW/0DNY5CGyl0mVsAugNqVHBmSYzU bdm68MiRBL3Ff3AowBItmj8s0Fv27wp5sSUd2CeiIz1tBHqSs+0deobKx A==;
Add a new capability (HAVE_CLOCK_ADJTIME) for use of clock_adjtime() rather than adjtimex() or ntp_adjtime().
This is needed to make adjustments to the auxiliary clock on Linux builds. Currently, it only enabled on
Linux builds, but could be added to others.
Add a new feature for auxiliary clocks (FEAT_AUXCLOCK) for Linux builds only. Most of the auxiliary clock
code is contained with #ifdef FEAT_AUXCLOCK... #endif.
Since the auxiliary clock requires clock_adjtime() a check is needed. Add a function to check for
capabilities [get_capabilities] not only features. The get_capabilities and get_features functions use
common code.
---
configure | 50 ++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 44 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
index 4f4d155..c1a7150 100755
--- a/configure
+++ b/configure
@@ -130,6 +130,8 @@ For better control, use the options below.
--without-clock-gettime Don't use clock_gettime() even if it is available
--disable-timestamping Disable support for SW/HW timestamping
--enable-ntp-signd Enable support for MS-SNTP authentication in Samba
+ --without-clock-adjtime Don't use clock_adjtime even if it is available
+ --enable-auxclocks Enable use of Linux auxiliary system clocks
--with-ntp-era=SECONDS Specify earliest assumed NTP time in seconds
since 1970-01-01 [50*365 days ago]
--with-user=USER Specify default chronyd user [root]
@@ -185,14 +187,16 @@ add_def () {
fi
}
#}}}
-#{{{ get_features
-get_features () {
+#{{{ get_config
+get_config () {
+ prefix=$1
+ shift
ff=1
for f; do
if [ "$ff" = "0" ]; then
printf " "
fi
- if grep "define FEAT_$f" config.h > /dev/null; then
+ if grep "define ${prefix}_$f" config.h > /dev/null; then
printf "%s" "+$f"
else
printf "%s" "-$f"
@@ -201,7 +205,16 @@ get_features () {
done
}
#}}}
-
+#{{{ get_features
+get_features () {
+ get_config FEAT $@
+}
+#}}}
+#{{{ get_capabilities
+get_capabilities () {
+ get_config HAVE $@
+}
+#}}}
# ======================================================================
@@ -256,7 +269,10 @@ default_hwclockfile=""
default_pidfile="/var/run/chrony/chronyd.pid"
default_rtcdevice="/dev/rtc"
mail_program="/usr/lib/sendmail"
-
+feat_clockadjtime=1
+try_clockadjtime=0
+feat_auxclock=0
+try_auxclock=0
for option
do
case "$option" in
@@ -389,6 +405,12 @@ do
--without-gnutls )
try_gnutls=0
;;
+ --enable-auxclock | --enable-auxclocks )
+ feat_auxclock=1
+ ;;
+ --without-clockadjtime )
+ feat_clockadjtime=0
+ ;;
--host-system=* )
OPERATINGSYSTEM=`echo $option | sed -e 's/^.*=//;'`
;;
@@ -422,6 +444,8 @@ case $OPERATINGSYSTEM in
try_lockmem=1
try_phc=1
try_arc4random=0
+ try_clockadjtime=1
+ try_auxclock=1
add_def LINUX
echo "Configuring for " $SYSTEM
;;
@@ -1032,6 +1056,20 @@ if [ $feat_nts = "1" ] && [ $try_gnutls = "1" ]; then
fi
fi
+if [ $feat_clockadjtime = "1" ] && [ $try_clockadjtime = "1" ] &&
+ test_code 'clock_adjtime()' 'time.h' '' '' \
+ 'struct timex timex0; clock_adjtime (CLOCK_REALTIME, &timex0);'; then
+ add_def HAVE_CLOCK_ADJTIME
+fi
+
+if [ $feat_auxclock = "1" ] && [ $try_auxclock = "1" ] &&
+ [ $(get_capabilities CLOCK_ADJTIME | cut -c 1) = '+' ] &&
+ [ $(get_capabilities CLOCK_GETTIME | cut -c 1) = '+' ] &&
+ test_code 'Linux auxiliary clock support' 'linux/time.h assert.h' '' '' \
+ 'assert (CLOCK_AUX_LAST == (CLOCK_AUX + MAX_AUX_CLOCKS - 1));'; then
+ add_def FEAT_AUXCLOCK
+fi
+
SYSCONFDIR=/etc
if [ "x$SETSYSCONFDIR" != "x" ]; then
SYSCONFDIR=$SETSYSCONFDIR
@@ -1098,7 +1136,7 @@ add_def MAIL_PROGRAM "\"$mail_program\""
common_features="`get_features SECHASH IPV6 DEBUG`"
chronyc_features="`get_features READLINE`"
-chronyd_features="`get_features CMDMON REFCLOCK RTC PRIVDROP SCFILTER SIGND NTS`"
+chronyd_features="`get_features AUXCLOCK CMDMON REFCLOCK RTC PRIVDROP SCFILTER SIGND NTS`"
add_def CHRONYC_FEATURES "\"$chronyc_features $common_features\""
add_def CHRONYD_FEATURES "\"$chronyd_features $common_features\""
echo "Features : $chronyd_features $chronyc_features $common_features"
--
2.34.1
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.