Merge pull request #318 from nettlep/master
A few updates to enable building on Raspberry PI/Ubuntu 16.04
diff --git a/src/event/event_epoll.c b/src/event/event_epoll.c
index db8626e..97b4bba 100644
--- a/src/event/event_epoll.c
+++ b/src/event/event_epoll.c
@@ -419,7 +419,7 @@
if (target < INT64_MAX) {
struct itimerspec its = { .it_value = {
- .tv_sec = target / NSEC_PER_SEC,
+ .tv_sec = (time_t)(target / NSEC_PER_SEC),
.tv_nsec = target % NSEC_PER_SEC,
} };
dispatch_assume_zero(timerfd_settime(timer->det_fd, TFD_TIMER_ABSTIME,
diff --git a/src/source.c b/src/source.c
index 6b97507..3f9caee 100644
--- a/src/source.c
+++ b/src/source.c
@@ -2023,7 +2023,7 @@
_dispatch_source_timer_data(dispatch_source_t ds, dispatch_unote_t du)
{
dispatch_timer_source_refs_t dr = du._dt;
- unsigned long data, prev, clear_prev = 0;
+ uint64_t data, prev, clear_prev = 0;
os_atomic_rmw_loop2o(ds, ds_pending_data, prev, clear_prev, relaxed, {
data = prev >> 1;
@@ -2031,7 +2031,7 @@
os_atomic_rmw_loop_give_up(goto handle_missed_intervals);
}
});
- return data;
+ return (unsigned long)data;
handle_missed_intervals:
// The timer may be in _dispatch_source_invoke2() already for other
@@ -2046,7 +2046,7 @@
uint64_t now = _dispatch_time_now(DISPATCH_TIMER_CLOCK(dr->du_ident));
if (now >= dr->dt_timer.target) {
OS_COMPILER_CAN_ASSUME(dr->dt_timer.interval < INT64_MAX);
- data = _dispatch_source_timer_compute_missed(dr, now, data);
+ data = _dispatch_source_timer_compute_missed(dr, now, (unsigned long)data);
}
// When we see the MISSED_MARKER the manager has given up on this timer
@@ -2059,7 +2059,7 @@
// on the manager and make the changes to `ds_timer` above visible.
_dispatch_queue_atomic_flags_clear(ds->_as_dq, DSF_ARMED);
os_atomic_store2o(ds, ds_pending_data, 0, relaxed);
- return data;
+ return (unsigned long)data;
}
static inline void
diff --git a/tests/dispatch_starfish.c b/tests/dispatch_starfish.c
index 3609f71..b866252 100644
--- a/tests/dispatch_starfish.c
+++ b/tests/dispatch_starfish.c
@@ -72,7 +72,7 @@
printf("lap: %zd\n", lap_count_down);
printf("count: %lu\n", COUNT);
- printf("delta: %lu ns\n", delta);
+ printf("delta: %lu ns\n", (unsigned long)delta);
printf("math: %Lf ns / lap\n", math);
for (i = 0; i < COUNT; i++) {
diff --git a/tests/dispatch_timer.c b/tests/dispatch_timer.c
index aeb91b2..5119b05 100644
--- a/tests/dispatch_timer.c
+++ b/tests/dispatch_timer.c
@@ -63,8 +63,8 @@
dispatch_source_set_event_handler(s, ^{
if (!finalized) {
- test_long_less_than("timer number", j, stop_at);
- fprintf(stderr, "timer[%lu]\n", j);
+ test_long_less_than("timer number", (long)j, stop_at);
+ fprintf(stderr, "timer[%lu]\n", (unsigned long)j);
}
dispatch_release(s);
});