]> git.pld-linux.org Git - packages/cluster-glue.git/blame - x32-long-long-time-types.patch
- fix for time_t and clock_t being long long on x32
[packages/cluster-glue.git] / x32-long-long-time-types.patch
CommitLineData
25b43839
JR
1--- Reusable-Cluster-Components-glue--glue-1.0.11/lib/clplumbing/longclock.c~ 2012-10-15 13:58:55.000000000 +0000
2+++ Reusable-Cluster-Components-glue--glue-1.0.11/lib/clplumbing/longclock.c 2015-01-04 11:29:17.659862030 +0000
3@@ -68,7 +68,7 @@
4 # define TIMES_PARAM &dummy_longclock_tms_struct
5 #endif
6
7-unsigned long
8+unsigned long long
9 cl_times(void) /* Make times(2) behave rationally on Linux */
10 {
11 clock_t ret;
12@@ -114,9 +114,9 @@
13 * because of sign extension.
14 * We do expect sizeof(clock_t) <= sizeof(long), however.
15 */
16- BUILD_BUG_ON(sizeof(clock_t) > sizeof(unsigned long));
17-#define CLOCK_T_MAX (~0UL >> (8*(sizeof(unsigned long) - sizeof(clock_t))))
18- return (unsigned long)ret & CLOCK_T_MAX;
19+ BUILD_BUG_ON(sizeof(clock_t) > sizeof(unsigned long long));
20+#define CLOCK_T_MAX (~0UL >> (8*(sizeof(unsigned long long) - sizeof(clock_t))))
21+ return (unsigned long long)ret & CLOCK_T_MAX;
22 }
23
24 #ifdef CLOCK_T_IS_LONG_ENOUGH
25@@ -143,17 +143,17 @@
26 * because then this can recurse infinitely; that is why the
27 * cl_log call is where it is; found by Simon Graham. */
28 static gboolean calledbefore = FALSE;
29- static unsigned long lasttimes = 0L;
30- static unsigned long callcount = 0L;
31+ static unsigned long long lasttimes = 0L;
32+ static unsigned long long callcount = 0L;
33 static longclock_t lc_wrapcount = 0L;
34- unsigned long timesval;
35+ unsigned long long timesval;
36
37 ++callcount;
38
39 timesval = cl_times();
40
41 if (calledbefore && timesval < lasttimes) {
42- unsigned long jumpbackby = lasttimes - timesval;
43+ unsigned long long jumpbackby = lasttimes - timesval;
44
45 if (jumpbackby < MINJUMP) {
46 /* Kernel weirdness */
47@@ -165,9 +165,9 @@
48 , "%s: old value was %lu"
49 ", new value is %lu, diff is %lu, callcount %lu"
50 , __FUNCTION__
51- , (unsigned long)lasttimes
52- , (unsigned long)timesval
53- , (unsigned long)jumpbackby
54+ , (unsigned long long)lasttimes
55+ , (unsigned long long)timesval
56+ , (unsigned long long)jumpbackby
57 , callcount);
58 /* Assume jump back was the error and ignore it */
59 /* (i.e., hope it goes away) */
60@@ -194,10 +194,10 @@
61 #endif /* ! CLOCK_T_IS_LONG_ENOUGH */
62
63 longclock_t
64-msto_longclock(unsigned long ms)
65+msto_longclock(unsigned long long ms)
66 {
67- unsigned long secs = ms / 1000UL;
68- unsigned long msec = ms % 1000;
69+ unsigned long long secs = ms / 1000UL;
70+ unsigned long long msec = ms % 1000;
71 longclock_t result;
72
73 (void)(Hz == 0 && hz_longclock());
74@@ -214,7 +214,7 @@
75 }
76
77 longclock_t
78-secsto_longclock(unsigned long Secs)
79+secsto_longclock(unsigned long long Secs)
80 {
81 longclock_t secs = Secs;
82
83@@ -232,7 +232,7 @@
84
85 }
86
87-unsigned long
88+unsigned long long
89 longclockto_ms(longclock_t t)
90 {
91 (void)(Hz == 0 && hz_longclock());
92@@ -240,13 +240,13 @@
93 if (t == 0) {
94 return 0UL;
95 }
96- return (unsigned long) ((t*1000UL)/Lc_Hz);
97+ return (unsigned long long) ((t*1000UL)/Lc_Hz);
98 }
99 #ifndef CLOCK_T_IS_LONG_ENOUGH
100-long
101+long long
102 longclockto_long(longclock_t t)
103 {
104- return ((long)(t));
105+ return ((long long)(t));
106 }
107
108 longclock_t
109--- Reusable-Cluster-Components-glue--glue-1.0.11/include/clplumbing/longclock.h~ 2012-10-15 13:58:55.000000000 +0000
110+++ Reusable-Cluster-Components-glue--glue-1.0.11/include/clplumbing/longclock.h 2015-01-04 11:31:06.843191511 +0000
111@@ -79,7 +79,7 @@
112 *
113 * extern const longclock_t zero_longclock;
114 */
115-extern unsigned long cl_times(void);
116+extern unsigned long long cl_times(void);
117
118 #ifdef CLOCK_T_IS_LONG_ENOUGH
119 # ifndef HAVE_LONGCLOCK_ARITHMETIC
120@@ -99,11 +99,11 @@
121 extern const longclock_t zero_longclock;
122
123 unsigned hz_longclock(void);
124-longclock_t secsto_longclock(unsigned long);
125+longclock_t secsto_longclock(unsigned long long);
126 longclock_t dsecsto_longclock(double);
127-longclock_t msto_longclock(unsigned long);
128-unsigned long longclockto_ms(longclock_t); /* Can overflow! */
129-long longclockto_long(longclock_t); /* May overflow! */
130+longclock_t msto_longclock(unsigned long long);
131+unsigned long long longclockto_ms(longclock_t); /* Can overflow! */
132+long long longclockto_long(longclock_t); /* May overflow! */
133
134
135 #ifndef HAVE_LONGCLOCK_ARITHMETIC
136@@ -118,7 +118,7 @@
137
138 #else /* We HAVE_LONGCLOCK_ARITHMETIC */
139
140-# define longclockto_long(lc) ((long)(lc))
141+# define longclockto_long(lc) ((long long)(lc))
142
143 # define add_longclock(l,r) \
144 ((longclock_t)(l) + (longclock_t)(r))
145@@ -136,8 +136,8 @@
146
147 /* N.B: Possibly not the best place for this, but it will do for now */
148 /* This is consistent with OpenBSD, and is a good choice anyway */
149-#define TIME_T unsigned long
150-#define TIME_F "%lu"
151-#define TIME_X "%lx"
152+#define TIME_T unsigned long long
153+#define TIME_F "%llu"
154+#define TIME_X "%llx"
155
156 #endif
157--- Reusable-Cluster-Components-glue--glue-1.0.11/include/clplumbing/cl_log.h~ 2012-10-15 13:58:55.000000000 +0000
158+++ Reusable-Cluster-Components-glue--glue-1.0.11/include/clplumbing/cl_log.h 2015-01-04 11:32:27.326522006 +0000
159@@ -19,7 +19,7 @@
160 # include <glib.h>
161 # include <syslog.h>
162
163-#define TIME_T unsigned long
164+#define TIME_T unsigned long long
165 #define HA_FAIL 0
166 #define HA_OK 1
167 #define MAXLINE (512*10)
This page took 0.124148 seconds and 4 git commands to generate.