This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgPau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/9931 )
Change subject: stat+vty: fix printing of rate counter values
......................................................................
stat+vty: fix printing of rate counter values
When creating the mgcp statistics (DLCX) and also when printing
values in the VTY. The printf placeholder %lu is used. However,
this is not portable when the same code is compiled on a machine
with different integer size (e.g. armv7).
- Use PRIu64 when printing ->current value of the rate counters
Change-Id: Ifb8944cec83868845f74ad84551eb090f812daf8
---
M src/libosmo-mgcp/mgcp_stat.c
M src/libosmo-mgcp/mgcp_vty.c
2 files changed, 6 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
Pau Espin Pedrol: Looks good to me, approved
diff --git a/src/libosmo-mgcp/mgcp_stat.c b/src/libosmo-mgcp/mgcp_stat.c
index 4072ac0..3685cfe 100644
--- a/src/libosmo-mgcp/mgcp_stat.c
+++ b/src/libosmo-mgcp/mgcp_stat.c
@@ -25,6 +25,7 @@
#include <osmocom/mgcp/mgcp_stat.h>
#include <osmocom/mgcp/mgcp_endp.h>
#include <limits.h>
+#include <inttypes.h>
/* Helper function for mgcp_format_stats_rtp() to calculate packet loss */
void calc_loss(struct mgcp_conn_rtp *conn, uint32_t *expected, int *loss)
@@ -80,7 +81,7 @@
jitter = calc_jitter(&conn->state);
nchars = snprintf(str, str_len,
- "\r\nP: PS=%lu, OS=%lu, PR=%lu, OR=%lu, PL=%d, JI=%u",
+ "\r\nP: PS=%" PRIu64 ", OS=%" PRIu64 ", PR=%" PRIu64 ", OR=%" PRIu64 ", PL=%d, JI=%u",
packets_tx->current, octets_tx->current,
packets_rx->current, octets_rx->current,
ploss, jitter);
@@ -93,7 +94,7 @@
if (conn->conn->endp->cfg->osmux != OSMUX_USAGE_OFF) {
/* Error Counter */
nchars = snprintf(str, str_len,
- "\r\nX-Osmo-CP: EC TI=%lu, TO=%lu",
+ "\r\nX-Osmo-CP: EC TI=%" PRIu64 ", TO=%" PRIu64,
conn->state.in_stream.err_ts_ctr->current,
conn->state.out_stream.err_ts_ctr->current);
if (nchars < 0 || nchars >= str_len)
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index b586ff6..ad462b7 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -30,6 +30,7 @@
#include <osmocom/mgcp/mgcp_endp.h>
#include <string.h>
+#include <inttypes.h>
#define RTCP_OMIT_STR "Drop RTCP packets in both directions\n"
#define RTP_PATCH_STR "Modify RTP packet header in both directions\n"
@@ -164,8 +165,8 @@
dropped_packets = &conn->rate_ctr_group->ctr[RTP_DROPPED_PACKETS_CTR];
vty_out(vty,
- " Timestamp Errs: %lu->%lu%s"
- " Dropped Packets: %lu%s"
+ " Timestamp Errs: %" PRIu64 "->%" PRIu64 "%s"
+ " Dropped Packets: %" PRIu64 "%s"
" Payload Type: %d Rate: %u Channels: %d %s"
" Frame Duration: %u Frame Denominator: %u%s"
" FPP: %d Packet Duration: %u%s"
--
To view, visit https://gerrit.osmocom.org/9931
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb8944cec83868845f74ad84551eb090f812daf8
Gerrit-Change-Number: 9931
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180709/57a1f42c/attachment.htm>