osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/40866?usp=email )
Change subject: Fix time_t prints for debian 13 armv7l ......................................................................
Fix time_t prints for debian 13 armv7l
In Debian 13 armv7l, time_t and suseconds_t are "long long int" instead of "long unsigned int" as seen on x86_64 and aarch64. Fix it by casting to "long unsigned int".
Related: OS#6828 Change-Id: I0b29930a8797fbf0c9d8bfde40bcef9702629834 --- M examples/ipa-stream-client.c M src/jibuf.c M tests/jibuf/jibuf_test.c M tests/jibuf/jibuf_tool.c M tests/osmo-pcap-test/pcap.c M tests/osmux/osmux_input_test.c M tests/osmux/osmux_output_test.c M tests/osmux/osmux_test.c M tests/stream/stream_test.c 9 files changed, 26 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/66/40866/1
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c index 2604266..cd2e936 100644 --- a/examples/ipa-stream-client.c +++ b/examples/ipa-stream-client.c @@ -131,8 +131,8 @@ gettimeofday(&tv, NULL); timersub(&tv, &found->tv, &diff);
- LOGP(DLINP, LOGL_NOTICE, "message %d replied " - "in %lu.%.6lu\n", num, diff.tv_sec, diff.tv_usec); + LOGP(DLINP, LOGL_NOTICE, "message %d replied in %lu.%.6lu\n", num, + (unsigned int long) diff.tv_sec, (unsigned int long) diff.tv_usec); talloc_free(found); } else { LOGP(DLINP, LOGL_ERROR, diff --git a/src/jibuf.c b/src/jibuf.c index a351248..4f93cda 100644 --- a/src/jibuf.c +++ b/src/jibuf.c @@ -388,8 +388,9 @@ LOGP(DLJIBUF, LOGL_DEBUG, "enqueuing packet seq=%"PRIu16" rel=%d delay=%d" \ " skew=%d thres=%d {%lu.%06lu -> %lu.%06lu} %s\n", msg_get_sequence(msg), rel_delay, delay, jb->skew_us, jb->threshold_delay, - jb->last_enqueue_time.tv_sec, jb->last_enqueue_time.tv_usec, - sched_ts.tv_sec, sched_ts.tv_usec, msg_get_marker(msg)? "M" : ""); + (unsigned int long) jb->last_enqueue_time.tv_sec, (unsigned int long) jb->last_enqueue_time.tv_usec, + (unsigned int long) sched_ts.tv_sec, (unsigned int long) sched_ts.tv_usec, + msg_get_marker(msg) ? "M" : "");
/* Add scheduled dequeue time in msg->cb so we can check it later */ unsigned long *old_cb = talloc_memdup(jb->talloc_ctx, msg->cb, sizeof(msg->cb)); diff --git a/tests/jibuf/jibuf_test.c b/tests/jibuf/jibuf_test.c index 7643797..9a19d9a 100644 --- a/tests/jibuf/jibuf_test.c +++ b/tests/jibuf/jibuf_test.c @@ -106,7 +106,8 @@ osmo_clock_gettime(CLOCK_MONOTONIC, &ts); osmo_gettimeofday(&tv, NULL); printf("sys={%lu.%06lu}, mono={%lu.%06lu}: %s\n", - tv.tv_sec, tv.tv_usec, ts.tv_sec, ts.tv_nsec/1000, str); + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec, + (unsigned int long) ts.tv_sec, ts.tv_nsec/1000, str); }
static void clock_override_enable(bool enable) diff --git a/tests/jibuf/jibuf_tool.c b/tests/jibuf/jibuf_tool.c index 0502a98..875f0d5 100644 --- a/tests/jibuf/jibuf_tool.c +++ b/tests/jibuf/jibuf_tool.c @@ -168,7 +168,7 @@ LOGP(DLJIBUF, LOGL_DEBUG, "%s: seq=%"PRIu16" ts=%"PRIu32" (%ld.%06ld) tx_delay=%"PRIu32 \ " end_delay=%"PRIu32" pre_trans=%d pre_jitter=%f post_trans=%d post_jitter=%f skew=%"PRId32"\n", info, ntohs(rtph->sequence), ntohl(rtph->timestamp), - pinfo->tx_time.tv_sec, pinfo->tx_time.tv_usec, + (unsigned int long) pinfo->tx_time.tv_sec, (unsigned int long) pinfo->tx_time.tv_usec, pinfo->tx_delay, total_delay_ms, pinfo->prequeue.transit, pinfo->prequeue.jitter, pinfo->postqueue.transit, pinfo->postqueue.jitter, pinfo->skew_us); @@ -179,7 +179,7 @@ " pre_trans=%d pre_jitter=%f post_trans=%d post_jitter=%f dropped=%"PRIu32 \ " buffer=%"PRIu32"\n", ntohs(rtph->sequence), ntohl(rtph->timestamp), - pinfo->tx_time.tv_sec, pinfo->tx_time.tv_usec, + (unsigned int long) pinfo->tx_time.tv_sec, (unsigned int long) pinfo->tx_time.tv_usec, pinfo->tx_delay, total_delay_ms, pinfo->prequeue.transit, pinfo->prequeue.jitter, pinfo->postqueue.transit, pinfo->postqueue.jitter, diff --git a/tests/osmo-pcap-test/pcap.c b/tests/osmo-pcap-test/pcap.c index a67b121..2c18687 100644 --- a/tests/osmo-pcap-test/pcap.c +++ b/tests/osmo-pcap-test/pcap.c @@ -181,7 +181,7 @@ timersub(&elapsed_pcap, &elapsed_sys, &res); } printf("next packet comes in %lu.%.6lu seconds\n", - res.tv_sec, res.tv_usec); + (unsigned int long) res.tv_sec, (unsigned int long) res.tv_usec); osmo_timer_schedule(&p->timer, res.tv_sec, res.tv_usec);
return 0; diff --git a/tests/osmux/osmux_input_test.c b/tests/osmux/osmux_input_test.c index df02423..327d174 100644 --- a/tests/osmux/osmux_input_test.c +++ b/tests/osmux/osmux_input_test.c @@ -116,7 +116,8 @@ osmo_clock_gettime(CLOCK_MONOTONIC, &ts); \ osmo_gettimeofday(&tv, NULL); \ fprintf(stdout, "sys={%lu.%06lu}, mono={%lu.%06lu}: " fmt "\n", \ - tv.tv_sec, tv.tv_usec, ts.tv_sec, ts.tv_nsec/1000, ##args); \ + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec, \ + (unsigned int long) ts.tv_sec, ts.tv_nsec/1000, ##args); \ } while (0)
static void clock_override_enable(bool enable) diff --git a/tests/osmux/osmux_output_test.c b/tests/osmux/osmux_output_test.c index 94d6a5b..a492379 100644 --- a/tests/osmux/osmux_output_test.c +++ b/tests/osmux/osmux_output_test.c @@ -101,7 +101,8 @@ osmo_clock_gettime(CLOCK_MONOTONIC, &ts); osmo_gettimeofday(&tv, NULL); printf("sys={%lu.%06lu}, mono={%lu.%06lu}: %s\n", - tv.tv_sec, tv.tv_usec, ts.tv_sec, ts.tv_nsec/1000, str); + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec, + (unsigned int long) ts.tv_sec, ts.tv_nsec/1000, str); }
static void clock_override_enable(bool enable) diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c index f80902d..426ecb2 100644 --- a/tests/osmux/osmux_test.c +++ b/tests/osmux/osmux_test.c @@ -63,7 +63,8 @@ osmo_clock_gettime(CLOCK_MONOTONIC, &ts); \ osmo_gettimeofday(&tv, NULL); \ fprintf(stderr, "sys={%lu.%06lu}, mono={%lu.%06lu}: " fmt, \ - tv.tv_sec, tv.tv_usec, ts.tv_sec, ts.tv_nsec/1000, ##args); \ + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec, \ + (unsigned int long) ts.tv_sec, ts.tv_nsec/1000, ##args); \ } while(0)
static void clock_override_enable(bool enable) diff --git a/tests/stream/stream_test.c b/tests/stream/stream_test.c index f2f1d4f..f23bb5b 100644 --- a/tests/stream/stream_test.c +++ b/tests/stream/stream_test.c @@ -65,7 +65,8 @@ #define LOGCLI(cli, fmt, args...) do { \ struct timeval tv; \ osmo_gettimeofday(&tv, NULL); \ - printf("{%lu.%06lu} [%s] Client's %s(): " fmt, tv.tv_sec, tv.tv_usec, \ + printf("{%lu.%06lu} [%s] Client's %s(): " fmt, \ + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec, \ osmo_stream_cli_get_data(cli) ? "OK" : "NA", __func__, ##args); \ } while (0)
@@ -243,7 +244,8 @@ #define LOGSRV(srv, fmt, args...) do { \ struct timeval tv; \ osmo_gettimeofday(&tv, NULL); \ - printf("{%lu.%06lu} [%s|%s] Server's %s(): " fmt, tv.tv_sec, tv.tv_usec, \ + printf("{%lu.%06lu} [%s|%s] Server's %s(): " fmt, \ + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec, \ osmo_stream_srv_get_data(srv) ? "OK" : "NA", \ osmo_stream_srv_link_get_data(osmo_stream_srv_get_master(srv)) ? "OK" : "NA", \ __func__, ##args); \ @@ -364,21 +366,24 @@ osmo_select_main(0); osmo_gettimeofday(&tv, NULL); fprintf(stderr, "\n{%lu.%06lu} %s test step %u [client %s, server %s], FD reg %u\n", - tv.tv_sec, tv.tv_usec, ASTR(autoreconnect), steps, + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec, + ASTR(autoreconnect), steps, osmo_stream_cli_get_data(cli) ? "OK" : "NA", osmo_stream_srv_link_get_data(lnk) ? "OK" : "NA", osmo_fd_is_registered(osmo_stream_cli_get_ofd(cli)));
if (test_stop_requested(lnk)) { printf("{%lu.%06lu} Server requested test termination\n", - tv.tv_sec, tv.tv_usec); + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec); steps = 0; } }
osmo_stream_cli_destroy(cli); osmo_stream_srv_link_close(lnk); - printf("{%lu.%06lu} %s test complete.\n\n", tv.tv_sec, tv.tv_usec, ASTR(autoreconnect)); + printf("{%lu.%06lu} %s test complete.\n\n", + (unsigned int long) tv.tv_sec, (unsigned int long) tv.tv_usec, + ASTR(autoreconnect)); }
/* Segmentation test code (using IPA) */