diff --git a/src/libpcp/src/derive.c b/src/libpcp/src/derive.c index b94023b..b5e86eb 100644 --- a/src/libpcp/src/derive.c +++ b/src/libpcp/src/derive.c @@ -33,6 +33,7 @@ * metric persists for the life of the application. */ +#include #include "derive.h" static int need_init = 1; @@ -827,11 +828,11 @@ dump_value(int type, pmAtomValue *avp) break; case PM_TYPE_64: - fprintf(stderr, "%lli", (long long)avp->ll); + fprintf(stderr, "%" PRIi64, avp->ll); break; case PM_TYPE_U64: - fprintf(stderr, "%llu", (unsigned long long)avp->ull); + fprintf(stderr, "%" PRIu64, avp->ull); break; case PM_TYPE_FLOAT: diff --git a/src/libpcp/src/derive_fetch.c b/src/libpcp/src/derive_fetch.c index 67be4ec..3a83e60 100644 --- a/src/libpcp/src/derive_fetch.c +++ b/src/libpcp/src/derive_fetch.c @@ -18,6 +18,7 @@ * DERIVE & APPL2 - fetch handling */ +#include #include "derive.h" static void @@ -1064,9 +1065,9 @@ __dmpostfetch(__pmContext *ctxp, pmResult **result) else if (cp->mlist[m].expr->desc.type == PM_TYPE_U32) fprintf(stderr, " u=%u", cp->mlist[m].expr->info->ivlist[k].value.ul); else if (cp->mlist[m].expr->desc.type == PM_TYPE_64) - fprintf(stderr, " ll=%lld", (long long)cp->mlist[m].expr->info->ivlist[k].value.ll); + fprintf(stderr, " ll=%"PRIi64, cp->mlist[m].expr->info->ivlist[k].value.ll); else if (cp->mlist[m].expr->desc.type == PM_TYPE_U64) - fprintf(stderr, " ul=%llu", (unsigned long long)cp->mlist[m].expr->info->ivlist[k].value.ull); + fprintf(stderr, " ul=%"PRIu64, cp->mlist[m].expr->info->ivlist[k].value.ull); else if (cp->mlist[m].expr->desc.type == PM_TYPE_FLOAT) fprintf(stderr, " f=%f", (double)cp->mlist[m].expr->info->ivlist[k].value.f); else if (cp->mlist[m].expr->desc.type == PM_TYPE_DOUBLE) diff --git a/src/libpcp/src/events.c b/src/libpcp/src/events.c index 8fb8b8c..1faa378 100644 --- a/src/libpcp/src/events.c +++ b/src/libpcp/src/events.c @@ -15,6 +15,7 @@ * License for more details. */ +#include #include "pmapi.h" #include "impl.h" @@ -117,11 +118,11 @@ __pmDumpEventRecords(FILE *f, pmValueSet *vsp) break; case PM_TYPE_64: memcpy((void *)&atom.ll, (void *)vbuf, sizeof(atom.ll)); - fprintf(f, " = %lli", (long long)atom.ll); + fprintf(f, " = %"PRIi64, atom.ll); break; case PM_TYPE_U64: memcpy((void *)&atom.ull, (void *)vbuf, sizeof(atom.ull)); - fprintf(f, " = %llu", (unsigned long long)atom.ull); + fprintf(f, " = %"PRIu64, atom.ull); break; case PM_TYPE_FLOAT: memcpy((void *)&atom.f, (void *)vbuf, sizeof(atom.f)); diff --git a/src/libpcp/src/logmeta.c b/src/libpcp/src/logmeta.c index d2937d1..2331c85 100644 --- a/src/libpcp/src/logmeta.c +++ b/src/libpcp/src/logmeta.c @@ -717,9 +717,9 @@ __pmLogPutInDom(__pmLogCtl *lcp, pmInDom indom, const __pmTimeval *tp, wlen += fwrite(&h.len, 1, sizeof(h.len), lcp->l_mdfp); free(stridx); - if (wlen != ntohl(h.len)) { + if (wlen != (int)ntohl(h.len)) { pmprintf("__pmLogPutInDom: wrote %d, expected %d: %s\n", - wlen, ntohl(h.len), osstrerror()); + wlen, (int)ntohl(h.len), osstrerror()); pmflush(); return -oserror(); } diff --git a/src/libpcp/src/logutil.c b/src/libpcp/src/logutil.c index 09ba769..2ad696e 100644 --- a/src/libpcp/src/logutil.c +++ b/src/libpcp/src/logutil.c @@ -12,6 +12,7 @@ * License for more details. */ +#include #include #include "pmapi.h" #include "impl.h" @@ -2150,8 +2151,8 @@ __pmGetArchiveEnd(__pmLogCtl *lcp, struct timeval *tp) if (sizeof(off_t) > sizeof(__pm_off_t)) { if (physend != sbuf.st_size) { __pmNotifyErr(LOG_ERR, "pmGetArchiveEnd: PCP archive file" - " (meta) too big (%lld bytes)\n", - (long long)sbuf.st_size); + " (meta) too big (%"PRIi64" bytes)\n", + (uint64_t)sbuf.st_size); exit(1); } } diff --git a/src/libpcp/src/pdu.c b/src/libpcp/src/pdu.c index b6a1d9c..a83dee3 100644 --- a/src/libpcp/src/pdu.c +++ b/src/libpcp/src/pdu.c @@ -468,9 +468,9 @@ check_read_len: if (len > 0) have += len; if (have >= (int)(sizeof(php->len)+sizeof(php->type)+sizeof(php->from))) - __pmNotifyErr(LOG_ERR, "__pmGetPDU: PDU hdr: len=0x%x type=0x%x from=0x%x", php->len, ntohl(php->type), ntohl(php->from)); + __pmNotifyErr(LOG_ERR, "__pmGetPDU: PDU hdr: len=0x%x type=0x%x from=0x%x", php->len, (unsigned)ntohl(php->type), (unsigned)ntohl(php->from)); else if (have >= (int)(sizeof(php->len)+sizeof(php->type))) - __pmNotifyErr(LOG_ERR, "__pmGetPDU: PDU hdr: len=0x%x type=0x%x", php->len, ntohl(php->type)); + __pmNotifyErr(LOG_ERR, "__pmGetPDU: PDU hdr: len=0x%x type=0x%x", php->len, (unsigned)ntohl(php->type)); return PM_ERR_IPC; } } diff --git a/src/libpcp/src/units.c b/src/libpcp/src/units.c index f3e4020..780155e 100644 --- a/src/libpcp/src/units.c +++ b/src/libpcp/src/units.c @@ -15,6 +15,7 @@ #include "pmapi.h" #include "impl.h" #include +#include #ifndef ABS #define ABS(a) ((a) < 0 ? -(a) : (a)) @@ -46,10 +47,10 @@ pmAtomStr(const pmAtomValue *avp, int type) snprintf(buf, sizeof(buf), "%u", av.ul); break; case PM_TYPE_64: - snprintf(buf, sizeof(buf), "%lld", (long long)av.ll); + snprintf(buf, sizeof(buf), "%"PRIi64, av.ll); break; case PM_TYPE_U64: - snprintf(buf, sizeof(buf), "%llu", (unsigned long long)av.ull); + snprintf(buf, sizeof(buf), "%"PRIu64, av.ull); break; case PM_TYPE_FLOAT: snprintf(buf, sizeof(buf), "%e", (double)av.f); diff --git a/src/libpcp/src/util.c b/src/libpcp/src/util.c index 5a9b24d..9c5d5af 100644 --- a/src/libpcp/src/util.c +++ b/src/libpcp/src/util.c @@ -17,8 +17,9 @@ #include #include -#include +#include #include +#include #include #include "pmapi.h" @@ -527,11 +528,11 @@ pmPrintValue(FILE *f, /* output stream */ break; case PM_TYPE_64: - fprintf(f, "%*lli", minwidth, (long long)a.ll); + fprintf(f, "%*"PRIi64, minwidth, a.ll); break; case PM_TYPE_U64: - fprintf(f, "%*llu", minwidth, (unsigned long long)a.ull); + fprintf(f, "%*"PRIu64, minwidth, a.ull); break; case PM_TYPE_FLOAT: @@ -572,7 +573,7 @@ pmPrintValue(FILE *f, /* output stream */ if (val->value.pval->vlen == PM_VAL_HDR_SIZE + sizeof(__uint64_t)) { __uint64_t i; memcpy((void *)&i, (void *)&val->value.pval->vbuf, sizeof(__uint64_t)); - fprintf(f, "%*llu", minwidth, (unsigned long long)i); + fprintf(f, "%*"PRIu64, minwidth, i); done = 1; } if (val->value.pval->vlen == PM_VAL_HDR_SIZE + sizeof(double)) {