On 08/14/2009 03:19 AM, George Dunlap wrote:
> Hmm, that won't do; with this patch it won't compile on x86-32. :-)
>
> I'll take a look and see what the best solution is. Thanks for the patch!
>
This should fix it properly. The key is to use the "z" format modifier
meaning "size_t".
J
Fix 64-bit compilation
This fixes 64-bit compilation by using the 'z' printf format modifier
to tell the compiler we're using size_t-typed arguments, and explicitly
casting loff_t types to unsigned long long to match the format.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
diff -r 6466afa95122 -r 4efef3092ce7 dump-raw.c
--- a/dump-raw.c Mon Nov 30 12:43:09 2009 -0600
+++ b/dump-raw.c Fri Apr 30 12:56:57 2010 -0700
@@ -94,7 +94,7 @@
return 0;
} else if(r < sizeof(uint32_t)) {
/* Full header not read */
- fprintf(stderr, "%s: short read (%d bytes)\n",
+ fprintf(stderr, "%s: short read (%zd bytes)\n",
__func__, r);
exit(1);
}
@@ -103,7 +103,7 @@
if(r < rsize) {
/* Full record not read */
- fprintf(stderr, "%s: short read (%d, expected %d)\n",
+ fprintf(stderr, "%s: short read (%zd, expected %zd)\n",
__func__, r, rsize);
return 0;
}
@@ -146,7 +146,8 @@
/* File sanity check */
if(p->file_offset != p->next_cpu_change_offset) {
printf("Strange, pcpu %d expected offet %llx, actual %llx!\n",
- p->pid, p->next_cpu_change_offset, p->file_offset);
+ p->pid, (unsigned long long)p->next_cpu_change_offset,
+ (unsigned long long)p->file_offset);
}
p->next_cpu_change_offset = p->file_offset + ri->size + r->window_size;
@@ -159,7 +160,7 @@
int i;
printf("R p%2d o%016llx %8lx %d ",
- p->pid, p->file_offset,
+ p->pid, (unsigned long long)p->file_offset,
(unsigned long)ri->rec.event, ri->rec.extra_words);
if(ri->rec.cycle_flag)
diff -r 6466afa95122 -r 4efef3092ce7 xenalyze.c
--- a/xenalyze.c Mon Nov 30 12:43:09 2009 -0600
+++ b/xenalyze.c Fri Apr 30 12:56:57 2010 -0700
@@ -1328,7 +1328,7 @@
if(h->summary.extint_histogram)
bzero(h->summary.extint_histogram, size);
else {
- fprintf(stderr, "FATAL: Could not allocate %d bytes for interrupt
histogram!\n",
+ fprintf(stderr, "FATAL: Could not allocate %zd bytes for interrupt
histogram!\n",
size);
exit(1);
}
@@ -4062,7 +4062,7 @@
if(ri->extra_words != (sizeof(*r)/sizeof(unsigned long) + 1))
{
- fprintf(warn, "FATAL: msr_write extra_words %d, expected %d!\n",
+ fprintf(warn, "FATAL: msr_write extra_words %d, expected %zd!\n",
ri->extra_words, sizeof(*r)/sizeof(unsigned long));
dump_unexpected_and_exit(ri);
}
@@ -4111,7 +4111,7 @@
if(ri->extra_words != (sizeof(*r)/sizeof(unsigned long) + 1))
{
- fprintf(warn, "FATAL: msr_read extra_words %d, expected %d!\n",
+ fprintf(warn, "FATAL: msr_read extra_words %d, expected %zd!\n",
ri->extra_words, sizeof(*r)/sizeof(unsigned long));
dump_unexpected_and_exit(ri);
}
@@ -5152,7 +5152,7 @@
case 2:
if(sizeof(r->gpl2) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl2), h->v->guest_paging_levels,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5166,7 +5166,7 @@
case 3:
if(sizeof(r->gpl3) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl3), h->v->guest_paging_levels,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5180,7 +5180,7 @@
case 4:
if(sizeof(r->gpl4) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl4), h->v->guest_paging_levels,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5252,7 +5252,7 @@
case 2:
if(sizeof(r->gpl2) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl2), rec_gpl,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5268,7 +5268,7 @@
case 3:
if(sizeof(r->gpl3) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl3), rec_gpl,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5280,7 +5280,7 @@
case 4:
if(sizeof(r->gpl4) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl4), rec_gpl,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5469,7 +5469,7 @@
case 2:
if(sizeof(r->gpl2) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl2), h->v->guest_paging_levels,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5482,7 +5482,7 @@
case 3:
if(sizeof(r->gpl3) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl3), h->v->guest_paging_levels,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5495,7 +5495,7 @@
case 4:
if(sizeof(r->gpl4) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl4), h->v->guest_paging_levels,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5583,7 +5583,7 @@
case 3:
if(sizeof(r->gpl2) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl2), h->v->guest_paging_levels,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -5594,7 +5594,7 @@
case 4:
if(sizeof(r->gpl4) != ri->extra_words * 4)
{
- fprintf(warn, "%s: expected %d bytes for %d-level guest, got
%d!\n",
+ fprintf(warn, "%s: expected %zd bytes for %d-level guest, got
%d!\n",
__func__, sizeof(r->gpl4), h->v->guest_paging_levels,
ri->extra_words * 4);
dump_unexpected_and_exit(ri);
@@ -6106,7 +6106,7 @@
if((v=malloc(sizeof(*v)))==NULL)
{
- fprintf(stderr, "%s: malloc %d failed!\n", __func__, sizeof(*d));
+ fprintf(stderr, "%s: malloc %zd failed!\n", __func__, sizeof(*d));
exit(1);
}
@@ -6148,7 +6148,7 @@
if((d=malloc(sizeof(*d)))==NULL)
{
- fprintf(stderr, "%s: malloc %d failed!\n", __func__, sizeof(*d));
+ fprintf(stderr, "%s: malloc %zd failed!\n", __func__, sizeof(*d));
exit(1);
}
@@ -7145,7 +7145,7 @@
struct pcpu_info *p = P.pcpu + cd->cpu;
fprintf(warn, "%s: Activating pcpu %d at offset %lld\n",
- __func__, cd->cpu, offset);
+ __func__, cd->cpu, (unsigned long long)offset);
p->active = 1;
/* Process this cpu_change record first */
@@ -7220,7 +7220,8 @@
/* File sanity check */
if(p->file_offset != p->next_cpu_change_offset) {
fprintf(warn, "Strange, pcpu %d expected offet %llx, actual %llx!\n",
- p->pid, p->next_cpu_change_offset, p->file_offset);
+ p->pid, (unsigned long long)p->next_cpu_change_offset,
+ (unsigned long long)p->file_offset);
}
if(r->cpu > MAX_CPUS)
@@ -7246,7 +7247,7 @@
P.max_active_pcpu = r->cpu;
fprintf(warn, "%s: Activating pcpu %d at offset %lld\n",
- __func__, r->cpu, p->file_offset);
+ __func__, r->cpu, (unsigned long long)p->file_offset);
sched_default_vcpu_activate(p2);
@@ -7271,7 +7272,7 @@
activate_early_eof();
} else if(P.early_eof && p->file_offset > P.last_epoch_offset) {
fprintf(warn, "%s: early_eof activated, pcpu %d past
last_epoch_offset %llx, deactivating.\n",
- __func__, p->pid, P.last_epoch_offset);
+ __func__, p->pid, (unsigned long long)P.last_epoch_offset);
deactivate_pcpu(p);
}
}
@@ -7571,7 +7572,7 @@
return 0;
} else if(r < sizeof(uint32_t)) {
/* Full header not read */
- fprintf(stderr, "%s: short read (%d bytes)\n",
+ fprintf(stderr, "%s: short read (%zd bytes)\n",
__func__, r);
exit(1);
}
@@ -7580,7 +7581,7 @@
if(r < rsize) {
/* Full record not read */
- fprintf(stderr, "%s: short read (%d, expected %d)\n",
+ fprintf(stderr, "%s: short read (%zd, expected %zd)\n",
__func__, r, rsize);
return 0;
}
@@ -7627,7 +7628,7 @@
if ( opt.dump_raw_reads ) {
int i;
printf("R p%2d o%016llx %8lx %d ",
- p->pid, p->file_offset,
+ p->pid, (unsigned long long)p->file_offset,
(unsigned long)ri->rec.event, ri->rec.extra_words);
if(ri->rec.cycle_flag)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|