Cast to long for %l in printf

Cast a value to long for %l in printf to avoid compiler warning
on systems where it may be long long.

* count.c (call_summary_pers): Cast to long.
* ipc.c (sys_mq_open, printmqattr): Likewise.
* quota.c (decode_cmd_data): Likewise.
* resource.c (sys_sysinfo): Likewise.
* time.c (tprint_timex): Likewise.
This commit is contained in:
H.J. Lu 2012-02-03 10:16:03 -08:00 committed by Dmitry V. Levin
parent 6ca2610cee
commit 0b315b6543
5 changed files with 22 additions and 19 deletions

View File

@ -193,7 +193,7 @@ call_summary_pers(FILE *outf)
/ tv_float(&tv_cum));
fprintf(outf, "%6.2f %11.6f %11ld %9d %9.9s %s\n",
percent, tv_float(&counts[j].time),
(long) 1000000 * dtv.tv_sec + dtv.tv_usec,
(long) (1000000 * dtv.tv_sec + dtv.tv_usec),
counts[j].calls,
error_str, sysent[j].sys_name);
}

6
ipc.c
View File

@ -482,7 +482,8 @@ sys_mq_open(struct tcb *tcp)
tprints("{ ??? }");
else
tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
attr.mq_maxmsg, attr.mq_msgsize);
(long) attr.mq_maxmsg,
(long) attr.mq_msgsize);
# endif
}
}
@ -541,7 +542,8 @@ printmqattr(struct tcb *tcp, long addr)
tprints("{mq_flags=");
tprint_open_modes(attr.mq_flags);
tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
(long) attr.mq_maxmsg, (long) attr.mq_msgsize,
(long) attr.mq_curmsgs);
# endif
}
}

View File

@ -380,8 +380,8 @@ decode_cmd_data(struct tcb *tcp, u_int32_t cmd, unsigned long data)
tprintf("ihardlimit=%u, ", dq.dqb_ihardlimit);
tprintf("isoftlimit=%u, ", dq.dqb_isoftlimit);
tprintf("curinodes=%u, ", dq.dqb_curinodes);
tprintf("btime=%lu, ", dq.dqb_btime);
tprintf("itime=%lu}", dq.dqb_itime);
tprintf("btime=%lu, ", (long) dq.dqb_btime);
tprintf("itime=%lu}", (long) dq.dqb_itime);
break;
}
case Q_V2_GETQUOTA:
@ -403,8 +403,8 @@ decode_cmd_data(struct tcb *tcp, u_int32_t cmd, unsigned long data)
tprintf("bhardlimit=%u, ", dq.dqb_bhardlimit);
tprintf("bsoftlimit=%u, ", dq.dqb_bsoftlimit);
tprintf("curspace=%" PRIu64 ", ", dq.dqb_curspace);
tprintf("btime=%lu, ", dq.dqb_btime);
tprintf("itime=%lu}", dq.dqb_itime);
tprintf("btime=%lu, ", (long) dq.dqb_btime);
tprintf("itime=%lu}", (long) dq.dqb_itime);
break;
}
case Q_XGETQUOTA:

View File

@ -399,14 +399,15 @@ sys_sysinfo(struct tcb *tcp)
tprints("{...}");
else {
tprintf("{uptime=%lu, loads=[%lu, %lu, %lu] ",
si.uptime, si.loads[0], si.loads[1],
si.loads[2]);
(long) si.uptime, (long) si.loads[0],
(long) si.loads[1], (long) si.loads[2]);
tprintf("totalram=%lu, freeram=%lu, ",
si.totalram, si.freeram);
(long) si.totalram, (long) si.freeram);
tprintf("sharedram=%lu, bufferram=%lu} ",
si.sharedram, si.bufferram);
(long) si.sharedram, (long) si.bufferram);
tprintf("totalswap=%lu, freeswap=%lu, procs=%hu}",
si.totalswap, si.freeswap, si.procs);
(long) si.totalswap, (long) si.freeswap,
si.procs);
}
}
return 0;

14
time.c
View File

@ -580,19 +580,19 @@ tprint_timex(struct tcb *tcp, long addr)
tprints("{modes=");
printflags(adjtimex_modes, tx.modes, "ADJ_???");
tprintf(", offset=%ld, freq=%ld, maxerror=%ld, ",
tx.offset, tx.freq, tx.maxerror);
tprintf("esterror=%lu, status=", tx.esterror);
(long) tx.offset, (long) tx.freq, (long) tx.maxerror);
tprintf("esterror=%lu, status=", (long) tx.esterror);
printflags(adjtimex_status, tx.status, "STA_???");
tprintf(", constant=%ld, precision=%lu, ",
tx.constant, tx.precision);
tprintf("tolerance=%ld, time=", tx.tolerance);
(long) tx.constant, (long) tx.precision);
tprintf("tolerance=%ld, time=", (long) tx.tolerance);
tprint_timeval(tcp, &tx.time);
tprintf(", tick=%ld, ppsfreq=%ld, jitter=%ld",
tx.tick, tx.ppsfreq, tx.jitter);
(long) tx.tick, (long) tx.ppsfreq, (long) tx.jitter);
tprintf(", shift=%d, stabil=%ld, jitcnt=%ld",
tx.shift, tx.stabil, tx.jitcnt);
tx.shift, (long) tx.stabil, (long) tx.jitcnt);
tprintf(", calcnt=%ld, errcnt=%ld, stbcnt=%ld",
tx.calcnt, tx.errcnt, tx.stbcnt);
(long) tx.calcnt, (long) tx.errcnt, (long) tx.stbcnt);
#endif
tprints("}");
return 0;