[Debian-ha-commits] [cluster-glue] 01/02: Fix cl_times on x32

Christoph Berg myon at debian.org
Thu Apr 7 21:32:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

myon pushed a commit to branch master
in repository cluster-glue.

commit 0ad97d373d71037b9f4b2782616b8383c032d013
Author: Christoph Berg <myon at debian.org>
Date:   Thu Apr 7 23:28:14 2016 +0200

    Fix cl_times on x32
    
    On x32, sizeof(long) is 4, and sizeof(clock_t) is 8. cl_times as logic
    to reject that case. We fix this by setting the return type of the
    function to long long instead on x32.
---
 debian/changelog            |  3 +++
 debian/patches/series       |  1 +
 debian/patches/x32-cl_times | 48 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index b973761..bcb524d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ cluster-glue (1.0.12-4) UNRELEASED; urgency=medium
 
   * libplumb2.symbols: Update hurd-specific symbols to match kfreebsd as well.
   * Remove obsolete Conflicts/Replaces against heartbeat. Closes: #820221.
+  * Fix cl_times on x32: On x32, sizeof(long) is 4, and sizeof(clock_t) is 8.
+    cl_times as logic to reject that case. We fix this by setting the return
+    type of the function to long long instead on x32.
 
  -- Christoph Berg <myon at debian.org>  Thu, 31 Mar 2016 18:43:53 +0200
 
diff --git a/debian/patches/series b/debian/patches/series
index 4d9eb43..1f3d889 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
 0005-Remove-.hgsigs-from-source.patch
 kfbsd.diff
 hurd.diff
+x32-cl_times
diff --git a/debian/patches/x32-cl_times b/debian/patches/x32-cl_times
new file mode 100644
index 0000000..798a1e8
--- /dev/null
+++ b/debian/patches/x32-cl_times
@@ -0,0 +1,48 @@
+Fix cl_times on x32
+
+On x32, sizeof(long) is 4, and sizeof(clock_t) is 8. cl_times as logic to
+reject that case. We fix this by setting the return type of the function to
+long long instead on x32.
+
+--- a/include/clplumbing/longclock.h
++++ b/include/clplumbing/longclock.h
+@@ -79,7 +79,11 @@
+  *
+  *	extern const longclock_t	zero_longclock;
+  */
++#if __ILP32__ && __x86_64__
++extern unsigned long long cl_times(void);
++#else
+ extern unsigned long cl_times(void);
++#endif
+ 
+ #ifdef CLOCK_T_IS_LONG_ENOUGH
+ #	ifndef	HAVE_LONGCLOCK_ARITHMETIC
+--- a/lib/clplumbing/longclock.c
++++ b/lib/clplumbing/longclock.c
+@@ -68,7 +68,11 @@ hz_longclock(void)
+ #	define	TIMES_PARAM	&dummy_longclock_tms_struct
+ #endif
+ 
++#if __ILP32__ && __x86_64__
++unsigned long long
++#else
+ unsigned long
++#endif
+ cl_times(void)	/* Make times(2) behave rationally on Linux */
+ {
+ 	clock_t		ret;
+@@ -114,9 +118,13 @@ cl_times(void)	/* Make times(2) behave r
+ 	 * because of sign extension.
+ 	 * We do expect sizeof(clock_t) <= sizeof(long), however.
+ 	 */
++#if __ILP32__ && __x86_64__
++	return ret;
++#else
+ 	BUILD_BUG_ON(sizeof(clock_t) > sizeof(unsigned long));
+ #define CLOCK_T_MAX	(~0UL >> (8*(sizeof(unsigned long) - sizeof(clock_t))))
+ 	return (unsigned long)ret & CLOCK_T_MAX;
++#endif
+ }
+ 
+ #ifdef CLOCK_T_IS_LONG_ENOUGH

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/cluster-glue.git



More information about the Debian-HA-Commits mailing list