[packages/chrony] - rel 2; use system headers to fix: adjtimex failed for set_frequency, freq_ppm... error (https://bu

arekm arekm at pld-linux.org
Thu Feb 19 18:16:17 CET 2015


commit 7fd7bb6b89aabfabef369a53fb913613a0ea07d5
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Feb 19 18:16:12 2015 +0100

    - rel 2; use system headers to fix: adjtimex failed for set_frequency, freq_ppm... error (https://bugs.mageia.org/show_bug.cgi?id=15174)

 chrony-sysheaders.patch | 119 ++++++++++++++++++++++++++++++++++++++++++++++++
 chrony.spec             |   4 +-
 2 files changed, 122 insertions(+), 1 deletion(-)
---
diff --git a/chrony.spec b/chrony.spec
index ef1e1f1..eea9457 100644
--- a/chrony.spec
+++ b/chrony.spec
@@ -1,7 +1,7 @@
 Summary:	An NTP client/server
 Name:		chrony
 Version:	1.31
-Release:	1
+Release:	2
 License:	GPL v2
 Group:		Daemons
 URL:		http://chrony.tuxfamily.org/
@@ -13,6 +13,7 @@ Source3:	%{name}d.sysconfig
 Source4:	%{name}d.init
 Source5:	%{name}.logrotate
 Source6:	%{name}d.upstart
+Patch0:		chrony-sysheaders.patch
 BuildRequires:	bison
 BuildRequires:	libcap-devel
 BuildRequires:	nss-devel
@@ -47,6 +48,7 @@ in permanently connected environments.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %{__sed} -i -e 's,/usr/local,%{_prefix},g' *.texi.in
 
diff --git a/chrony-sysheaders.patch b/chrony-sysheaders.patch
new file mode 100644
index 0000000..ee0cfa1
--- /dev/null
+++ b/chrony-sysheaders.patch
@@ -0,0 +1,119 @@
+diff -urN chrony-1.31.org/chrony_timex.h chrony-1.31/chrony_timex.h
+--- chrony-1.31.org/chrony_timex.h	2014-09-10 17:00:54.000000000 +0200
++++ chrony-1.31/chrony_timex.h	1970-01-01 01:00:00.000000000 +0100
+@@ -1,73 +0,0 @@
+-/* Taken from /usr/include/linux/timex.h.  Avoids the need to
+- * include kernel header files. */
+-
+-#ifndef CHRONY_TIMEX_H
+-#define CHRONY_TIMEX_H
+-
+-#include <sys/time.h>
+-
+-struct timex {
+-	unsigned int modes;	/* mode selector */
+-	long offset;		/* time offset (usec) */
+-	long freq;		/* frequency offset (scaled ppm) */
+-	long maxerror;		/* maximum error (usec) */
+-	long esterror;		/* estimated error (usec) */
+-	int status;		/* clock command/status */
+-	long constant;		/* pll time constant */
+-	long precision;		/* clock precision (usec) (read only) */
+-	long tolerance;		/* clock frequency tolerance (ppm)
+-				 * (read only)
+-				 */
+-	struct timeval time;	/* (read only) */
+-	long tick;		/* (modified) usecs between clock ticks */
+-
+-	long ppsfreq;           /* pps frequency (scaled ppm) (ro) */
+-	long jitter;            /* pps jitter (us) (ro) */
+-	int shift;              /* interval duration (s) (shift) (ro) */
+-	long stabil;            /* pps stability (scaled ppm) (ro) */
+-	long jitcnt;            /* jitter limit exceeded (ro) */
+-	long calcnt;            /* calibration intervals (ro) */
+-	long errcnt;            /* calibration errors (ro) */
+-	long stbcnt;            /* stability limit exceeded (ro) */
+-
+-	int  :32; int  :32; int  :32; int  :32;
+-	int  :32; int  :32; int  :32; int  :32;
+-	int  :32; int  :32; int  :32; int  :32;
+-};
+-
+-#define ADJ_OFFSET		0x0001  /* time offset */
+-#define ADJ_FREQUENCY		0x0002	/* frequency offset */
+-#define ADJ_MAXERROR		0x0004	/* maximum time error */
+-#define ADJ_STATUS		0x0010	/* clock status */
+-#define ADJ_TIMECONST		0x0020  /* pll time constant */
+-#define ADJ_SETOFFSET		0x0100  /* add 'time' to current time */
+-#define ADJ_NANO		0x2000  /* select nanosecond resolution */
+-#define ADJ_TICK		0x4000	/* tick value */
+-#define ADJ_OFFSET_SINGLESHOT	0x8001	/* old-fashioned adjtime */
+-#define ADJ_OFFSET_SS_READ	0xa001  /* read-only adjtime */
+-
+-#define SHIFT_USEC 16		/* frequency offset scale (shift) */
+-
+-#define STA_PLL		0x0001	/* enable PLL updates (rw) */
+-#define STA_PPSFREQ	0x0002	/* enable PPS freq discipline (rw) */
+-#define STA_PPSTIME	0x0004	/* enable PPS time discipline (rw) */
+-#define STA_FLL		0x0008	/* select frequency-lock mode (rw) */
+-
+-#define STA_INS		0x0010	/* insert leap (rw) */
+-#define STA_DEL		0x0020	/* delete leap (rw) */
+-#define STA_UNSYNC	0x0040	/* clock unsynchronized (rw) */
+-#define STA_FREQHOLD	0x0080	/* hold frequency (rw) */
+-
+-#define STA_PPSSIGNAL	0x0100	/* PPS signal present (ro) */
+-#define STA_PPSJITTER	0x0200	/* PPS signal jitter exceeded (ro) */
+-#define STA_PPSWANDER	0x0400	/* PPS signal wander exceeded (ro) */
+-#define STA_PPSERROR	0x0800	/* PPS signal calibration error (ro) */
+-
+-#define STA_CLOCKERR	0x1000	/* clock hardware fault (ro) */
+-#define STA_NANO	0x2000  /* resolution (0 = us, 1 = ns) (ro) */
+-
+-/* This doesn't seem to be in any include files !! */
+-
+-extern int adjtimex(struct timex *);
+-
+-#endif /* CHRONY_TIMEX_H */
+diff -urN chrony-1.31.org/wrap_adjtimex.c chrony-1.31/wrap_adjtimex.c
+--- chrony-1.31.org/wrap_adjtimex.c	2014-09-10 17:00:54.000000000 +0200
++++ chrony-1.31/wrap_adjtimex.c	2015-02-19 18:14:48.994437746 +0100
+@@ -22,18 +22,33 @@
+ 
+   =======================================================================
+ 
+-  This is a wrapper around the Linux adjtimex system call.  It isolates the
+-  inclusion of <linux/adjtimex.h> from the need to include other header files,
+-  many of which conflict with those in <linux/...> on some recent distributions
+-  (as of Jul 2000) using kernels around 2.2.16 onwards.
++  This is a wrapper around the Linux adjtimex system call.
+ 
+   */
+ 
+ #include "config.h"
+ 
+-#include "chrony_timex.h"
+ #include "wrap_adjtimex.h"
+ 
++#include <sys/timex.h>
++
++/* Definitions used if missing in the system headers */
++#ifndef ADJ_TAI
++#define ADJ_TAI                 0x0080  /* set TAI offset */
++#endif
++#ifndef ADJ_SETOFFSET
++#define ADJ_SETOFFSET           0x0100  /* add 'time' to current time */
++#endif
++#ifndef ADJ_NANO
++#define ADJ_NANO                0x2000  /* select nanosecond resolution */
++#endif
++#ifndef ADJ_OFFSET_SS_READ
++#define ADJ_OFFSET_SS_READ      0xa001  /* read-only adjtime */
++#endif
++
++/* Frequency offset scale (shift) */
++#define SHIFT_USEC 16
++
+ static int status = 0;
+ 
+ int
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/chrony.git/commitdiff/7fd7bb6b89aabfabef369a53fb913613a0ea07d5



More information about the pld-cvs-commit mailing list