Fix various printf format mistakes

上级 66c68653
......@@ -274,7 +274,7 @@ gc_worker(void *x)
int nfree = gc_free_tofreelist(&(gc_state[mycpu()->id].tofree[i%NEPOCH].next), i);
gc_state[mycpu()->id].tofree[i%NEPOCH].epoch += NEPOCH;
if (gc_debug && nfree > 0) {
cprintf("%d: epoch %d freed %d\n", mycpu()->id, i, nfree);
cprintf("%d: epoch %lu freed %d\n", mycpu()->id, i, nfree);
}
}
gc_state[mycpu()->id].min_epoch = i;
......
......@@ -151,9 +151,9 @@ kmemprint(void)
cprintf("free pages: [ ");
for (u32 i = 0; i < NCPU; i++)
if (i == mycpu()->id)
cprintf("<%d> ", kmems[i].nfree);
cprintf("<%lu> ", kmems[i].nfree);
else
cprintf("%d ", kmems[i].nfree);
cprintf("%lu ", kmems[i].nfree);
cprintf("]\n");
}
......
......@@ -44,7 +44,7 @@ void cv_wakeup(struct condvar *cv);
void cv_tick(void);
// console.c
void cprintf(const char*, ...);
void cprintf(const char*, ...) __attribute__((format(printf, 1, 2)));
void panic(const char*) __noret__;
void kerneltrap(struct trapframe *tf) __noret__;
void snprintf(char *buf, u32 n, char *fmt, ...);
......
......@@ -148,7 +148,7 @@ cpunum(void)
static int n __mpalign__;
if(n == 0) {
n++;
cprintf("cpu called from %lx with interrupts enabled\n",
cprintf("cpu called from %p with interrupts enabled\n",
__builtin_return_address(0));
}
}
......
......@@ -111,7 +111,7 @@ pci_attach_match(u32 key1, u32 key2,
return r;
if (r < 0)
cprintf("pci_attach_match: attaching "
"%x.%x (%p): e\n",
"%x.%x (%p): %d\n",
key1, key2, list[i].attachfn, r);
}
}
......
......@@ -437,7 +437,7 @@ growproc(int n)
// is there space for newstart..newstart+newn?
if(vmap_lookup(m, newstart, newn) != 0){
cprintf("growproc: not enough room in address space; brk %d n %d\n",
cprintf("growproc: not enough room in address space; brk %lx n %d\n",
myproc()->brk, n);
return -1;
}
......@@ -446,7 +446,7 @@ growproc(int n)
// vma? we can't allow that, since then a future sbrk()
// would start to use the next region (e.g. the stack).
if(vmap_lookup(m, PGROUNDUP(newstart+newn), 1) != 0){
cprintf("growproc: would abut next vma; brk %d n %d\n",
cprintf("growproc: would abut next vma; brk %lx n %d\n",
myproc()->brk, n);
return -1;
}
......@@ -530,7 +530,7 @@ void *procdump(void *vk, void *v, void *arg)
if(p->state == SLEEPING){
getcallerpcs((void*)p->context->rbp, pc);
for(int i=0; i<10 && pc[i] != 0; i++)
cprintf(" %p\n", pc[i]);
cprintf(" %lx\n", pc[i]);
}
return 0;
}
......
......@@ -46,8 +46,8 @@ struct proc {
struct file *ofile[NOFILE]; // Open files
struct inode *cwd; // Current directory
char name[16]; // Process name (debugging)
unsigned long long tsc;
unsigned long long curcycles;
u64 tsc;
u64 curcycles;
unsigned cpuid;
struct spinlock lock;
SLIST_HEAD(childlist, proc) childq;
......
......@@ -25,7 +25,7 @@ tryacquire(struct spinlock *lk)
#if SPINLOCK_DEBUG
if(holding(lk)) {
cprintf("%lx\n", __builtin_return_address(0));
cprintf("%p\n", __builtin_return_address(0));
panic("acquire");
}
#endif
......@@ -56,7 +56,7 @@ acquire(struct spinlock *lk)
#if SPINLOCK_DEBUG
if(holding(lk)) {
cprintf("%lx\n", __builtin_return_address(0));
cprintf("%p\n", __builtin_return_address(0));
panic("acquire");
}
#endif
......
......@@ -131,7 +131,7 @@ trap(struct trapframe *tf)
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
cprintf("pid %d %s: trap %lu err %d on cpu %d "
"rip 0x%lx rsp 0x%lx addr 0x%lx--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno, tf->err,
mycpu()->id, tf->rip, tf->rsp, rcr2());
......
......@@ -217,7 +217,8 @@ pagefault(struct vmap *vmap, uptr va, u32 err)
m = pagefault_ondemand(vmap, va, err, m);
if (vm_debug)
cprintf("pagefault: err 0x%x va 0x%x type %d ref %d pid %d\n", err, va, m->va_type, m->n->ref, myproc()->pid);
cprintf("pagefault: err 0x%x va 0x%lx type %d ref %lu pid %d\n",
err, va, m->va_type, m->n->ref, myproc()->pid);
if (m->va_type == COW && (err & FEC_WR)) {
if (pagefault_wcow(vmap, va, pte, m, npg) < 0) {
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论