From 35a108b911237c1dbd8b99db84d4fed1761ccf73 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 5 Mar 2010 15:05:11 +0000 Subject: [PATCH] panic() cleanup. this change - makes panic() variadic, doing full printf() formatting - no more NO_NUM, and no more separate printf() statements needed to print extra info (or something in hex) before panicing - unifies panic() - same panic() name and usage for everyone - vm, kernel and rest have different names/syntax currently in order to implement their own luxuries, but no longer - throws out the 1st argument, to make source less noisy. the panic() in syslib retrieves the server name from the kernel so it should be clear enough who is panicing; e.g. panic("sigaction failed: %d", errno); looks like: at_wini(73130): panic: sigaction failed: 0 syslib:panic.c: stacktrace: 0x74dc 0x2025 0x100a - throws out report() - printf() is more convenient and powerful - harmonizes/fixes the use of panic() - there were a few places that used printf-style formatting (didn't work) and newlines (messes up the formatting) in panic() - throws out a few per-server panic() functions - cleans up a tie-in of tty with panic() merging printf() and panic() statements to be done incrementally. --- drivers/amddev/amddev.c | 4 +- drivers/at_wini/at_wini.c | 141 ++++++++++----------- drivers/atl2/atl2.c | 30 ++--- drivers/audio/sb16/sb16.c | 4 +- drivers/bios_wini/bios_wini.c | 16 +-- drivers/dec21140A/dec21140A.c | 48 ++++---- drivers/dp8390/3c503.c | 2 +- drivers/dp8390/dp8390.c | 203 +++++++++++++------------------ drivers/dp8390/rtl8029.c | 11 +- drivers/dpeth/3c501.c | 6 +- drivers/dpeth/3c503.c | 2 +- drivers/dpeth/3c509.c | 6 +- drivers/dpeth/8390.c | 26 ++-- drivers/dpeth/dp.c | 32 ++--- drivers/dpeth/netbuff.c | 4 +- drivers/e1000/e1000.c | 58 ++++----- drivers/filter/driver.c | 23 ++-- drivers/filter/main.c | 8 +- drivers/filter/sum.c | 8 +- drivers/filter/util.c | 10 +- drivers/floppy/floppy.c | 46 +++---- drivers/fxp/fxp.c | 180 ++++++++++++--------------- drivers/lance/lance.c | 61 ++++------ drivers/libdriver/driver.c | 12 +- drivers/log/diag.c | 7 +- drivers/memory/memory.c | 18 +-- drivers/orinoco/orinoco.c | 56 ++++----- drivers/pci/pci.c | 34 +++--- drivers/printer/printer.c | 26 ++-- drivers/random/main.c | 4 +- drivers/random/random.c | 2 +- drivers/rtl8139/rtl8139.c | 137 +++++++++------------ drivers/rtl8169/rtl8169.c | 62 ++++------ drivers/sb16/sb16.c | 4 +- drivers/sb16/sb16_dsp.c | 6 +- drivers/ti1225/ti1225.c | 29 ++--- drivers/tty/console.c | 16 +-- drivers/tty/keyboard.c | 24 ++-- drivers/tty/tty.c | 17 ++- drivers/tty/tty.h | 2 - include/minix/const.h | 1 - include/minix/devio.h | 2 +- include/minix/sysutil.h | 5 +- include/minix/type.h | 2 +- kernel/arch/i386/arch_do_vmctl.c | 3 +- kernel/arch/i386/exception.c | 9 +- kernel/arch/i386/memory.c | 16 +-- kernel/arch/i386/mpx386.S | 3 +- kernel/arch/i386/protect.c | 6 +- kernel/arch/i386/watchdog.c | 2 +- kernel/debug.c | 3 +- kernel/debug.h | 8 +- kernel/interrupt.c | 6 +- kernel/main.c | 6 +- kernel/proc.c | 21 ++-- kernel/proto.h | 3 - kernel/system.c | 8 +- kernel/system/do_irqctl.c | 2 +- kernel/system/do_safecopy.c | 2 +- kernel/system/do_sysctl.c | 2 +- kernel/system/do_umap.c | 2 +- kernel/system/do_vdevio.c | 2 +- kernel/system/do_vmctl.c | 14 +-- kernel/utility.c | 37 +++--- lib/libsys/Makefile | 4 +- lib/libsys/alloc_util.c | 2 +- lib/libsys/assert.c | 3 +- lib/libsys/asynsend.c | 4 +- lib/libsys/env_panic.c | 2 +- lib/libsys/kprintf.c | 184 ++-------------------------- lib/libsys/panic.c | 35 +++--- lib/libsys/pci_attr_r16.c | 4 +- lib/libsys/pci_attr_r32.c | 4 +- lib/libsys/pci_attr_r8.c | 4 +- lib/libsys/pci_attr_w16.c | 4 +- lib/libsys/pci_attr_w32.c | 4 +- lib/libsys/pci_attr_w8.c | 4 +- lib/libsys/pci_del_acl.c | 6 +- lib/libsys/pci_dev_name.c | 4 +- lib/libsys/pci_find_dev.c | 4 +- lib/libsys/pci_first_dev.c | 4 +- lib/libsys/pci_ids.c | 4 +- lib/libsys/pci_init1.c | 6 +- lib/libsys/pci_next_dev.c | 4 +- lib/libsys/pci_rescan_bus.c | 5 +- lib/libsys/pci_reserve.c | 4 +- lib/libsys/pci_set_acl.c | 6 +- lib/libsys/pci_slot_name.c | 4 +- lib/libsys/report.c | 20 --- lib/libsys/sef.c | 8 +- lib/libsys/sef_liveupdate.c | 2 +- lib/libsys/timing.c | 6 +- lib/libsys/tsc_util.c | 6 +- lib/libsys/vprintf.c | 175 ++++++++++++++++++++++++++ servers/ds/main.c | 6 +- servers/ds/store.c | 4 +- servers/hgfs/inode.c | 2 +- servers/hgfs/main.c | 2 +- servers/inet/inet.c | 2 +- servers/is/dmp.c | 4 +- servers/is/dmp_kernel.c | 26 ++-- servers/is/dmp_vm.c | 4 +- servers/is/main.c | 6 +- servers/iso9660fs/device.c | 24 ++-- servers/iso9660fs/main.c | 4 +- servers/iso9660fs/proto.h | 1 - servers/iso9660fs/read.c | 8 +- servers/iso9660fs/utility.c | 21 ---- servers/mfs/cache.c | 10 +- servers/mfs/device.c | 22 ++-- servers/mfs/inode.c | 8 +- servers/mfs/link.c | 2 +- servers/mfs/main.c | 4 +- servers/mfs/mount.c | 2 +- servers/mfs/open.c | 4 +- servers/mfs/path.c | 6 +- servers/mfs/read.c | 16 ++- servers/mfs/super.c | 15 ++- servers/mfs/utility.c | 10 +- servers/mfs/write.c | 2 +- servers/pfs/inode.c | 8 +- servers/pfs/main.c | 2 +- servers/pfs/utility.c | 2 +- servers/pm/alarm.c | 10 +- servers/pm/exec.c | 16 +-- servers/pm/forkexit.c | 34 +++--- servers/pm/main.c | 29 +++-- servers/pm/signal.c | 26 ++-- servers/pm/time.c | 8 +- servers/pm/timers.c | 8 +- servers/pm/trace.c | 2 +- servers/pm/utility.c | 4 +- servers/rs/main.c | 60 +++++---- servers/rs/manager.c | 22 ++-- servers/vfs/device.c | 34 +++--- servers/vfs/dmap.c | 2 +- servers/vfs/fs.h | 2 +- servers/vfs/fscall.c | 2 +- servers/vfs/lock.c | 2 +- servers/vfs/main.c | 32 ++--- servers/vfs/misc.c | 18 ++- servers/vfs/mount.c | 7 +- servers/vfs/path.c | 9 +- servers/vfs/pipe.c | 24 ++-- servers/vfs/proto.h | 1 - servers/vfs/read.c | 25 ++-- servers/vfs/request.c | 57 ++++----- servers/vfs/select.c | 34 ++---- servers/vfs/stadir.c | 3 +- servers/vfs/timers.c | 12 +- servers/vfs/utility.c | 6 +- servers/vfs/vnode.c | 6 +- servers/vm/alloc.c | 16 +-- servers/vm/break.c | 2 +- servers/vm/exec.c | 18 +-- servers/vm/fork.c | 6 +- servers/vm/i386/pagetable.c | 51 ++++---- servers/vm/main.c | 30 ++--- servers/vm/map_mem.c | 10 +- servers/vm/mmap.c | 10 +- servers/vm/pagefaults.c | 20 +-- servers/vm/region.c | 20 +-- servers/vm/sanitycheck.h | 8 +- servers/vm/signal.c | 2 +- servers/vm/slaballoc.c | 10 +- servers/vm/util.h | 7 +- servers/vm/utility.c | 8 +- test/safecopy/inc.h | 4 +- test/safemap/inc.h | 4 +- test/safeperf/inc.h | 4 +- test/safeperf/requestor.c | 2 +- 171 files changed, 1381 insertions(+), 1649 deletions(-) delete mode 100644 lib/libsys/report.c create mode 100644 lib/libsys/vprintf.c diff --git a/drivers/amddev/amddev.c b/drivers/amddev/amddev.c index 7457941e9..7716dcac6 100644 --- a/drivers/amddev/amddev.c +++ b/drivers/amddev/amddev.c @@ -78,7 +78,7 @@ int main(void) r= sef_receive(ANY, &m); if (r != OK) - panic(__FILE__, "sef_receive failed", r); + panic("sef_receive failed: %d", r); if (is_notify(m.m_type)) { if (_ENDPOINT_P(m.m_source) == PM_PROC_NR) { do_pm_notify(&m); @@ -247,7 +247,7 @@ static void init_domain(int index) size= 0x100000 / 8; table= alloc_contig(size, AC_ALIGN4K, &busaddr); if (table == NULL) - panic("AMDDEV","malloc failed", NO_NUM); + panic("malloc failed"); if (index == 0) { memset(table, 0, size); diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index fb26cd917..723f2b436 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -270,7 +270,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) sa.sa_handler = SIG_MESS; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - if (sigaction(SIGTERM,&sa,NULL)<0) panic("AT","sigaction failed", errno); + if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno); /* Set special disk parameters. */ init_params(); @@ -306,7 +306,7 @@ PRIVATE void init_params() w_identify_wakeup_ticks = wakeup_secs * system_hz; if(atapi_debug) - panic("at_wini", "atapi_debug", NO_NUM); + panic("atapi_debug"); if(w_identify_wakeup_ticks <= 0) { printf("changing wakeup from %d to %d ticks.\n", @@ -330,7 +330,7 @@ PRIVATE void init_params() /* Get the number of drives from the BIOS data area */ s=sys_readbios(NR_HD_DRIVES_ADDR, params, NR_HD_DRIVES_SIZE); if (s != OK) - panic(w_name(), "Couldn't read BIOS", s); + panic("Couldn't read BIOS: %d", s); if ((nr_drives = params[0]) > 2) nr_drives = 2; for (drive = 0, wn = wini; drive < COMPAT_DRIVES; drive++, wn++) { @@ -342,13 +342,13 @@ PRIVATE void init_params() BIOS_HD1_PARAMS_SIZE; s=sys_readbios(vector, parv, size); if (s != OK) - panic(w_name(), "Couldn't read BIOS", s); + panic("Couldn't read BIOS: %d", s); /* Calculate the address of the parameters and copy them */ s=sys_readbios(hclick_to_physb(parv[1]) + parv[0], params, 16L); if (s != OK) - panic(w_name(),"Couldn't copy parameters", s); + panic("Couldn't copy parameters: %d", s); /* Copy the parameters to the structures of the drive */ wn->lcylinders = bp_cylinders(params); @@ -700,9 +700,7 @@ check_dma(struct wini *wn) if (dma_base) { if (sys_inb(dma_base + DMA_STATUS, &dma_status) != OK) { - panic(w_name(), - "unable to read DMA status register", - NO_NUM); + panic("unable to read DMA status register"); } } @@ -796,7 +794,7 @@ PRIVATE int w_identify() /* Device information. */ if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, SECTOR_SIZE)) != OK) - panic(w_name(),"Call to sys_insw() failed", s); + panic("Call to sys_insw() failed: %d", s); #if 0 if (id_word(0) & ID_GEN_NOT_ATA) @@ -869,7 +867,7 @@ PRIVATE int w_identify() /* Device information. */ if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, 512)) != OK) - panic(w_name(),"Call to sys_insw() failed", s); + panic("Call to sys_insw() failed: %d", s); size = 0; /* Size set later. */ check_dma(wn); @@ -906,9 +904,9 @@ PRIVATE int w_identify() wn->irq = w_drive < 2 ? AT_WINI_0_IRQ : AT_WINI_1_IRQ; wn->irq_hook_id = wn->irq; /* id to be returned if interrupt occurs */ if ((s=sys_irqsetpolicy(wn->irq, IRQ_REENABLE, &wn->irq_hook_id)) != OK) - panic(w_name(), "couldn't set IRQ policy", s); + panic("couldn't set IRQ policy: %d", s); if ((s=sys_irqenable(&wn->irq_hook_id)) != OK) - panic(w_name(), "couldn't enable IRQ line", s); + panic("couldn't enable IRQ line: %d", s); } wn->state |= IDENTIFIED; return(OK); @@ -963,13 +961,13 @@ PRIVATE int w_io_test(void) /* Try I/O on the actual drive (not any (sub)partition). */ if (w_prepare(w_drive * DEV_PER_DRIVE) == NIL_DEV) - panic(w_name(), "Couldn't switch devices", NO_NUM); + panic("Couldn't switch devices"); r = w_transfer(SELF, DEV_GATHER_S, cvu64(0), &iov, 1); /* Switch back. */ if (w_prepare(save_dev) == NIL_DEV) - panic(w_name(), "Couldn't switch back devices", NO_NUM); + panic("Couldn't switch back devices"); /* Restore parameters. */ timeout_ticks = save_timeout; @@ -1108,7 +1106,7 @@ PRIVATE void stop_dma(struct wini *wn) /* Stop bus master operation */ r= sys_outb(wn->base_dma + DMA_COMMAND, 0); - if (r != 0) panic("at_wini", "stop_dma: sys_outb failed", r); + if (r != 0) panic("stop_dma: sys_outb failed: %d", r); } PRIVATE void start_dma(struct wini *wn, int do_write) @@ -1124,7 +1122,7 @@ PRIVATE void start_dma(struct wini *wn, int do_write) v |= DMA_CMD_WRITE; } r= sys_outb(wn->base_dma + DMA_COMMAND, v); - if (r != 0) panic("at_wini", "start_dma: sys_outb failed", r); + if (r != 0) panic("start_dma: sys_outb failed: %d", r); } PRIVATE int error_dma(struct wini *wn) @@ -1140,7 +1138,7 @@ PRIVATE int error_dma(struct wini *wn) return 1; \ r= sys_inb(wn->base_dma + DMA_STATUS, &v); - if (r != 0) panic("at_wini", "w_transfer: sys_inb failed", r); + if (r != 0) panic("w_transfer: sys_inb failed: %d", r); if (!wn->dma_intseen) { /* DMA did not complete successfully */ @@ -1234,7 +1232,7 @@ unsigned nr_req; /* length of request vector */ * way to implement this wait. */ if (sys_inb((wn->base_ctl+REG_CTL_ALTSTAT), &w_status) != OK) - panic(w_name(), "couldn't get status", NO_NUM); + panic("couldn't get status"); } if (do_dma) { @@ -1281,11 +1279,8 @@ unsigned nr_req; /* length of request vector */ s= sys_safecopyto(proc_nr, iov->iov_addr, addr_offset, (vir_bytes)dma_buf+dma_buf_offset, n, D); - if (s != OK) - { - panic(w_name(), - "w_transfer: sys_vircopy failed", - s); + if (s != OK) { + panic("w_transfer: sys_vircopy failed: %d", s); } } else { memcpy((char *) iov->iov_addr + addr_offset, @@ -1317,11 +1312,8 @@ unsigned nr_req; /* length of request vector */ if (w_wn->w_status & STATUS_DRQ) { if ((s=sys_insw(wn->base_cmd+REG_DATA, SELF, tmp_buf, - SECTOR_SIZE)) != OK) - { - panic(w_name(), - "Call to sys_insw() failed", - s); + SECTOR_SIZE)) != OK) { + panic("Call to sys_insw() failed: %d", s); } } break; @@ -1346,7 +1338,7 @@ unsigned nr_req; /* length of request vector */ SECTOR_SIZE); } if(s != OK) { - panic(w_name(),"Call to sys_insw() failed", s); + panic("Call to sys_insw() failed: %d", s); } } else { if(proc_nr != SELF) { @@ -1360,7 +1352,7 @@ unsigned nr_req; /* length of request vector */ } if(s != OK) { - panic(w_name(),"Call to sys_outsw() failed", s); + panic("Call to sys_outsw() failed: %d", s); } /* Data sent, wait for an interrupt. */ @@ -1415,7 +1407,7 @@ struct command *cmd; /* Command block */ /* Select drive. */ if ((s=sys_outb(base_cmd + REG_LDH, cmd->ldh)) != OK) - panic(w_name(),"Couldn't write register to select drive",s); + panic("Couldn't write register to select drive: %d", s); if (!w_waitfor(STATUS_BSY, 0)) { printf("%s: com_out: drive not ready\n", w_name()); @@ -1439,7 +1431,7 @@ struct command *cmd; /* Command block */ pv_set(outbyte[5], base_cmd + REG_CYL_HI, cmd->cyl_hi); pv_set(outbyte[6], base_cmd + REG_COMMAND, cmd->command); if ((s=sys_voutb(outbyte,7)) != OK) - panic(w_name(),"Couldn't write registers with sys_voutb()",s); + panic("Couldn't write registers with sys_voutb(): %d", s); return(OK); } @@ -1466,7 +1458,7 @@ struct command *cmd; /* Command block */ /* Select drive. */ if ((s=sys_outb(base_cmd + REG_LDH, cmd->ldh)) != OK) - panic(w_name(),"Couldn't write register to select drive",s); + panic("Couldn't write register to select drive: %d", s); if (!w_waitfor(STATUS_BSY, 0)) { printf("%s: com_out: drive not ready\n", w_name()); @@ -1493,7 +1485,7 @@ struct command *cmd; /* Command block */ pv_set(outbyte[8], base_cmd + REG_CYL_HI, cmd->cyl_hi); pv_set(outbyte[9], base_cmd + REG_COMMAND, cmd->command); if ((s=sys_voutb(outbyte, 10)) != OK) - panic(w_name(),"Couldn't write registers with sys_voutb()",s); + panic("Couldn't write registers with sys_voutb(): %d", s); return(OK); } @@ -1538,21 +1530,19 @@ int *do_copyoutp; if (n > size) n= size; if (n == 0 || (n & 1)) - panic("at_wini", "bad size in iov", iov[i].iov_size); + panic("bad size in iov: %d", iov[i].iov_size); if(proc_nr != SELF) { r= sys_umap(proc_nr, VM_GRANT, iov[i].iov_addr, n, &user_phys); if (r != 0) - panic("at_wini", - "can't map user buffer (VM_GRANT)", r); + panic("can't map user buffer (VM_GRANT): %d", r); user_phys += offset + addr_offset; } else { r= sys_umap(proc_nr, VM_D, iov[i].iov_addr+offset+addr_offset, n, &user_phys); if (r != 0) - panic("at_wini", - "can't map user buffer (VM_D)", r); + panic("can't map user buffer (VM_D): %d", r); } if (user_phys & 1) { @@ -1598,7 +1588,7 @@ int *do_copyoutp; if (!bad) { if (j <= 0 || j > N_PRDTE) - panic("at_wini", "bad prdt index", j); + panic("bad prdt index: %d", j); prdt[j-1].prdte_flags |= PRDTE_FL_EOT; if(verbose) { @@ -1639,10 +1629,8 @@ int *do_copyoutp; r= sys_safecopyfrom(proc_nr, iov->iov_addr, addr_offset, (vir_bytes)dma_buf+offset, n, D); - if (r != OK) - { - panic(w_name(), - "setup_dma: sys_vircopy failed", r); + if (r != OK) { + panic("setup_dma: sys_vircopy failed: %d", r); } } else { memcpy(dma_buf + offset, @@ -1659,22 +1647,17 @@ int *do_copyoutp; if (phys & 1) { /* Two byte alignment is required */ - panic("at_wini", "bad buffer alignment in setup_dma", - phys); + panic("bad buffer alignment in setup_dma: 0x%lx", phys); } for (j= 0; jbase_dma + DMA_STATUS, &v); - if (r != 0) panic("at_wini", "setup_dma: sys_inb failed", r); + if (r != 0) panic("setup_dma: sys_inb failed: %d", r); if (v & DMA_ST_BM_ACTIVE) - panic("at_wini", "Bus master IDE active", NO_NUM); + panic("Bus master IDE active"); if (prdt_phys & 3) - panic("at_wini", "prdt not aligned", prdt_phys); + panic("prdt not aligned: %d", prdt_phys); r= sys_outl(wn->base_dma + DMA_PRDTP, prdt_phys); - if (r != 0) panic("at_wini", "setup_dma: sys_outl failed", r); + if (r != 0) panic("setup_dma: sys_outl failed: %d", r); /* Clear interrupt and error flags */ r= sys_outb(wn->base_dma + DMA_STATUS, DMA_ST_INT | DMA_ST_ERROR); - if (r != 0) panic("at_wini", "setup_dma: sys_outb failed", r); + if (r != 0) panic("setup_dma: sys_outb failed: %d", r); } @@ -1825,10 +1808,10 @@ PRIVATE int w_reset() /* Strobe reset bit */ if ((s=sys_outb(wn->base_ctl + REG_CTL, CTL_RESET)) != OK) - panic(w_name(),"Couldn't strobe reset bit",s); + panic("Couldn't strobe reset bit: %d", s); tickdelay(DELAY_TICKS); if ((s=sys_outb(wn->base_ctl + REG_CTL, 0)) != OK) - panic(w_name(),"Couldn't strobe reset bit",s); + panic("Couldn't strobe reset bit: %d", s); tickdelay(DELAY_TICKS); /* Wait for controller ready */ @@ -1870,7 +1853,7 @@ PRIVATE void w_intr_wait() while (w_wn->w_status & (STATUS_ADMBSY|STATUS_BSY)) { int rr; if((rr=sef_receive(ANY, &m)) != OK) - panic("at_wini", "sef_receive(ANY) failed", rr); + panic("sef_receive(ANY) failed: %d", rr); if (is_notify(m.m_type)) { switch (_ENDPOINT_P(m.m_source)) { case CLOCK: @@ -1882,8 +1865,7 @@ PRIVATE void w_intr_wait() r= sys_inb(w_wn->base_cmd + REG_STATUS, &w_status); if (r != 0) - panic("at_wini", - "sys_inb failed", r); + panic("sys_inb failed: %d", r); w_wn->w_status= w_status; ack_irqs(m.NOTIFY_ARG); break; @@ -1923,7 +1905,7 @@ PRIVATE int at_intr_wait() r = OK; } else { if ((s=sys_inb(w_wn->base_cmd + REG_ERROR, &inbval)) != OK) - panic(w_name(),"Couldn't read register",s); + panic("Couldn't read register: %d", s); if ((w_wn->w_status & STATUS_ERR) && (inbval & ERROR_BB)) { r = ERR_BAD_SECTOR; /* sector marked bad, retries won't help */ } else { @@ -1953,7 +1935,7 @@ int value; /* required status */ getuptime(&t0); do { if ((s=sys_inb(w_wn->base_cmd + REG_STATUS, &w_status)) != OK) - panic(w_name(),"Couldn't read register",s); + panic("Couldn't read register: %d", s); w_wn->w_status= w_status; if ((w_wn->w_status & mask) == value) { return 1; @@ -1984,7 +1966,7 @@ int value; /* required status */ getuptime(&t0); do { if ((s=sys_inb(w_wn->base_dma + DMA_STATUS, &w_status)) != OK) - panic(w_name(),"Couldn't read register",s); + panic("Couldn't read register: %d", s); if ((w_status & mask) == value) { return 1; } @@ -2191,7 +2173,7 @@ unsigned nr_req; /* length of request vector */ if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE; if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, chunk)) != OK) - panic(w_name(),"Call to sys_insw() failed", s); + panic("Call to sys_insw() failed: %d", s); before -= chunk; count -= chunk; } @@ -2210,7 +2192,7 @@ unsigned nr_req; /* length of request vector */ chunk); } if (s != OK) - panic(w_name(),"Call to sys_insw() failed", s); + panic("Call to sys_insw() failed: %d", s); position= add64ul(position, chunk); nbytes -= chunk; count -= chunk; @@ -2231,7 +2213,7 @@ unsigned nr_req; /* length of request vector */ if (chunk > DMA_BUF_SIZE) chunk = DMA_BUF_SIZE; if ((s=sys_insw(wn->base_cmd + REG_DATA, SELF, tmp_buf, chunk)) != OK) - panic(w_name(),"Call to sys_insw() failed", s); + panic("Call to sys_insw() failed: %d", s); count -= chunk; } } @@ -2275,7 +2257,7 @@ int do_dma; /* Select Master/Slave drive */ if ((s=sys_outb(wn->base_cmd + REG_DRIVE, wn->ldhpref)) != OK) - panic(w_name(),"Couldn't select master/ slave drive",s); + panic("Couldn't select master/ slave drive: %d", s); if (!w_waitfor(STATUS_BSY | STATUS_DRQ, 0)) { printf("%s: atapi_sendpacket: drive not ready\n", w_name()); @@ -2303,7 +2285,7 @@ int do_dma; pv_set(outbyte[5], wn->base_cmd + REG_COMMAND, w_command); if (atapi_debug) printf("cmd: %x ", w_command); if ((s=sys_voutb(outbyte,6)) != OK) - panic(w_name(),"Couldn't write registers with sys_voutb()",s); + panic("Couldn't write registers with sys_voutb(): %d", s); if (!w_waitfor(STATUS_BSY | STATUS_DRQ, STATUS_DRQ)) { printf("%s: timeout (BSY|DRQ -> DRQ)\n", w_name()); @@ -2313,7 +2295,7 @@ int do_dma; /* Send the command packet to the device. */ if ((s=sys_outsw(wn->base_cmd + REG_DATA, SELF, packet, ATAPI_PACKETSIZE)) != OK) - panic(w_name(),"sys_outsw() failed", s); + panic("sys_outsw() failed: %d", s); return(OK); } @@ -2415,8 +2397,7 @@ PRIVATE void ack_irqs(unsigned int irqs) if (sys_inb((wini[drive].base_cmd + REG_STATUS), &w_status) != OK) { - panic(w_name(), "couldn't ack irq on drive %d\n", - drive); + panic("couldn't ack irq on drive: %d", drive); } wini[drive].w_status= w_status; sys_inb(wini[drive].base_dma + DMA_STATUS, &w_status); @@ -2490,7 +2471,7 @@ PRIVATE int atapi_intr_wait(int do_dma, size_t max) inbyte[2].port = wn->base_cmd + REG_CNT_HI; inbyte[3].port = wn->base_cmd + REG_IRR; if ((s=sys_vinb(inbyte, 4)) != OK) - panic(w_name(),"ATAPI failed sys_vinb()", s); + panic("ATAPI failed sys_vinb(): %d", s); e = inbyte[0].value; len = inbyte[1].value; len |= inbyte[2].value << 8; @@ -2549,7 +2530,7 @@ PRIVATE int at_voutb(int line, pvb_pair_t *pvb, int n) printf("at_wini%d: sys_voutb failed: %d pvb (%d):\n", w_instance, s, n); for(i = 0; i < n; i++) printf("%2d: %4x -> %4x\n", i, pvb[i].value, pvb[i].port); - panic(w_name(), "sys_voutb failed", NO_NUM); + panic("sys_voutb failed"); } PRIVATE int at_vinb(int line, pvb_pair_t *pvb, int n) @@ -2560,7 +2541,7 @@ PRIVATE int at_vinb(int line, pvb_pair_t *pvb, int n) printf("at_wini%d: sys_vinb failed: %d pvb (%d):\n", w_instance, s, n); for(i = 0; i < n; i++) printf("%2d: %4x\n", i, pvb[i].port); - panic(w_name(), "sys_vinb failed", NO_NUM); + panic("sys_vinb failed"); } PRIVATE int at_out(int line, u32_t port, u32_t value, @@ -2572,7 +2553,7 @@ PRIVATE int at_out(int line, u32_t port, u32_t value, return OK; printf("at_wini%d: line %d: %s failed: %d; %x -> %x\n", w_instance, line, typename, s, value, port); - panic(w_name(), "sys_out failed", NO_NUM); + panic("sys_out failed"); } @@ -2585,7 +2566,7 @@ PRIVATE int at_in(int line, u32_t port, u32_t *value, return OK; printf("at_wini%d: line %d: %s failed: %d; port %x\n", w_instance, line, typename, s, value, port); - panic(w_name(), "sys_in failed", NO_NUM); + panic("sys_in failed"); } diff --git a/drivers/atl2/atl2.c b/drivers/atl2/atl2.c index 48d5e9a38..48cf7b505 100644 --- a/drivers/atl2/atl2.c +++ b/drivers/atl2/atl2.c @@ -531,21 +531,21 @@ PRIVATE void atl2_init(int devind) */ state.base = vm_map_phys(SELF, (void *) bar, ATL2_MMAP_SIZE); if (state.base == MAP_FAILED) - panic("atl2", "unable to map in registers", NO_NUM); + panic("unable to map in registers"); if ((r = atl2_alloc_dma()) != OK) - panic("atl2", "unable to allocate DMA buffers", r); + panic("unable to allocate DMA buffers: %d", r); state.irq = pci_attr_r8(devind, PCI_ILR); if ((r = sys_irqsetpolicy(state.irq, 0, &state.hook_id)) != OK) - panic("atl2", "unable to register IRQ", r); + panic("unable to register IRQ: %d", r); if (!atl2_reset()) - panic("atl2", "unable to reset hardware", NO_NUM); + panic("unable to reset hardware"); if ((r = sys_irqenable(&state.hook_id)) != OK) - panic("atl2", "unable to enable IRQ", r); + panic("unable to enable IRQ: %d", r); atl2_get_hwaddr(); @@ -746,7 +746,7 @@ PRIVATE void atl2_reply(void) m.DL_COUNT)); if ((r = send(state.task_endpt, &m)) != OK) - panic("atl2", "unable to reply", r); + panic("unable to reply: %d", r); state.flags &= ~(ATL2_FLAG_PACK_SENT | ATL2_FLAG_PACK_RCVD); state.recv_count = 0; @@ -805,7 +805,7 @@ PRIVATE void atl2_readv(message *m, int from_int) r = sys_safecopyfrom(m->DL_PROC, m->DL_GRANT, off, (vir_bytes) iovec, batch * sizeof(iovec[0]), D); if (r != OK) - panic("atl2", "vector copy failed", r); + panic("vector copy failed: %d", r); /* Copy out each element in the batch, until we run out. */ for (j = 0, iovp = iovec; j < batch && left > 0; j++, iovp++) { @@ -814,7 +814,7 @@ PRIVATE void atl2_readv(message *m, int from_int) r = sys_safecopyto(m->DL_PROC, iovp->iov_grant, 0, (vir_bytes) pos, size, D); if (r != OK) - panic("atl2", "safe copy failed", r); + panic("safe copy failed: %d", r); pos += size; left -= size; @@ -908,7 +908,7 @@ PRIVATE void atl2_writev(message *m, int from_int) r = sys_safecopyfrom(m->DL_PROC, m->DL_GRANT, off, (vir_bytes) iovec, batch * sizeof(iovec[0]), D); if (r != OK) - panic("atl2", "vector copy failed", r); + panic("vector copy failed: %d", r); /* Copy in each element in the batch. */ for (j = 0, iovp = iovec; j < batch; j++, iovp++) { @@ -924,7 +924,7 @@ PRIVATE void atl2_writev(message *m, int from_int) (vir_bytes) (state.txd_base + pos), skip, D); if (r != OK) - panic("atl2", "safe copy failed", r); + panic("safe copy failed: %d", r); pos = 0; } @@ -932,7 +932,7 @@ PRIVATE void atl2_writev(message *m, int from_int) (vir_bytes) (state.txd_base + pos), size - skip, D); if (r != OK) - panic("atl2", "safe copy failed", r); + panic("safe copy failed: %d", r); pos = (pos + size - skip) % ATL2_TXD_BUFSIZE; left -= size; @@ -1029,7 +1029,7 @@ PRIVATE void atl2_intr(message *m) ATL2_WRITE_U32(ATL2_ISR_REG, 0); if ((r = sys_irqenable(&state.hook_id)) != OK) - panic("atl2", "unable to enable IRQ", r); + panic("unable to enable IRQ: %d", r); /* Attempt to satisfy pending write and read requests. */ if (try_write) @@ -1135,7 +1135,7 @@ PRIVATE void atl2_shutdown(void) atl2_stop(); if ((r = sys_irqrmpolicy(&state.hook_id)) != OK) - panic("atl2", "unable to deregister IRQ", r); + panic("unable to deregister IRQ: %d", r); free_contig(state.txd_base, ATL2_TXD_BUFSIZE); free_contig(state.txs_base, ATL2_TXS_COUNT * sizeof(u32_t)); @@ -1251,7 +1251,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) devind = atl2_probe(instance); if (devind < 0) - panic("atl2", "no matching device found", NO_NUM); + panic("no matching device found"); /* Initialize the device. */ atl2_init(devind); @@ -1310,7 +1310,7 @@ int main(int argc, char **argv) while (TRUE) { if ((r = sef_receive(ANY, &m)) != OK) - panic("atl2", "sef_receive failed", r); + panic("sef_receive failed: %d", r); if (is_notify(m.m_type)) { switch (m.m_source) { diff --git a/drivers/audio/sb16/sb16.c b/drivers/audio/sb16/sb16.c index 0cfe34ce9..e1bcce4c7 100644 --- a/drivers/audio/sb16/sb16.c +++ b/drivers/audio/sb16/sb16.c @@ -432,7 +432,7 @@ PUBLIC int sb16_inb(int port) { int s, value = -1; if ((s=sys_inb(port, &value)) != OK) - panic("SB16DSP","sys_inb() failed", s); + panic("sys_inb() failed: %d", s); return value; } @@ -443,5 +443,5 @@ PUBLIC void sb16_outb(int port, int value) { int s; if ((s=sys_outb(port, value)) != OK) - panic("SB16DSP","sys_outb() failed", s); + panic("sys_outb() failed: %d", s); } diff --git a/drivers/bios_wini/bios_wini.c b/drivers/bios_wini/bios_wini.c index fabf06e80..84f0572ae 100644 --- a/drivers/bios_wini/bios_wini.c +++ b/drivers/bios_wini/bios_wini.c @@ -255,7 +255,7 @@ unsigned nr_req; /* length of request vector */ 0, (vir_bytes) (bios_buf_v+count), chunk, D); if (r != OK) - panic(ME, "copy failed", r); + panic("copy failed: %d", r); } else { memcpy(bios_buf_v+count, (char *) iop->iov_addr, chunk); @@ -299,7 +299,7 @@ unsigned nr_req; /* length of request vector */ r= sys_int86(®86); if (r != OK) - panic(ME, "BIOS call failed", r); + panic("BIOS call failed: %d", r); if (reg86.u.w.f & 0x0001) { /* An error occurred, try again sector by sector unless */ @@ -321,7 +321,7 @@ unsigned nr_req; /* length of request vector */ chunk, D); if (r != OK) - panic(ME, "sys_vircopy failed", r); + panic("sys_vircopy failed: %d", r); } else { memcpy((char *) iop->iov_addr, bios_buf_v+count, chunk); @@ -413,11 +413,11 @@ PRIVATE void w_init() /* Ask the system task for a suitable buffer */ if(!(bios_buf_v = alloc_contig(BIOSBUF, AC_LOWER1M, &bios_buf_phys))) { - panic(ME, "allocating bios buffer failed", ENOMEM); + panic("allocating bios buffer failed: %d", ENOMEM); } if (bios_buf_phys+BIOSBUF > 0x100000) - panic(ME, "bad BIOS buffer, phys", bios_buf_phys); + panic("bad BIOS buffer / phys: %d", bios_buf_phys); #if 0 printf("bios_wini: got buffer size %d, virtual 0x%x, phys 0x%x\n", BIOSBUF, bios_buf_v, bios_buf_phys); @@ -446,7 +446,7 @@ PRIVATE void w_init() reg86.u.b.dl = drive_id; r= sys_int86(®86); if (r != OK) - panic(ME, "BIOS call failed", r); + panic("BIOS call failed: %d", r); nr_drives = !(reg86.u.w.f & 0x0001) ? reg86.u.b.dl : drive; if (drive_id >= 0x80 + nr_drives) continue; @@ -466,7 +466,7 @@ PRIVATE void w_init() if (pc_at) { r= sys_int86(®86); if (r != OK) - panic(ME, "BIOS call failed", r); + panic("BIOS call failed: %d", r); } if (!(reg86.u.w.f & 0x0001) && reg86.u.w.bx == 0xAA55 @@ -481,7 +481,7 @@ PRIVATE void w_init() r= sys_int86(®86); if (r != OK) - panic(ME, "BIOS call failed", r); + panic("BIOS call failed: %d", r); if (!(reg86.u.w.f & 0x0001)) { wn->int13ext = 1; /* Extensions can be used. */ diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index e53cd3437..99481e310 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) while (TRUE) { if ((r= sef_receive(ANY, &m)) != OK) - panic(str_DevName, "minix msg sef_receive failed", r); + panic("minix msg sef_receive failed: %d", r); if(is_notify(m.m_type)) { switch(_ENDPOINT_P(m.m_source)) { @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) default: printf("message 0x%lx; %d from %d\n", m.m_type, m.m_type-DL_RQ_BASE, m.m_source); - panic(str_DevName, "illegal message", m.m_type); + panic("illegal message: %d", m.m_type); } } } @@ -159,7 +159,7 @@ PRIVATE void do_get_stat_s(message * mp) port = mp->DL_PORT; if (port < 0 || port >= DE_PORT_NR) - panic(str_DevName, str_PortErrMsg, port); + panic(str_PortErrMsg, port); dep = &de_table[port]; dep->de_client = mp->DL_PROC; @@ -167,14 +167,14 @@ PRIVATE void do_get_stat_s(message * mp) if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes)&dep->de_stat, (vir_bytes) sizeof(dep->de_stat), 0)) != OK) - panic(str_DevName, str_CopyErrMsg, rc); + panic(str_CopyErrMsg, rc); mp->m_type = DL_STAT_REPLY; mp->DL_PORT = port; mp->DL_STAT = OK; rc = send(mp->m_source, mp); if( rc != OK ) - panic(str_DevName, str_StatErrMsg, rc); + panic(str_StatErrMsg, rc); return; } @@ -244,7 +244,7 @@ PRIVATE void do_conf(message * mp) *(ether_addr_t *) reply_mess.m3_ca1 = dep->de_address; if (send(mp->m_source, &reply_mess) != OK) - panic(str_DevName, str_SendErrMsg, mp->m_source); + panic(str_SendErrMsg, mp->m_source); return; } @@ -259,7 +259,7 @@ message *mp; mp->m_type= DL_NAME_REPLY; r = send(mp->m_source, mp); if (r!= OK) - panic(str_DevName, "do_getname: send failed", r); + panic("do_getname: send failed: %d", r); } PRIVATE void do_reply(dpeth_t * dep, int err, int may_block) @@ -285,7 +285,7 @@ PRIVATE void do_reply(dpeth_t * dep, int err, int may_block) } if(status < 0) - panic(dep->de_name, str_SendErrMsg, status); + panic(str_SendErrMsg, status); dep->de_read_s = 0; dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV); @@ -325,7 +325,7 @@ PRIVATE int de_probe(dpeth_t *dep){ dep->de_irq = pci_attr_r8(devind, PCI_ILR); if (dep->de_base_port < DE_MIN_BASE_ADDR) - panic(str_DevName,"de_probe: base address invalid ", dep->de_base_port); + panic("de_probe: base address invalid: %d", dep->de_base_port); DEBUG(printf("%s: using I/O address 0x%lx, IRQ %d\n", dep->de_name, (unsigned long)dep->de_base_port, @@ -443,7 +443,7 @@ PRIVATE void do_vread_s(message * mp, int from_int) iovec_dat_s_t *iovp = NULL; if (mp->DL_PORT < 0 || mp->DL_PORT >= DE_PORT_NR) - panic(dep->de_name, str_PortErrMsg, mp->DL_PORT); + panic(str_PortErrMsg, mp->DL_PORT); dep = &de_table[mp->DL_PORT]; dep->de_client = mp->DL_PROC; @@ -488,7 +488,7 @@ PRIVATE void do_vread_s(message * mp, int from_int) dep->de_read_iovec.iod_iovec_offset = 0; size = de_calc_iov_size(&dep->de_read_iovec); if (size < ETH_MAX_PACK_SIZE) - panic(str_DevName, str_SizeErrMsg, size); + panic(str_SizeErrMsg, size); /* Copy buffer to user area and clear ownage */ size = (descr->descr->des[DES0]&DES0_FL)>>DES0_FL_SHIFT; @@ -526,7 +526,7 @@ PRIVATE void do_vread_s(message * mp, int from_int) r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, (vir_bytes)buffer, bytes, D); if (r != OK) - panic(str_DevName, str_CopyErrMsg, r); + panic(str_CopyErrMsg, r); buffer += bytes; if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ @@ -624,7 +624,7 @@ PRIVATE void de_first_init(dpeth_t *dep) /* translate buffers physical address */ r = sys_umap(SELF, VM_D, loc_descr->buf1, temp, &(loc_descr->descr->des[DES_BUF1])); - if(r != OK) panic(dep->de_name, "umap failed", r); + if(r != OK) panic("umap failed: %d", r); loc_descr->descr->des[DES_BUF2] = 0; memset(&loc_descr->descr->des[DES0],0,sizeof(u32_t)); loc_descr->descr->des[DES1] = temp; @@ -639,11 +639,11 @@ PRIVATE void de_first_init(dpeth_t *dep) /* record physical location of two first descriptor */ r = sys_umap(SELF, VM_D, dep->descr[DESCR_RECV][0].descr, sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_RECV]); - if(r != OK) panic(str_DevName, str_UmapErrMsg, r); + if(r != OK) panic(str_UmapErrMsg, r); r = sys_umap(SELF, VM_D, dep->descr[DESCR_TRAN][0].descr, sizeof(de_descr_t), &dep->sendrecv_descr_phys_addr[DESCR_TRAN]); - if(r != OK) panic(str_DevName, str_UmapErrMsg, r); + if(r != OK) panic(str_UmapErrMsg, r); DEBUG(printf("Descr: head tran=[%08X] head recv=[%08X]\n", dep->sendrecv_descr_phys_addr[DESCR_TRAN], @@ -656,12 +656,12 @@ PRIVATE void de_first_init(dpeth_t *dep) r = sys_umap(SELF, VM_D, &(loc_descr->descr), sizeof(de_descr_t), &temp); if(r != OK) - panic(str_DevName, str_UmapErrMsg, r); + panic(str_UmapErrMsg, r); if( ((loc_descr->descr->des[DES_BUF1] & 0x3) != 0) || ((loc_descr->descr->des[DES_BUF2] & 0x3) != 0) || ((temp&0x3)!=0) ) - panic(str_DevName, str_AlignErrMsg, temp); + panic(str_AlignErrMsg, temp); loc_descr++; } @@ -686,7 +686,7 @@ PRIVATE void do_interrupt(dpeth_t *dep){ val = io_inl(CSR_ADDR(dep, CSR5)); if(val & CSR5_AIS){ - panic(dep->de_name, "Abnormal Int CSR5=", val); + panic("Abnormal Int CSR5=: %d", val); } if( (dep->de_flags & DEF_READING) && (val & CSR5_RI) ){ @@ -793,7 +793,7 @@ PRIVATE void de_get_userdata_s(int user_proc, cp_grant_id_t grant, len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t); rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D); if (rc != OK) - panic(str_DevName, str_CopyErrMsg, rc); + panic(str_CopyErrMsg, rc); return; } @@ -815,7 +815,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){ char *buffer = NULL; if( mp->DL_PORT < 0 || mp->DL_PORT >= DE_PORT_NR) - panic(str_DevName, str_PortErrMsg, mp->DL_PORT); + panic(str_PortErrMsg, mp->DL_PORT); dep = &de_table[mp->DL_PORT]; dep->de_client = mp->DL_PROC; @@ -823,7 +823,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){ if (dep->de_mode == DEM_ENABLED) { if (!from_int && (dep->de_flags & DEF_SENDING)) - panic(str_DevName, str_BusyErrMsg, NO_NUM); + panic(str_BusyErrMsg); descr = &dep->descr[DESCR_TRAN][dep->cur_descr[DESCR_TRAN]]; @@ -845,7 +845,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){ iovp->iod_iovec_offset = 0; totalsize = size = de_calc_iov_size(iovp); if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE) - panic(str_DevName, str_SizeErrMsg, size); + panic(str_SizeErrMsg, size); dep->bytes_tx += size; dep->de_stat.ets_packetT++; @@ -859,7 +859,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){ r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, (vir_bytes)buffer, bytes, D); if (r != OK) - panic(str_DevName, str_CopyErrMsg, r); + panic(str_CopyErrMsg, r); buffer += bytes; if (++ix >= IOVEC_NR) { @@ -889,7 +889,7 @@ PRIVATE void do_vwrite_s(message * mp, int from_int){ suspend: if(from_int) - panic(str_DevName, "should not happen", 0); + panic("should not happen: %d", 0); dep->de_stat.ets_transDef++; dep->de_flags |= DEF_SENDING; diff --git a/drivers/dp8390/3c503.c b/drivers/dp8390/3c503.c index df5aba5d7..6cda18a90 100644 --- a/drivers/dp8390/3c503.c +++ b/drivers/dp8390/3c503.c @@ -96,7 +96,7 @@ dpeth_t * dep; /* Set interrupt level for 3c503 */ irq = (dep->de_irq &= ~DEI_DEFAULT); /* Strip the default flag. */ if (irq == 9) irq = 2; - if (irq < 2 || irq > 5) panic("", "bad 3c503 irq configuration", irq); + if (irq < 2 || irq > 5) panic("bad 3c503 irq configuration: %d", irq); outb_el2(dep, EL2_IDCFG, (0x04 << irq)); outb_el2(dep, EL2_DRQCNT, 0x08); /* Set burst size to 8 */ diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index 3382c30d6..6f2b6e495 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -220,10 +220,8 @@ PRIVATE int handle_hw_intr(void) dp_check_ints(dep); do_int(dep); r= sys_irqenable(&dep->de_hook); - if (r != OK) - { - panic("DP8390", - "unable enable interrupts", r); + if (r != OK) { + panic("unable enable interrupts: %d", r); } } } @@ -252,7 +250,7 @@ int main(int argc, char *argv[]) while (TRUE) { if ((r= sef_receive(ANY, &m)) != OK) - panic("", "dp8390: sef_receive failed", r); + panic("dp8390: sef_receive failed: %d", r); if (is_notify(m.m_type)) { switch (_ENDPOINT_P(m.m_source)) { @@ -274,8 +272,8 @@ int main(int argc, char *argv[]) printf("dp8390: notify from CLOCK\n"); break; default: - panic("", "dp8390: illegal notify from", - m.m_source); + panic("dp8390: illegal notify from: %d", + m.m_source); } /* done, get a new message */ @@ -296,7 +294,7 @@ int main(int argc, char *argv[]) case DL_GETNAME: do_getname(&m); break; case DL_STOP: do_stop(&m); break; default: - panic("", "dp8390: illegal message", m.m_type); + panic("dp8390: illegal message: %d", m.m_type); } } } @@ -328,10 +326,8 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) system_hz = sys_hz(); - if (env_argc < 1) - { - panic("DP8390", - "A head which at this time has no name", NO_NUM); + if (env_argc < 1) { + panic("A head which at this time has no name"); } (progname=strrchr(env_argv[0],'/')) ? progname++ : (progname=env_argv[0]); @@ -493,7 +489,7 @@ int vectored; port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= DE_PORT_NR) - panic("", "dp8390: illegal port", port); + panic("dp8390: illegal port: %d", port); dep= &de_table[port]; dep->de_client= mp->DL_PROC; @@ -507,13 +503,13 @@ int vectored; assert(dep->de_mode == DEM_ENABLED); assert(dep->de_flags & DEF_ENABLED); if (dep->de_flags & DEF_SEND_AVAIL) - panic("", "dp8390: send already in progress", NO_NUM); + panic("dp8390: send already in progress"); sendq_head= dep->de_sendq_head; if (dep->de_sendq[sendq_head].sq_filled) { if (from_int) - panic("", "dp8390: should not be sending\n", NO_NUM); + panic("dp8390: should not be sending"); dep->de_sendmsg= *mp; dep->de_flags |= DEF_SEND_AVAIL; reply(dep, OK, FALSE); @@ -546,7 +542,7 @@ int vectored; } if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) { - panic("", "dp8390: invalid packet size", size); + panic("dp8390: invalid packet size: %d", size); } (dep->de_user2nicf)(dep, &dep->de_write_iovec, 0, dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE, @@ -594,7 +590,7 @@ int from_int; port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= DE_PORT_NR) - panic("", "dp8390: illegal port", port); + panic("dp8390: illegal port: %d", port); dep= &de_table[port]; dep->de_client= mp->DL_PROC; @@ -608,13 +604,13 @@ int from_int; assert(dep->de_mode == DEM_ENABLED); assert(dep->de_flags & DEF_ENABLED); if (dep->de_flags & DEF_SEND_AVAIL) - panic("", "dp8390: send already in progress", NO_NUM); + panic("dp8390: send already in progress"); sendq_head= dep->de_sendq_head; if (dep->de_sendq[sendq_head].sq_filled) { if (from_int) - panic("", "dp8390: should not be sending\n", NO_NUM); + panic("dp8390: should not be sending"); dep->de_sendmsg= *mp; dep->de_flags |= DEF_SEND_AVAIL; reply(dep, OK, FALSE); @@ -636,7 +632,7 @@ int from_int; if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) { - panic("", "dp8390: invalid packet size", size); + panic("dp8390: invalid packet size: %d", size); } (dep->de_user2nicf_s)(dep, &dep->de_write_iovec_s, 0, dep->de_sendq[sendq_head].sq_sendpage * DP_PAGESIZE, @@ -684,7 +680,7 @@ int vectored; port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= DE_PORT_NR) - panic("", "dp8390: illegal port", port); + panic("dp8390: illegal port: %d", port); dep= &de_table[port]; dep->de_client= mp->DL_PROC; if (dep->de_mode == DEM_SINK) @@ -696,7 +692,7 @@ int vectored; assert(dep->de_flags & DEF_ENABLED); if(dep->de_flags & DEF_READING) - panic("", "dp8390: read already in progress", NO_NUM); + panic("dp8390: read already in progress"); dep->de_safecopy_read= 0; @@ -724,7 +720,7 @@ int vectored; size= count; } if (size < ETH_MAX_PACK_SIZE_TAGGED) - panic("", "dp8390: wrong packet size", size); + panic("dp8390: wrong packet size: %d", size); dep->de_flags |= DEF_READING; dp_recv(dep); @@ -753,7 +749,7 @@ message *mp; port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= DE_PORT_NR) - panic("", "dp8390: illegal port", port); + panic("dp8390: illegal port: %d", port); dep= &de_table[port]; dep->de_client= mp->DL_PROC; if (dep->de_mode == DEM_SINK) @@ -767,7 +763,7 @@ message *mp; dep->de_safecopy_read= 1; if(dep->de_flags & DEF_READING) - panic("", "dp8390: read already in progress", NO_NUM); + panic("dp8390: read already in progress"); get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0, (count > IOVEC_NR ? IOVEC_NR : count) * @@ -782,7 +778,7 @@ message *mp; size= calc_iovec_size_s(&dep->de_tmp_iovec_s); if (size < ETH_MAX_PACK_SIZE_TAGGED) - panic("", "dp8390: wrong packet size", size); + panic("dp8390: wrong packet size: %d", size); dep->de_flags |= DEF_READING; dp_recv(dep); @@ -893,7 +889,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= DE_PORT_NR) - panic("", "dp8390: illegal port", port); + panic("dp8390: illegal port: %d", port); dep= &de_table[port]; dep->de_client= mp->DL_PROC; if (dep->de_mode == DEM_SINK) @@ -906,7 +902,7 @@ message *mp; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic(__FILE__, "do_getstat: send failed: %d\n", r); + panic("do_getstat: send failed: %d", r); return; } assert(dep->de_mode == DEM_ENABLED); @@ -924,7 +920,7 @@ message *mp; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic(__FILE__, "do_getstat: send failed: %d\n", r); + panic("do_getstat: send failed: %d", r); } /*===========================================================================* @@ -938,7 +934,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= DE_PORT_NR) - panic("", "dp8390: illegal port", port); + panic("dp8390: illegal port: %d", port); dep= &de_table[port]; dep->de_client= mp->DL_PROC; if (dep->de_mode == DEM_SINK) @@ -951,7 +947,7 @@ message *mp; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic(__FILE__, "do_getstat: send failed: %d\n", r); + panic("do_getstat: send failed: %d", r); return; } assert(dep->de_mode == DEM_ENABLED); @@ -969,7 +965,7 @@ message *mp; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic(__FILE__, "do_getstat: send failed: %d\n", r); + panic("do_getstat: send failed: %d", r); } /*===========================================================================* @@ -985,7 +981,7 @@ message *mp; mp->m_type= DL_NAME_REPLY; r= send(mp->m_source, mp); if (r != OK) - panic("dp8390", "do_getname: send failed: %d\n", r); + panic("do_getname: send failed: %d", r); } /*===========================================================================* @@ -1000,7 +996,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= DE_PORT_NR) - panic("", "dp8390: illegal port", port); + panic("dp8390: illegal port: %d", port); dep= &de_table[port]; if (dep->de_mode == DEM_SINK) return; @@ -1141,12 +1137,12 @@ dpeth_t *dep; dep->de_hook = dep->de_irq; r= sys_irqsetpolicy(dep->de_irq, 0, &dep->de_hook); if (r != OK) - panic("DP8390", "sys_irqsetpolicy failed", r); + panic("sys_irqsetpolicy failed: %d", r); r= sys_irqenable(&dep->de_hook); if (r != OK) { - panic("DP8390", "unable enable interrupts", r); + panic("unable enable interrupts: %d", r); } } @@ -1242,7 +1238,7 @@ dpeth_t *dep; int size, sendq_tail; if (!(dep->de_flags & DEF_ENABLED)) - panic("", "dp8390: got premature interrupt", NO_NUM); + panic("dp8390: got premature interrupt"); for(;;) { @@ -1486,7 +1482,7 @@ dpeth_t *dep; case DL_WRITEV: do_vwrite(&dep->de_sendmsg, TRUE, TRUE); break; case DL_WRITEV_S: do_vwrite_s(&dep->de_sendmsg, TRUE); break; default: - panic("", "dp8390: wrong type", dep->de_sendmsg.m_type); + panic("dp8390: wrong type: %d", dep->de_sendmsg.m_type); break; } } @@ -1662,7 +1658,7 @@ vir_bytes count; iovp->iod_iovec[i].iov_addr + offset, SELF, D, vir_hw, bytes); if (r != OK) - panic("DP8390", "dp_user2nic: sys_vircopy failed", r); + panic("dp_user2nic: sys_vircopy failed: %d", r); count -= bytes; vir_hw += bytes; @@ -1709,10 +1705,8 @@ vir_bytes count; r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant, offset, vir_hw, bytes, D); - if (r != OK) - { - panic("DP8390", - "dp_user2nic_s: sys_safecopyfrom failed", r); + if (r != OK) { + panic("dp_user2nic_s: sys_safecopyfrom failed: %d", r); } count -= bytes; @@ -1776,7 +1770,7 @@ vir_bytes count; } if (i == 100) { - panic("", "dp8390: remote dma failed to complete", NO_NUM); + panic("dp8390: remote dma failed to complete"); } } @@ -1822,11 +1816,9 @@ vir_bytes count; r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant, offset, bytes); - if (r != OK) - { - panic(__FILE__, - "dp_pio8_user2nic_s: sys_safe_outsb failed", - r); + if (r != OK) { + panic("dp_pio8_user2nic_s: sys_safe_outsb failed: %d", + r); } count -= bytes; offset += bytes; @@ -1840,7 +1832,7 @@ vir_bytes count; } if (i == 100) { - panic("", "dp8390: remote dma failed to complete", NO_NUM); + panic("dp8390: remote dma failed to complete"); } } @@ -1896,10 +1888,8 @@ vir_bytes count; { r= sys_vircopy(user_proc, D, vir_user, SELF, D, (vir_bytes)&two_bytes[1], 1); - if (r != OK) - { - panic("DP8390", - "dp_pio16_user2nic: sys_vircopy failed", + if (r != OK) { + panic("dp_pio16_user2nic: sys_vircopy failed: %d", r); } outw(dep->de_data_port, *(u16_t *)two_bytes); @@ -1926,10 +1916,8 @@ vir_bytes count; assert(bytes == 1); r= sys_vircopy(user_proc, D, vir_user, SELF, D, (vir_bytes)&two_bytes[0], 1); - if (r != OK) - { - panic("DP8390", - "dp_pio16_user2nic: sys_vircopy failed", + if (r != OK) { + panic("dp_pio16_user2nic: sys_vircopy failed: %d", r); } count--; @@ -1951,7 +1939,7 @@ vir_bytes count; } if (i == 100) { - panic("", "dp8390: remote dma failed to complete", NO_NUM); + panic("dp8390: remote dma failed to complete"); } } @@ -2007,11 +1995,8 @@ vir_bytes count; { r= sys_safecopyfrom(user_proc, gid, offset, (vir_bytes)&two_bytes[1], 1, D); - if (r != OK) - { - panic("DP8390", - "dp_pio16_user2nic: sys_safecopyfrom failed", - r); + if (r != OK) { + panic("dp_pio16_user2nic: sys_safecopyfrom failed: %d", r); } outw(dep->de_data_port, *(u16_t *)two_bytes); count--; @@ -2026,11 +2011,8 @@ vir_bytes count; { r= sys_safe_outsw(dep->de_data_port, user_proc, gid, offset, ecount); - if (r != OK) - { - panic("DP8390", - "dp_pio16_user2nic: sys_safe_outsw failed", - r); + if (r != OK) { + panic("dp_pio16_user2nic: sys_safe_outsw failed: %d", r); } count -= ecount; offset += ecount; @@ -2041,11 +2023,8 @@ vir_bytes count; assert(bytes == 1); r= sys_safecopyfrom(user_proc, gid, offset, (vir_bytes)&two_bytes[0], 1, D); - if (r != OK) - { - panic("DP8390", - "dp_pio16_user2nic: sys_safecopyfrom failed", - r); + if (r != OK) { + panic("dp_pio16_user2nic: sys_safecopyfrom failed: %d", r); } count--; offset++; @@ -2065,7 +2044,7 @@ vir_bytes count; } if (i == 100) { - panic("", "dp8390: remote dma failed to complete", NO_NUM); + panic("dp8390: remote dma failed to complete"); } } @@ -2107,7 +2086,7 @@ vir_bytes count; iovp->iod_proc_nr, D, iovp->iod_iovec[i].iov_addr + offset, bytes); if (r != OK) - panic("DP8390", "dp_nic2user: sys_vircopy failed", r); + panic("dp_nic2user: sys_vircopy failed: %d", r); count -= bytes; vir_hw += bytes; @@ -2155,8 +2134,7 @@ vir_bytes count; iovp->iod_iovec[i].iov_grant, offset, vir_hw, bytes, D); if (r != OK) - panic("DP8390", - "dp_nic2user_s: sys_safecopyto failed", r); + panic("dp_nic2user_s: sys_safecopyto failed: %d", r); count -= bytes; vir_hw += bytes; @@ -2251,10 +2229,8 @@ vir_bytes count; r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant, offset, bytes); - if (r != OK) - { - panic(__FILE__, - "dp_pio8_nic2user_s: sys_safe_insb failed", r); + if (r != OK) { + panic("dp_pio8_nic2user_s: sys_safe_insb failed: %d", r); } count -= bytes; offset += bytes; @@ -2313,10 +2289,8 @@ vir_bytes count; { r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[1], user_proc, D, vir_user, 1); - if (r != OK) - { - panic("DP8390", - "dp_pio16_nic2user: sys_vircopy failed", + if (r != OK) { + panic("dp_pio16_nic2user: sys_vircopy failed: %d", r); } count--; @@ -2343,11 +2317,8 @@ vir_bytes count; *(u16_t *)two_bytes= inw(dep->de_data_port); r= sys_vircopy(SELF, D, (vir_bytes)&two_bytes[0], user_proc, D, vir_user, 1); - if (r != OK) - { - panic("DP8390", - "dp_pio16_nic2user: sys_vircopy failed", - r); + if (r != OK) { + panic("dp_pio16_nic2user: sys_vircopy failed: %d", r); } count--; offset++; @@ -2410,11 +2381,8 @@ vir_bytes count; { r= sys_safecopyto(user_proc, gid, offset, (vir_bytes)&two_bytes[1], 1, D); - if (r != OK) - { - panic("DP8390", - "dp_pio16_nic2user: sys_safecopyto failed", - r); + if (r != OK) { + panic("dp_pio16_nic2user: sys_safecopyto failed: %d", r); } count--; offset++; @@ -2428,11 +2396,9 @@ vir_bytes count; { r= sys_safe_insw(dep->de_data_port, user_proc, gid, offset, ecount); - if (r != OK) - { - panic("DP8390", - "dp_pio16_nic2user: sys_safe_insw failed", - r); + if (r != OK) { + panic("dp_pio16_nic2user: sys_safe_insw failed: %d", + r); } count -= ecount; offset += ecount; @@ -2446,8 +2412,7 @@ vir_bytes count; (vir_bytes)&two_bytes[0], 1, D); if (r != OK) { - panic("DP8390", - "dp_pio16_nic2user: sys_safecopyto failed", + panic("dp_pio16_nic2user: sys_safecopyto failed: %d", r); } count--; @@ -2602,7 +2567,7 @@ dpeth_t *dep; */ buf= malloc(size); if (buf == NULL) - panic(__FILE__, "map_hw_buffer: cannot malloc size", size); + panic("map_hw_buffer: cannot malloc size: %d", size); o= I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE); abuf= buf + o; printf("buf at 0x%x, abuf at 0x%x\n", buf, abuf); @@ -2614,7 +2579,7 @@ dpeth_t *dep; r = ENOSYS; #endif if (r != OK) - panic(__FILE__, "map_hw_buffer: sys_vm_map failed", r); + panic("map_hw_buffer: sys_vm_map failed: %d", r); dep->de_locmem = abuf; } @@ -2709,7 +2674,7 @@ int may_block; } if (r < 0) - panic("", "dp8390: send failed:", r); + panic("dp8390: send failed: %d", r); dep->de_read_s = 0; dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV); @@ -2723,7 +2688,7 @@ message *req; message *reply_mess; { if (send(req->m_source, reply_mess) != OK) - panic("", "dp8390: unable to mess_reply", NO_NUM); + panic("dp8390: unable to mess_reply"); } /*===========================================================================* @@ -2740,7 +2705,7 @@ void *loc_addr; r= sys_vircopy(user_proc, D, user_addr, SELF, D, (vir_bytes)loc_addr, count); if (r != OK) - panic("DP8390", "get_userdata: sys_vircopy failed", r); + panic("get_userdata: sys_vircopy failed: %d", r); } /*===========================================================================* @@ -2758,7 +2723,7 @@ void *loc_addr; r= sys_safecopyfrom(user_proc, grant, offset, (vir_bytes)loc_addr, count, D); if (r != OK) - panic("DP8390", "get_userdata: sys_safecopyfrom failed", r); + panic("get_userdata: sys_safecopyfrom failed: %d", r); } /*===========================================================================* @@ -2775,7 +2740,7 @@ void *loc_addr; r= sys_vircopy(SELF, D, (vir_bytes)loc_addr, user_proc, D, user_addr, count); if (r != OK) - panic("DP8390", "put_userdata: sys_vircopy failed", r); + panic("put_userdata: sys_vircopy failed: %d", r); } /*===========================================================================* @@ -2792,7 +2757,7 @@ void *loc_addr; r= sys_safecopyto(user_proc, grant, 0, (vir_bytes)loc_addr, count, D); if (r != OK) - panic("DP8390", "put_userdata: sys_safecopyto failed", r); + panic("put_userdata: sys_safecopyto failed: %d", r); } u8_t inb(port_t port) @@ -2804,7 +2769,7 @@ u8_t inb(port_t port) if (r != OK) { printf("inb failed for port 0x%x\n", port); - panic("DP8390","sys_inb failed", r); + panic("sys_inb failed: %d", r); } return value; } @@ -2816,7 +2781,7 @@ u16_t inw(port_t port) r= sys_inw(port, &value); if (r != OK) - panic("DP8390", "sys_inw failed", r); + panic("sys_inw failed: %d", r); return (u16_t) value; } @@ -2826,7 +2791,7 @@ void outb(port_t port, u8_t value) r= sys_outb(port, value); if (r != OK) - panic("DP8390", "sys_outb failed", r); + panic("sys_outb failed: %d", r); } void outw(port_t port, u16_t value) @@ -2835,7 +2800,7 @@ void outw(port_t port, u16_t value) r= sys_outw(port, value); if (r != OK) - panic("DP8390", "sys_outw failed", r); + panic("sys_outw failed: %d", r); } static void insb(port_t port, void *buf, size_t size) @@ -2854,7 +2819,7 @@ static void do_vir_insb(port_t port, int proc, vir_bytes buf, size_t size) r= sys_insb(port, proc, (void *) buf, size); if (r != OK) - panic("DP8390", "sys_sdevio failed", r); + panic("sys_sdevio failed: %d", r); } static void do_vir_insw(port_t port, int proc, vir_bytes buf, size_t size) @@ -2863,7 +2828,7 @@ static void do_vir_insw(port_t port, int proc, vir_bytes buf, size_t size) r= sys_insw(port, proc, (void *) buf, size); if (r != OK) - panic("DP8390", "sys_sdevio failed", r); + panic("sys_sdevio failed: %d", r); } static void do_vir_outsb(port_t port, int proc, vir_bytes buf, size_t size) @@ -2872,7 +2837,7 @@ static void do_vir_outsb(port_t port, int proc, vir_bytes buf, size_t size) r= sys_outsb(port, proc, (void *) buf, size); if (r != OK) - panic("DP8390", "sys_sdevio failed", r); + panic("sys_sdevio failed: %d", r); } static void do_vir_outsw(port_t port, int proc, vir_bytes buf, size_t size) @@ -2881,7 +2846,7 @@ static void do_vir_outsw(port_t port, int proc, vir_bytes buf, size_t size) r= sys_outsw(port, proc, (void *) buf, size); if (r != OK) - panic("DP8390", "sys_sdevio failed", r); + panic("sys_sdevio failed: %d", r); } /* diff --git a/drivers/dp8390/rtl8029.c b/drivers/dp8390/rtl8029.c index d2c7c337f..4bd6f76e0 100644 --- a/drivers/dp8390/rtl8029.c +++ b/drivers/dp8390/rtl8029.c @@ -84,11 +84,8 @@ struct dpeth *dep; continue; if (pcitab[i].did != did) continue; - if (pcitab[i].checkclass) - { - panic("", - "rtl_probe: class check not implemented", - NO_NUM); + if (pcitab[i].checkclass) { + panic("rtl_probe: class check not implemented"); } break; } @@ -121,7 +118,7 @@ struct dpeth *dep; bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0; if (bar < 0x400) - panic("", "base address is not properly configured", NO_NUM); + panic("base address is not properly configured"); dep->de_base_port= bar; @@ -340,7 +337,7 @@ u16_t w; micro_delay(1); } if (!(inb_reg3(dep, 1) & 1)) - panic("", "set_ee_word: device remains busy", NO_NUM); + panic("set_ee_word: device remains busy"); } static void ee_wds(dep) diff --git a/drivers/dpeth/3c501.c b/drivers/dpeth/3c501.c index 97e8104d5..d2e802ea7 100644 --- a/drivers/dpeth/3c501.c +++ b/drivers/dpeth/3c501.c @@ -153,7 +153,7 @@ static void el1_send(dpeth_t * dep, int from_int, int pktsize) txbuff->client = dep->de_client; user2mem(dep, txbuff); } else - panic(dep->de_name, "out of memory for Tx", NO_NUM); + panic("out of memory for Tx"); } else if ((txbuff = dep->de_xmitq_head) != NULL) { @@ -167,10 +167,10 @@ static void el1_send(dpeth_t * dep, int from_int, int pktsize) pktsize = txbuff->size; } else - panic(dep->de_name, "should not be sending ", NO_NUM); + panic("should not be sending "); if ((dep->de_flags & DEF_XMIT_BUSY)) { - if (from_int) panic(dep->de_name, "should not be sending ", NO_NUM); + if (from_int) panic("should not be sending "); getuptime(&now); if ((now - dep->de_xmit_start) > 4) { /* Transmitter timed out */ diff --git a/drivers/dpeth/3c503.c b/drivers/dpeth/3c503.c index 02cd09071..631ce110f 100644 --- a/drivers/dpeth/3c503.c +++ b/drivers/dpeth/3c503.c @@ -81,7 +81,7 @@ static void el2_init(dpeth_t * dep) /* Set interrupt level for 3c503 */ irq = (dep->de_irq &= ~DEI_DEFAULT); /* Strip the default flag. */ if (irq == 9) irq = 2; - if (irq < 2 || irq > 5) panic(dep->de_name, "bad 3c503 irq configuration", irq); + if (irq < 2 || irq > 5) panic("bad 3c503 irq configuration: %d", irq); outb_el2(dep, EL2_IDCFG, (0x04 << irq)); outb_el2(dep, EL2_DRQCNT, 0x08); /* Set burst size to 8 */ diff --git a/drivers/dpeth/3c509.c b/drivers/dpeth/3c509.c index a51e2e2cc..98a753662 100644 --- a/drivers/dpeth/3c509.c +++ b/drivers/dpeth/3c509.c @@ -131,7 +131,7 @@ static void el3_write_fifo(dpeth_t * dep, int pktsize) r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, bytes); if (r != OK) - panic(__FILE__, "el3_write_fifo: sys_safe_outsb failed", r); + panic("el3_write_fifo: sys_safe_outsb failed: %d", r); if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ dp_next_iovec(iovp); @@ -416,11 +416,11 @@ static void el3_open(dpeth_t * dep) AddrCfgReg = ((AddrCfgReg & EL3_CONFIG_IOBASE_MASK) << 4) + EL3_IO_BASE_ADDR; if (AddrCfgReg != dep->de_base_port) - panic(dep->de_name, "Bad I/O port for Etherlink board", NO_NUM); + panic("Bad I/O port for Etherlink board"); ResCfgReg >>= 12; dep->de_irq &= NOT(DEI_DEFAULT); /* Strips the default flag */ - if (ResCfgReg != dep->de_irq) panic(dep->de_name, "Bad IRQ for Etherlink board", NO_NUM); + if (ResCfgReg != dep->de_irq) panic("Bad IRQ for Etherlink board"); SetWindow(WNO_Setup); diff --git a/drivers/dpeth/8390.c b/drivers/dpeth/8390.c index 9293e5b13..74f887b3c 100644 --- a/drivers/dpeth/8390.c +++ b/drivers/dpeth/8390.c @@ -76,7 +76,7 @@ static void ns_start_xmit(dpeth_t * dep, int size, int pageno) */ static void mem_getblock(dpeth_t *dep, u16_t offset, int size, void *dst) { - panic(__FILE__, "mem_getblock: not converted to safecopies", NO_NUM); + panic("mem_getblock: not converted to safecopies"); #if 0 sys_nic2mem(dep->de_linmem + offset, SELF, dst, size); return; @@ -93,7 +93,7 @@ static void mem_nic2user(dpeth_t * dep, int pageno, int pktsize) iovec_dat_s_t *iovp = &dep->de_read_iovec; int bytes, ix = 0; - panic(__FILE__, "mem_nic2user: not converted to safecopies", NO_NUM); + panic("mem_nic2user: not converted to safecopies"); #if 0 /* Computes shared memory address (skipping receive header) */ @@ -141,7 +141,7 @@ static void mem_user2nic(dpeth_t *dep, int pageno, int pktsize) iovec_dat_s_t *iovp = &dep->de_write_iovec; int bytes, ix = 0; - panic(__FILE__, "mem_user2nic: not converted to safecopies", NO_NUM); + panic("mem_user2nic: not converted to safecopies"); #if 0 /* Computes shared memory address */ @@ -217,10 +217,8 @@ static void pio_nic2user(dpeth_t *dep, int pageno, int pktsize) bytes = dep->de_stoppage * DP_PAGESIZE - offset; r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, iov_offset, bytes); - if (r != OK) - { - panic(__FILE__, "pio_nic2user: sys_safe_insb failed", - r); + if (r != OK) { + panic("pio_nic2user: sys_safe_insb failed: %d", r); } pktsize -= bytes; iov_offset += bytes; @@ -232,7 +230,7 @@ static void pio_nic2user(dpeth_t *dep, int pageno, int pktsize) r= sys_safe_insb(dep->de_data_port, iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, iov_offset, bytes); if (r != OK) - panic(__FILE__, "pio_nic2user: sys_safe_insb failed", r); + panic("pio_nic2user: sys_safe_insb failed: %d", r); offset += bytes; if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ @@ -264,7 +262,7 @@ static void pio_user2nic(dpeth_t *dep, int pageno, int pktsize) r= sys_safe_outsb(dep->de_data_port, iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, bytes); if (r != OK) - panic(__FILE__, "pio_user2nic: sys_safe_outsb failed", r); + panic("pio_user2nic: sys_safe_outsb failed: %d", r); if (++ix >= IOVEC_NR) { /* Next buffer of I/O vector */ dp_next_iovec(iovp); @@ -277,7 +275,7 @@ static void pio_user2nic(dpeth_t *dep, int pageno, int pktsize) if (inb_reg0(dep, DP_ISR) & ISR_RDC) break; } if (ix == 100) { - panic(dep->de_name, RdmaErrMsg, NO_NUM); + panic(RdmaErrMsg); } return; } @@ -331,7 +329,7 @@ static void ns_send(dpeth_t * dep, int from_int, int size) int queue; if (queue = dep->de_sendq_head, dep->de_sendq[queue].sq_filled) { - if (from_int) panic(dep->de_name, "should not be sending ", NO_NUM); + if (from_int) panic("should not be sending "); dep->de_send_s = size; return; } @@ -654,7 +652,7 @@ static void dp_pio16_user2nic(dpeth_t *dep, int pageno, int pktsize) if (bytes > pktsize) bytes = pktsize; phys_user = numap(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_addr, bytes); - if (!phys_user) panic(dep->de_name, UmapErrMsg, NO_NUM); + if (!phys_user) panic(UmapErrMsg); if (odd_byte) { phys_copy(phys_user, phys_2bytes + 1, (phys_bytes) 1); @@ -691,7 +689,7 @@ static void dp_pio16_user2nic(dpeth_t *dep, int pageno, int pktsize) if (inb_reg0(dep, DP_ISR) & ISR_RDC) break; } if (ix == 100) { - panic(dep->de_name, RdmaErrMsg, NO_NUM); + panic(RdmaErrMsg); } return; } @@ -727,7 +725,7 @@ static void dp_pio16_nic2user(dpeth_t * dep, int nic_addr, int count) phys_user = numap(iovp->iod_proc_nr, iovp->iod_iovec[i].iov_addr, bytes); - if (!phys_user) panic(dep->de_name, UmapErrMsg, NO_NUM); + if (!phys_user) panic(UmapErrMsg); if (odd_byte) { phys_copy(phys_2bytes + 1, phys_user, (phys_bytes) 1); count--; diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index b6940063f..c4bb20c61 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -118,7 +118,7 @@ static void reply(dpeth_t * dep, int err, int m_type) dep->de_flags &= NOT(DEF_ACK_SEND | DEF_ACK_RECV); } else if (status != ELOCKED || err == OK) - panic(dep->de_name, SendErrMsg, status); + panic(SendErrMsg, status); return; } @@ -236,7 +236,7 @@ static void get_userdata_s(int user_proc, cp_grant_id_t grant, len = (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_t); if ((rc = sys_safecopyfrom(user_proc, grant, 0, (vir_bytes)loc_addr, len, D)) != OK) - panic(DevName, CopyErrMsg, rc); + panic(CopyErrMsg, rc); return; } @@ -351,7 +351,7 @@ static void do_init(message * mp) reply_mess.m3_i2 = DE_PORT_NR; DEBUG(printf("\t reply %d\n", reply_mess.m_type)); if (send(mp->m_source, &reply_mess) != OK) /* Can't send */ - panic(portname, SendErrMsg, mp->m_source); + panic(SendErrMsg, mp->m_source); return; } @@ -402,7 +402,7 @@ static void do_vwrite_s(message * mp) port = mp->DL_PORT; if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */ - panic(__FILE__, PortErrMsg, EINVAL); + panic(PortErrMsg, EINVAL); dep = &de_table[port]; dep->de_client = mp->DL_PROC; @@ -410,7 +410,7 @@ static void do_vwrite_s(message * mp) if (dep->de_mode == DEM_ENABLED) { if (dep->de_flags & DEF_SENDING) /* Is sending in progress? */ - panic(dep->de_name, "send already in progress ", NO_NUM); + panic("send already in progress "); dep->de_write_iovec.iod_proc_nr = mp->DL_PROC; get_userdata_s(mp->DL_PROC, mp->DL_GRANT, 0, @@ -420,7 +420,7 @@ static void do_vwrite_s(message * mp) dep->de_write_iovec.iod_iovec_offset = 0; size = calc_iovec_size(&dep->de_write_iovec); if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE) - panic(dep->de_name, SizeErrMsg, size); + panic(SizeErrMsg, size); dep->de_flags |= DEF_SENDING; (*dep->de_sendf) (dep, FALSE, size); @@ -443,7 +443,7 @@ static void do_vread_s(message * mp) port = mp->DL_PORT; if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */ - panic(__FILE__, PortErrMsg, EINVAL); + panic(PortErrMsg, EINVAL); dep = &de_table[port]; dep->de_client = mp->DL_PROC; @@ -451,7 +451,7 @@ static void do_vread_s(message * mp) if (dep->de_mode == DEM_ENABLED) { if (dep->de_flags & DEF_READING) /* Reading in progress */ - panic(dep->de_name, "read already in progress", NO_NUM); + panic("read already in progress"); dep->de_read_iovec.iod_proc_nr = mp->DL_PROC; get_userdata_s(mp->DL_PROC, (cp_grant_id_t) mp->DL_GRANT, 0, @@ -460,7 +460,7 @@ static void do_vread_s(message * mp) dep->de_read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; dep->de_read_iovec.iod_iovec_offset = 0; size = calc_iovec_size(&dep->de_read_iovec); - if (size < ETH_MAX_PACK_SIZE) panic(dep->de_name, SizeErrMsg, size); + if (size < ETH_MAX_PACK_SIZE) panic(SizeErrMsg, size); dep->de_flags |= DEF_READING; (*dep->de_recvf) (dep, FALSE, size); @@ -486,7 +486,7 @@ static void do_getstat_s(message * mp) port = mp->DL_PORT; if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */ - panic(__FILE__, PortErrMsg, EINVAL); + panic(PortErrMsg, EINVAL); dep = &de_table[port]; dep->de_client = mp->DL_PROC; @@ -495,7 +495,7 @@ static void do_getstat_s(message * mp) if ((rc = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes)&dep->de_stat, (vir_bytes) sizeof(dep->de_stat), 0)) != OK) - panic(DevName, CopyErrMsg, rc); + panic(CopyErrMsg, rc); reply(dep, OK, DL_STAT_REPLY); return; } @@ -510,7 +510,7 @@ message *mp; mp->m_type= DL_NAME_REPLY; r= send(mp->m_source, mp); if (r != OK) - panic("dpeth", "do_getname: send failed: %d\n", r); + panic("do_getname: send failed: %d", r); } /* @@ -524,7 +524,7 @@ static void do_stop(message * mp) port = mp->DL_PORT; if (port < 0 || port >= DE_PORT_NR) /* Check for illegal port number */ - panic(__FILE__, PortErrMsg, EINVAL); + panic(PortErrMsg, EINVAL); dep = &de_table[port]; if (dep->de_mode == DEM_ENABLED && (dep->de_flags & DEF_ENABLED)) { @@ -600,7 +600,7 @@ PUBLIC int main(int argc, char **argv) while (TRUE) { if ((rc = sef_receive(ANY, &m)) != OK){ - panic(__FILE__, RecvErrMsg, rc); + panic(RecvErrMsg, rc); } DEBUG(printf("eth: got message %d, ", m.m_type)); @@ -624,7 +624,7 @@ PUBLIC int main(int argc, char **argv) break; default: /* Invalid message type */ - panic(DevName, TypeErrMsg, m.m_type); + panic(TypeErrMsg, m.m_type); break; } /* message processed, get another one */ @@ -651,7 +651,7 @@ PUBLIC int main(int argc, char **argv) do_stop(&m); break; default: /* Invalid message type */ - panic(DevName, TypeErrMsg, m.m_type); + panic(TypeErrMsg, m.m_type); break; } } diff --git a/drivers/dpeth/netbuff.c b/drivers/dpeth/netbuff.c index 5003c7ee2..2e40db004 100644 --- a/drivers/dpeth/netbuff.c +++ b/drivers/dpeth/netbuff.c @@ -123,7 +123,7 @@ PUBLIC void mem2user(dpeth_t *dep, buff_t *rxbuff) r= sys_safecopyto(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, (vir_bytes)buffer, bytes, D); if (r != OK) - panic(__FILE__, "mem2user: sys_safecopyto failed", r); + panic("mem2user: sys_safecopyto failed: %d", r); buffer += bytes; if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ @@ -153,7 +153,7 @@ PUBLIC void user2mem(dpeth_t *dep, buff_t *txbuff) r= sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[ix].iov_grant, 0, (vir_bytes)buffer, bytes, D); if (r != OK) - panic(__FILE__, "user2mem: sys_safecopyfrom failed", r); + panic("user2mem: sys_safecopyfrom failed: %d", r); buffer += bytes; if (++ix >= IOVEC_NR) { /* Next buffer of IO vector */ diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index fe40ef69f..6570c234e 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) { if ((r= sef_receive(ANY, &m)) != OK) { - panic("e1000", "sef_receive failed", r); + panic("sef_receive failed: %d", r); } if (is_notify(m.m_type)) { @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) case DL_GETSTAT_S: e1000_getstat_s(&m); break; case DL_GETNAME: e1000_getname(&m); break; default: - panic("e1000", "illegal message", m.m_type); + panic("illegal message: %d", m.m_type); } } } @@ -145,7 +145,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Verify command-line arguments. */ if (env_argc < 1) { - panic("e1000", "no program name given in argc/argv", NO_NUM); + panic("no program name given in argc/argv"); } else (progname = strrchr(env_argv[0],'/')) ? progname++ @@ -157,7 +157,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Perform calibration. */ if((r = tsc_calibrate()) != OK) { - panic("e1000", "tsc_calibrate failed", r); + panic("tsc_calibrate failed: %d", r); } /* Try to notify inet that we are present (again) */ if ((r = ds_retrieve_label_num("inet", &tasknr)) == OK) @@ -308,7 +308,7 @@ PRIVATE int e1000_probe(e1000_t *e) /* Reserve PCI resources found. */ if ((r = pci_reserve_ok(devind)) != OK) { - panic("e1000", "failed to reserve PCI device", r); + panic("failed to reserve PCI device: %d", r); } /* Read PCI configuration. */ e->irq = pci_attr_r8(devind, PCI_ILR); @@ -316,10 +316,8 @@ PRIVATE int e1000_probe(e1000_t *e) 0x20000); /* Verify mapped registers. */ - if (e->regs == (u8_t *) -1) - { - panic("e1000", "failed to map hardware registers from PCI\n", - NO_NUM); + if (e->regs == (u8_t *) -1) { + panic("failed to map hardware registers from PCI"); } /* Optionally map flash memory. */ if (pci_attr_r32(devind, PCI_BAR_3)) @@ -368,11 +366,11 @@ e1000_t *e; */ if ((r = sys_irqsetpolicy(e->irq, 0, &e->irq_hook)) != OK) { - panic(e->name, "sys_irqsetpolicy failed", r); + panic("sys_irqsetpolicy failed: %d", r); } if ((r = sys_irqenable(&e->irq_hook)) != OK) { - panic(e->name, "sys_irqenable failed", r); + panic("sys_irqenable failed: %d", r); } /* Reset hardware. */ e1000_reset_hw(e); @@ -487,10 +485,8 @@ e1000_t *e; { if ((e->rx_desc = alloc_contig(sizeof(e1000_rx_desc_t) * e->rx_desc_count, AC_ALIGN4K, - &rx_desc_p)) == NULL) - { - panic(e->name, "failed to allocate RX descriptors", - NO_NUM); + &rx_desc_p)) == NULL) { + panic("failed to allocate RX descriptors"); } memset(e->rx_desc, 0, sizeof(e1000_rx_desc_t) * e->rx_desc_count); @@ -503,7 +499,7 @@ e1000_t *e; if ((e->rx_buffer = alloc_contig(e->rx_buffer_size, AC_ALIGN4K, &rx_buff_p)) == NULL) { - panic(e->name, "failed to allocate RX buffers", NO_NUM); + panic("failed to allocate RX buffers"); } /* Setup receive descriptors. */ for (i = 0; i < E1000_RXDESC_NR; i++) @@ -518,10 +514,8 @@ e1000_t *e; { if ((e->tx_desc = alloc_contig(sizeof(e1000_tx_desc_t) * e->tx_desc_count, AC_ALIGN4K, - &tx_desc_p)) == NULL) - { - panic(e->name, "failed to allocate TX descriptors", - NO_NUM); + &tx_desc_p)) == NULL) { + panic("failed to allocate TX descriptors"); } memset(e->tx_desc, 0, sizeof(e1000_tx_desc_t) * e->tx_desc_count); @@ -534,7 +528,7 @@ e1000_t *e; if ((e->tx_buffer = alloc_contig(e->tx_buffer_size, AC_ALIGN4K, &tx_buff_p)) == NULL) { - panic(e->name, "failed to allocate TX buffers", NO_NUM); + panic("failed to allocate TX buffers"); } /* Setup transmit descriptors. */ for (i = 0; i < E1000_RXDESC_NR; i++) @@ -614,7 +608,7 @@ int from_int; (vir_bytes) iovec, e->tx_message.DL_COUNT * sizeof(iovec_s_t), D)) != OK) { - panic(e->name, "sys_safecopyfrom() failed", r); + panic("sys_safecopyfrom() failed: %d", r); } /* Find the head, tail and current descriptors. */ head = e1000_reg_read(e, E1000_REG_TDH); @@ -638,7 +632,7 @@ int from_int; (tail * E1000_IOBUF_SIZE), size, D)) != OK) { - panic(e->name, "sys_safecopyfrom() failed", r); + panic("sys_safecopyfrom() failed: %d", r); } /* Mark this descriptor ready. */ desc->status = 0; @@ -702,7 +696,7 @@ int from_int; (vir_bytes) iovec, e->rx_message.DL_COUNT * sizeof(iovec_s_t), D)) != OK) { - panic(e->name, "sys_safecopyfrom() failed", r); + panic("sys_safecopyfrom() failed: %d", r); } /* Find the head, tail and current descriptors. */ head = e1000_reg_read(e, E1000_REG_RDH); @@ -737,7 +731,7 @@ int from_int; (cur * E1000_IOBUF_SIZE), size, D)) != OK) { - panic(e->name, "sys_safecopyto() failed", r); + panic("sys_safecopyto() failed: %d", r); } bytes += size; } @@ -790,7 +784,7 @@ message *mp; mp->DL_PORT = mp->DL_PORT; mp->DL_STAT = OK; if((r=send(mp->m_source, mp)) != OK) - panic("e1000", "e1000_getstat: send() failed", r); + panic("e1000_getstat: send() failed: %d", r); } /*===========================================================================* @@ -811,7 +805,7 @@ message *mp; mp->m_type = DL_NAME_REPLY; if ((r = send(mp->m_source, mp)) != OK) { - panic("e1000", "e1000_getname: send() failed", r); + panic("e1000_getname: send() failed: %d", r); } } @@ -837,7 +831,7 @@ message *mp; /* Re-enable interrupts. */ if (sys_irqenable(&e->irq_hook) != OK) { - panic("e1000", "failed to re-enable IRQ", NO_NUM); + panic("failed to re-enable IRQ"); } /* Read the Interrupt Cause Read register. */ @@ -908,7 +902,7 @@ int num; */ if (num < 0 || num >= E1000_PORT_NR) { - panic("e1000", "invalid port number given", num); + panic("invalid port number given: %d", num); } /* @@ -916,7 +910,7 @@ int num; */ if (!(e1000_table[num].status & E1000_DETECTED)) { - panic("e1000", "inactive port number given", num); + panic("inactive port number given: %d", num); } return &e1000_table[num]; } @@ -1260,7 +1254,7 @@ int may_block; /* Acknowledge to INET. */ if ((r = send(e->client, &msg)) != OK) { - panic("e1000", "send() failed", r); + panic("send() failed: %d", r); } } @@ -1273,6 +1267,6 @@ message *reply_mess; { if (send(req->m_source, reply_mess) != OK) { - panic("e1000", "unable to send reply message", NO_NUM); + panic("unable to send reply message"); } } diff --git a/drivers/filter/driver.c b/drivers/filter/driver.c index dd7c4af53..3396f1e72 100644 --- a/drivers/filter/driver.c +++ b/drivers/filter/driver.c @@ -61,7 +61,7 @@ static int driver_open(int which) gid = cpf_grant_direct(driver[which].endpt, (vir_bytes) &part, sizeof(part), CPF_WRITE); if(!GRANT_VALID(gid)) - panic(__FILE__, "invalid grant", gid); + panic("invalid grant: %d", gid); msg.m_type = DEV_IOCTL_S; msg.REQUEST = DIOCGETP; @@ -165,7 +165,7 @@ void driver_init(void) check_driver(DRIVER_MAIN); } else if (driver_open(DRIVER_MAIN) != OK) { - panic(__FILE__, "unhandled driver_open failure", NO_NUM); + panic("unhandled driver_open failure"); } if(USE_MIRROR) { @@ -174,7 +174,7 @@ void driver_init(void) if(!strcmp(driver[DRIVER_MAIN].label, driver[DRIVER_BACKUP].label)) { - panic(__FILE__, "same driver: not tested", NO_NUM); + panic("same driver: not tested"); } r = ds_retrieve_label_num(driver[DRIVER_BACKUP].label, @@ -186,8 +186,7 @@ void driver_init(void) check_driver(DRIVER_BACKUP); } else if (driver_open(DRIVER_BACKUP) != OK) { - panic(__FILE__, "unhandled driver_open failure", - NO_NUM); + panic("unhandled driver_open failure"); } } } @@ -377,7 +376,7 @@ static int check_problem(int which, int problem, int retries, int *tell_rs) break; default: - panic(__FILE__, "invalid problem", problem); + panic("invalid problem: %d", problem); } /* At this point, the driver will be restarted. */ @@ -441,7 +440,7 @@ static void restart_driver(int which, int tell_rs) r = sendrec(RS_PROC_NR, &msg); if (r != OK || msg.m_type != OK) - panic(__FILE__, "RS request failed", r); + panic("RS request failed: %d", r); #if DEBUG printf("Filter: RS call succeeded\n"); @@ -545,7 +544,7 @@ static int flt_senda(message *mess, int which) r = senda(amsgtable, 2); if(r != OK) - panic(__FILE__, "senda returned error", r); + panic("senda returned error: %d", r); return r; } @@ -585,7 +584,7 @@ static int flt_receive(message *mess, int which) for (;;) { r = sef_receive(ANY, mess); if(r != OK) - panic(__FILE__, "sef_receive returned error", r); + panic("sef_receive returned error: %d", r); if(mess->m_source == CLOCK && is_notify(mess->m_type)) { if (mess->NOTIFY_TIMESTAMP < flt_alarm(-1)) { @@ -727,7 +726,7 @@ static int do_sendrec_both(message *m1, message *m2) } else if (ma.m_source == driver[DRIVER_BACKUP].endpt) { which = DRIVER_MAIN; } else { - panic(__FILE__, "message from unexpected source", + panic("message from unexpected source: %d", ma.m_source); } @@ -822,7 +821,7 @@ static int single_grant(endpoint_t endpt, vir_bytes buf, int access, grant = cpf_grant_direct(endpt, buf, chunk, access); if (!GRANT_VALID(grant)) - panic(__FILE__, "invalid grant", grant); + panic("invalid grant: %d", grant); vector[count].iov_grant = grant; vector[count].iov_size = chunk; @@ -836,7 +835,7 @@ static int single_grant(endpoint_t endpt, vir_bytes buf, int access, sizeof(vector[0]) * count, CPF_READ | CPF_WRITE); if (!GRANT_VALID(*gid)) - panic(__FILE__, "invalid grant", *gid); + panic("invalid grant: %d", *gid); return count; } diff --git a/drivers/filter/main.c b/drivers/filter/main.c index b84036783..d13e2db83 100644 --- a/drivers/filter/main.c +++ b/drivers/filter/main.c @@ -189,7 +189,7 @@ static int do_vrdwt(int flag_rw) grants = m_in.COUNT; if((r = sys_safecopyfrom(who_e, grant_id, 0, (vir_bytes) iov_proc, grants * sizeof(iovec_t), D)) != OK) { - panic(__FILE__, "copying in grant vector failed", r); + panic("copying in grant vector failed: %d", r); } pos = make64(m_in.POSITION, m_in.HIGHPOS); @@ -240,7 +240,7 @@ static int do_vrdwt(int flag_rw) /* Copy the caller's grant-table back. */ if((r = sys_safecopyto(who_e, grant_id, 0, (vir_bytes) iov_proc, grants * sizeof(iovec_t), D)) != OK) { - panic(__FILE__, "copying out grant vector failed", r); + panic("copying out grant vector failed: %d", r); } flt_free(buffer, size, buf_array); @@ -405,7 +405,7 @@ int main(int argc, char *argv[]) for (;;) { /* Wait for request. */ if(sef_receive(ANY, &m_in) != OK) { - panic(__FILE__, "sef_receive failed", NO_NUM); + panic("sef_receive failed"); } #if DEBUG2 @@ -480,7 +480,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) } if ((buf_array = flt_malloc(BUF_SIZE, NULL, 0)) == NULL) - panic(__FILE__, "no memory available", NO_NUM); + panic("no memory available"); sum_init(); diff --git a/drivers/filter/sum.c b/drivers/filter/sum.c index 86686da1c..e5554fbeb 100644 --- a/drivers/filter/sum.c +++ b/drivers/filter/sum.c @@ -28,7 +28,7 @@ void sum_init(void) rb1_array = flt_malloc(SBUF_SIZE, NULL, 0); if (ext_array == NULL || rb0_array == NULL || rb1_array == NULL) - panic(__FILE__, "no memory available", NO_NUM); + panic("no memory available"); } /*===========================================================================* @@ -92,7 +92,7 @@ static void calc_sum(unsigned sector, char *data, char *sum) break; default: - panic(__FILE__, "invalid checksum type", SUM_TYPE); + panic("invalid checksum type: %d", SUM_TYPE); } } @@ -252,12 +252,12 @@ static int make_sum(sector_t current_sector, sector_t sectors_left) size = sectors_left * SECTOR_SIZE; if (group_left != NR_SUM_SEC - sector_in_group) - panic(__FILE__, "group_left assertion", 0); + panic("group_left assertion: %d", 0); gap = group_left - sectors_left; if (gap <= 0) - panic(__FILE__, "gap assertion", 0); + panic("gap assertion: %d", 0); if ((r = read_sectors(extp + size, LOG2PHYS(current_sector) + sectors_left, diff --git a/drivers/filter/util.c b/drivers/filter/util.c index 3e3274093..a0f8144cf 100644 --- a/drivers/filter/util.c +++ b/drivers/filter/util.c @@ -21,7 +21,7 @@ char *flt_malloc(size_t size, char *sbuf, size_t ssize) return sbuf; if(!(p = alloc_contig(size, 0, NULL))) - panic(__FILE__, "out of memory", size); + panic("out of memory: %d", size); return p; } @@ -66,17 +66,17 @@ clock_t flt_alarm(clock_t dt) r = sys_setalarm(dt, 0); if(r != OK) - panic(__FILE__, "sys_setalarm failed", r); + panic("sys_setalarm failed: %d", r); if(dt == 0) { if(!next_alarm) - panic(__FILE__, "clearing unset alarm", r); + panic("clearing unset alarm: %d", r); next_alarm = 0; } else { if(next_alarm) - panic(__FILE__, "overwriting alarm", r); + panic("overwriting alarm: %d", r); if ((r = getuptime(&next_alarm)) != OK) - panic(__FILE__, "getuptime failed", r); + panic("getuptime failed: %d", r); next_alarm += dt; } diff --git a/drivers/floppy/floppy.c b/drivers/floppy/floppy.c index 557af62a8..fcf8e5d87 100644 --- a/drivers/floppy/floppy.c +++ b/drivers/floppy/floppy.c @@ -344,7 +344,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) if(!(floppy_buf = alloc_contig(2*DMA_BUF_SIZE, AC_LOWER16M | AC_ALIGN4K, &floppy_buf_phys))) - panic("FLOPPY", "couldn't allocate dma buffer", NO_NUM); + panic("couldn't allocate dma buffer"); f_next_timeout = TMR_NEVER; tmr_inittimer(&f_tmr_timeout); @@ -361,9 +361,9 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) */ irq_hook_id = FLOPPY_IRQ; if ((s=sys_irqsetpolicy(FLOPPY_IRQ, 0, &irq_hook_id )) != OK) - panic("FLOPPY", "Couldn't set IRQ policy", s); + panic("Couldn't set IRQ policy: %d", s); if ((s=sys_irqenable(&irq_hook_id)) != OK) - panic("FLOPPY", "Couldn't enable IRQs", s); + panic("Couldn't enable IRQs: %d", s); /* Ignore signals */ signal(SIGHUP, SIG_IGN); @@ -384,7 +384,7 @@ PRIVATE void f_expire_tmrs(struct driver *dp, message *m_ptr) /* Get the current time to compare the timers against. */ if ((s=getuptime(&now)) != OK) - panic("FLOPPY","Couldn't get uptime from clock.", s); + panic("Couldn't get uptime from clock: %d", s); /* Scan the timers queue for expired timers. Dispatch the watchdog function * for each expired timers. FLOPPY watchdog functions are f_tmr_timeout() @@ -396,7 +396,7 @@ PRIVATE void f_expire_tmrs(struct driver *dp, message *m_ptr) } else { /* set new sync alarm */ f_next_timeout = f_timers->tmr_exp_time; if ((s=sys_setalarm(f_next_timeout, 1)) != OK) - panic("FLOPPY","Couldn't set synchronous alarm.", s); + panic("Couldn't set synchronous alarm: %d", s); } } @@ -413,7 +413,7 @@ tmr_func_t watchdog; /* watchdog function to be called */ /* Get the current time. */ if ((s=getuptime(&now)) != OK) - panic("FLOPPY","Couldn't get uptime from clock.", s); + panic("Couldn't get uptime from clock: %d", s); /* Add the timer to the local timer queue. */ tmrs_settimer(&f_timers, tp, now + delta, watchdog, NULL); @@ -425,7 +425,7 @@ tmr_func_t watchdog; /* watchdog function to be called */ if (f_timers->tmr_exp_time != f_next_timeout) { f_next_timeout = f_timers->tmr_exp_time; if ((s=sys_setalarm(f_next_timeout, 1)) != OK) - panic("FLOPPY","Couldn't set synchronous alarm.", s); + panic("Couldn't set synchronous alarm: %d", s); } } @@ -544,7 +544,7 @@ unsigned nr_req; /* length of request vector */ SECTOR_SIZE + iov_offset, (vir_bytes) &fmt_param, (phys_bytes) sizeof(fmt_param), D); if(s != OK) - panic("FLOPPY", "sys_safecopyfrom failed", s); + panic("sys_safecopyfrom failed: %d", s); } else { memcpy(&fmt_param, (void *) (iov->iov_addr + SECTOR_SIZE + iov_offset), @@ -611,7 +611,7 @@ unsigned nr_req; /* length of request vector */ cmd[2] = SPEC2; (void) fdc_command(cmd, 3); if ((s=sys_outb(FDC_RATE, f_dp->rate)) != OK) - panic("FLOPPY","Sys_outb failed", s); + panic("Sys_outb failed: %d", s); prev_dp = f_dp; } @@ -649,7 +649,7 @@ unsigned nr_req; /* length of request vector */ (vir_bytes) floppy_buf, (phys_bytes) SECTOR_SIZE, D); if(s != OK) - panic("FLOPPY", "sys_safecopyfrom failed", s); + panic("sys_safecopyfrom failed: %d", s); } else { memcpy(floppy_buf, (void *) (*ug + *up), SECTOR_SIZE); } @@ -675,7 +675,7 @@ unsigned nr_req; /* length of request vector */ (vir_bytes) floppy_buf, (phys_bytes) SECTOR_SIZE, D); if(s != OK) - panic("FLOPPY", "sys_safecopyto failed", s); + panic("sys_safecopyto failed: %d", s); } else { memcpy((void *) (*ug + *up), floppy_buf, SECTOR_SIZE); } @@ -745,7 +745,7 @@ PRIVATE int dma_setup( /* First check the DMA memory address not to exceed maximum. */ if (floppy_buf_phys != (floppy_buf_phys & DMA_ADDR_MASK)) { - report("FLOPPY", "DMA denied because address out of range", NO_NUM); + printf("floppy: DMA denied because address out of range"); return(EIO); } @@ -763,7 +763,7 @@ PRIVATE int dma_setup( pv_set(byte_out[8], DMA_INIT, 2); /* some sort of enable */ if ((s=sys_voutb(byte_out, 9)) != OK) - panic("FLOPPY","Sys_voutb in dma_setup() failed", s); + panic("Sys_voutb in dma_setup() failed: %d", s); return(OK); } @@ -791,7 +791,7 @@ PRIVATE void start_motor(void) if ((s=sys_outb(DOR, (motor_status << MOTOR_SHIFT) | ENABLE_INT | f_drive)) != OK) - panic("FLOPPY","Sys_outb in start_motor() failed", s); + panic("Sys_outb in start_motor() failed: %d", s); /* If the motor was already running, we don't have to wait for it. */ if (running) return; /* motor was already running */ @@ -831,7 +831,7 @@ PRIVATE void stop_motor(timer_t *tp) int s; motor_status &= ~(1 << tmr_arg(tp)->ta_int); if ((s=sys_outb(DOR, (motor_status << MOTOR_SHIFT) | ENABLE_INT)) != OK) - panic("FLOPPY","Sys_outb in stop_motor() failed", s); + panic("Sys_outb in stop_motor() failed: %d", s); } /*===========================================================================* @@ -843,7 +843,7 @@ PRIVATE void floppy_stop(struct driver *dp, sigset_t *set) int s; if (sigismember(set, SIGTERM)) { if ((s=sys_outb(DOR, ENABLE_INT)) != OK) - panic("FLOPPY","Sys_outb in floppy_stop() failed", s); + panic("Sys_outb in floppy_stop() failed: %d", s); exit(0); } } @@ -1010,20 +1010,20 @@ PRIVATE int fdc_results(void) * the perfection of the mirror. */ if ((s=sys_inb(FDC_STATUS, &status)) != OK) - panic("FLOPPY","Sys_inb in fdc_results() failed", s); + panic("Sys_inb in fdc_results() failed: %d", s); status &= (MASTER | DIRECTION | CTL_BUSY); if (status == (MASTER | DIRECTION | CTL_BUSY)) { unsigned long tmp_r; if (result_nr >= MAX_RESULTS) break; /* too many results */ if ((s=sys_inb(FDC_DATA, &tmp_r)) != OK) - panic("FLOPPY","Sys_inb in fdc_results() failed", s); + panic("Sys_inb in fdc_results() failed: %d", s); f_results[result_nr] = tmp_r; result_nr ++; continue; } if (status == MASTER) { /* all read */ if ((s=sys_irqenable(&irq_hook_id)) != OK) - panic("FLOPPY", "Couldn't enable IRQs", s); + panic("Couldn't enable IRQs: %d", s); return(OK); /* only good exit */ } @@ -1032,7 +1032,7 @@ PRIVATE int fdc_results(void) need_reset = TRUE; /* controller chip must be reset */ if ((s=sys_irqenable(&irq_hook_id)) != OK) - panic("FLOPPY", "Couldn't enable IRQs", s); + panic("Couldn't enable IRQs: %d", s); return(ERR_STATUS); } @@ -1087,12 +1087,12 @@ PRIVATE void fdc_out( return; } if ((s=sys_inb(FDC_STATUS, &status)) != OK) - panic("FLOPPY","Sys_inb in fdc_out() failed", s); + panic("Sys_inb in fdc_out() failed: %d", s); } while ((status & (MASTER | DIRECTION)) != (MASTER | 0)); if ((s=sys_outb(FDC_DATA, val)) != OK) - panic("FLOPPY","Sys_outb in fdc_out() failed", s); + panic("Sys_outb in fdc_out() failed: %d", s); } /*===========================================================================* @@ -1166,7 +1166,7 @@ PRIVATE void f_reset(void) pv_set(byte_out[0], DOR, 0); /* strobe reset bit low */ pv_set(byte_out[1], DOR, ENABLE_INT); /* strobe it high again */ if ((s=sys_voutb(byte_out, 2)) != OK) - panic("FLOPPY", "Sys_voutb in f_reset() failed", s); + panic("Sys_voutb in f_reset() failed: %d", s); /* A synchronous alarm timer was set in fdc_command. Expect an interrupt, * but be prepared to handle a timeout. diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 7a51eaacb..7499279a0 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -278,7 +278,7 @@ PRIVATE void handle_hw_intr(void) r= sys_irqenable(&fp->fxp_hook); if (r != OK) { - panic("FXP", "unable enable interrupts", r); + panic("unable enable interrupts: %d", r); } if (!fp->fxp_got_int) @@ -310,7 +310,7 @@ int main(int argc, char *argv[]) while (TRUE) { if ((r= sef_receive(ANY, &m)) != OK) - panic("FXP","sef_receive failed", r); + panic("sef_receive failed: %d", r); if (is_notify(m.m_type)) { switch (_ENDPOINT_P(m.m_source)) { @@ -332,7 +332,7 @@ int main(int argc, char *argv[]) fxp_expire_timers(); break; default: - panic("FXP"," illegal notify from", m.m_source); + panic(" illegal notify from: %d", m.m_source); } /* get new message */ @@ -352,7 +352,7 @@ int main(int argc, char *argv[]) case DL_GETSTAT_S: fxp_getstat_s(&m); break; case DL_GETNAME: fxp_getname(&m); break; default: - panic("FXP"," illegal message", m.m_type); + panic(" illegal message: %d", m.m_type); } } } @@ -387,7 +387,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) system_hz = sys_hz(); if (env_argc < 1) - panic("FXP", "A head which at this time has no name", NO_NUM); + panic("A head which at this time has no name"); (progname=strrchr(env_argv[0],'/')) ? progname++ : (progname=env_argv[0]); @@ -398,12 +398,12 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) eth_ign_proto= htons((u16_t) v); if(!(fxp_table = alloc_contig(ft, 0, &fxp_table_phys))) - panic("FXP","couldn't allocate table", ENOMEM); + panic("couldn't allocate table: %d", ENOMEM); memset(fxp_table, 0, ft); if((r=tsc_calibrate()) != OK) - panic("FXP","tsc_calibrate failed", r); + panic("tsc_calibrate failed: %d", r); /* Try to notify inet that we are present (again) */ r= ds_retrieve_label_num("inet", &tasknr); @@ -595,10 +595,8 @@ static int fxp_probe(fxp_t *fp) continue; if (pcitab_fxp[i].did != did) continue; - if (pcitab_fxp[i].checkclass) - { - panic("FXP","fxp_probe: class check not implemented", - NO_NUM); + if (pcitab_fxp[i].checkclass) { + panic("fxp_probe: class check not implemented"); } break; } @@ -630,10 +628,8 @@ static int fxp_probe(fxp_t *fp) pci_reserve(devind); bar= pci_attr_r32(devind, PCI_BAR_2) & 0xffffffe0; - if (bar < 0x400) - { - panic("FXP","fxp_probe: base address is not properly configured", - NO_NUM); + if (bar < 0x400) { + panic("fxp_probe: base address is not properly configured"); } fp->fxp_base_port= bar; @@ -819,7 +815,7 @@ fxp_t *fp; } break; default: - panic("FXP","fxp_conf_hw: bad device type", fp->fxp_type); + panic("fxp_conf_hw: bad device type: %d", fp->fxp_type); } #if VERBOSE @@ -852,13 +848,13 @@ fxp_t *fp; fp->fxp_hook = fp->fxp_irq; r= sys_irqsetpolicy(fp->fxp_irq, 0, &fp->fxp_hook); if (r != OK) - panic("FXP","sys_irqsetpolicy failed", r); + panic("sys_irqsetpolicy failed: %d", r); fxp_reset_hw(fp); r= sys_irqenable(&fp->fxp_hook); if (r != OK) - panic("FXP","sys_irqenable failed", r); + panic("sys_irqenable failed: %d", r); /* Reset PHY? */ @@ -868,7 +864,7 @@ fxp_t *fp; r= sys_umap(SELF, VM_D, (vir_bytes)&fp->fxp_stat, sizeof(fp->fxp_stat), &bus_addr); if (r != OK) - panic("FXP","sys_umap failed", r); + panic("sys_umap failed: %d", r); fxp_cu_ptr_cmd(fp, SC_CU_LOAD_DCA, bus_addr, TRUE /* check idle */); /* Ack previous interrupts */ @@ -920,10 +916,8 @@ fxp_t *fp; tot_bufsize += 4096 - (tot_bufsize % 4096); alloc_bufsize= tot_bufsize; alloc_buf= alloc_contig(alloc_bufsize, AC_ALIGN4K, &ph); - if (alloc_buf == NULL) - { - panic(__FILE__, "fxp_init_buf: unable to alloc_contig size", - alloc_bufsize); + if (alloc_buf == NULL) { + panic("fxp_init_buf: unable to alloc_contig size: %d", alloc_bufsize); } buf= (phys_bytes)alloc_buf; @@ -936,7 +930,7 @@ fxp_t *fp; r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_rx_buf, rx_totbufsize, &fp->fxp_rx_busaddr); if (r != OK) - panic("FXP","sys_umap failed", r); + panic("sys_umap failed: %d", r); #if 0 printf("fxp_init_buf: got phys 0x%x for vir 0x%x\n", @@ -952,7 +946,7 @@ fxp_t *fp; r= sys_umap(SELF, VM_D, (vir_bytes)&rfdp[1], sizeof(rfdp[1]), &rfdp->rfd_linkaddr); if (r != OK) - panic("FXP","sys_umap failed", r); + panic("sys_umap failed: %d", r); } else { @@ -970,7 +964,7 @@ fxp_t *fp; r= sys_umap(SELF, VM_D, (vir_bytes)fp->fxp_tx_buf, (phys_bytes)tx_totbufsize, &fp->fxp_tx_busaddr); if (r != OK) - panic("FXP","sys_umap failed", r); + panic("sys_umap failed: %d", r); for (i= 0, txp= fp->fxp_tx_buf; ifxp_tx_nbuf; i++, txp++) { @@ -982,7 +976,7 @@ fxp_t *fp; (phys_bytes)sizeof(txp[1]), &txp->tx_linkaddr); if (r != OK) - panic("FXP","sys_umap failed", r); + panic("sys_umap failed: %d", r); } else { @@ -1065,7 +1059,7 @@ static void fxp_confaddr(fxp_t *fp) r= sys_umap(SELF, VM_D, (vir_bytes)&tmpbufp->ias, (phys_bytes)sizeof(tmpbufp->ias), &bus_addr); if (r != OK) - panic("FXP","sys_umap failed", r); + panic("sys_umap failed: %d", r); fxp_cu_ptr_cmd(fp, SC_CU_START, bus_addr, TRUE /* check idle */); @@ -1077,9 +1071,9 @@ static void fxp_confaddr(fxp_t *fp) } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000)); if (!(tmpbufp->ias.ias_status & CBL_F_C)) - panic("FXP","fxp_confaddr: CU command failed to complete", NO_NUM); + panic("fxp_confaddr: CU command failed to complete"); if (!(tmpbufp->ias.ias_status & CBL_F_OK)) - panic("FXP","fxp_confaddr: CU command failed", NO_NUM); + panic("fxp_confaddr: CU command failed"); #if VERBOSE printf("%s: hardware ethernet address: ", fp->fxp_name); @@ -1141,7 +1135,7 @@ int vectored; dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= FXP_PORT_NR) - panic("FXP","fxp_writev: illegal port", dl_port); + panic("fxp_writev: illegal port: %d", dl_port); fp= &fxp_table[dl_port]; fxp_client= mp->DL_PROC; fp->fxp_client= fxp_client; @@ -1203,42 +1197,38 @@ int vectored; SELF, D, (vir_bytes)fp->fxp_iovec, n * sizeof(fp->fxp_iovec[0])); if (r != OK) - panic("FXP","fxp_writev: sys_vircopy failed", r); + panic("fxp_writev: sys_vircopy failed: %d", r); for (j= 0, iovp= fp->fxp_iovec; jiov_size; - if (size + s > ETH_MAX_PACK_SIZE_TAGGED) - { - panic("FXP","fxp_writev: invalid packet size", - NO_NUM); + if (size + s > ETH_MAX_PACK_SIZE_TAGGED) { + panic("fxp_writev: invalid packet size"); } r= sys_vircopy(fxp_client, D, iovp->iov_addr, SELF, D, (vir_bytes)(txp->tx_buf+o), s); - if (r != OK) - { - panic("FXP","fxp_writev: sys_vircopy failed", - r); + if (r != OK) { + panic("fxp_writev: sys_vircopy failed: %d", r); } size += s; o += s; } } if (size < ETH_MIN_PACK_SIZE) - panic("FXP","fxp_writev: invalid packet size", size); + panic("fxp_writev: invalid packet size: %d", size); } else { size= mp->DL_COUNT; if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) - panic("FXP","fxp_writev: invalid packet size", size); + panic("fxp_writev: invalid packet size: %d", size); r= sys_vircopy(fxp_client, D, (vir_bytes)mp->DL_ADDR, SELF, D, (vir_bytes)txp->tx_buf, size); if (r != OK) - panic("FXP","fxp_writev: sys_vircopy failed", r); + panic("fxp_writev: sys_vircopy failed: %d", r); } txp->tx_status= 0; @@ -1276,7 +1266,7 @@ int vectored; suspend: if (from_int) - panic("FXP","fxp: should not be sending\n", NO_NUM); + panic("fxp: should not be sending"); fp->fxp_tx_mess= *mp; reply(fp, OK, FALSE); @@ -1299,7 +1289,7 @@ static void fxp_writev_s(message *mp, int from_int) dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= FXP_PORT_NR) - panic("FXP","fxp_writev: illegal port", dl_port); + panic("fxp_writev: illegal port: %d", dl_port); fp= &fxp_table[dl_port]; fxp_client= mp->DL_PROC; fp->fxp_client= fxp_client; @@ -1359,31 +1349,26 @@ static void fxp_writev_s(message *mp, int from_int) (vir_bytes)fp->fxp_iovec_s, n * sizeof(fp->fxp_iovec_s[0]), D); if (r != OK) - panic("FXP","fxp_writev: sys_safecopyfrom failed", r); + panic("fxp_writev: sys_safecopyfrom failed: %d", r); for (j= 0, iovp= fp->fxp_iovec_s; jiov_size; - if (size + s > ETH_MAX_PACK_SIZE_TAGGED) - { - panic("FXP","fxp_writev: invalid packet size", - size + s); + if (size + s > ETH_MAX_PACK_SIZE_TAGGED) { + panic("fxp_writev: invalid packet size: %d", size + s); } r= sys_safecopyfrom(fxp_client, iovp->iov_grant, 0, (vir_bytes)(txp->tx_buf+o), s, D); - if (r != OK) - { - panic("FXP", - "fxp_writev_s: sys_safecopyfrom failed", - r); + if (r != OK) { + panic("fxp_writev_s: sys_safecopyfrom failed: %d", r); } size += s; o += s; } } if (size < ETH_MIN_PACK_SIZE) - panic("FXP","fxp_writev: invalid packet size", size); + panic("fxp_writev: invalid packet size: %d", size); txp->tx_status= 0; txp->tx_command= TXC_EL | CBL_XMIT; @@ -1420,7 +1405,7 @@ static void fxp_writev_s(message *mp, int from_int) suspend: if (from_int) - panic("FXP","fxp: should not be sending\n", NO_NUM); + panic("fxp: should not be sending"); fp->fxp_tx_mess= *mp; reply(fp, OK, FALSE); @@ -1449,7 +1434,7 @@ int vectored; dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= FXP_PORT_NR) - panic("FXP","fxp_readv: illegal port", dl_port); + panic("fxp_readv: illegal port: %d", dl_port); fp= &fxp_table[dl_port]; fxp_client= mp->DL_PROC; fp->fxp_client= fxp_client; @@ -1502,7 +1487,7 @@ int vectored; SELF, D, (vir_bytes)fp->fxp_iovec, n * sizeof(fp->fxp_iovec[0])); if (r != OK) - panic("FXP","fxp_readv: sys_vircopy failed", r); + panic("fxp_readv: sys_vircopy failed: %d", r); for (j= 0, iovp= fp->fxp_iovec; jrfd_buf+o), fxp_client, D, iovp->iov_addr, s); - if (r != OK) - { - panic("FXP","fxp_readv: sys_vircopy failed", - r); + if (r != OK) { + panic("fxp_readv: sys_vircopy failed: %d", r); } size += s; @@ -1629,7 +1612,7 @@ int from_int; dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= FXP_PORT_NR) - panic("FXP","fxp_readv: illegal port", dl_port); + panic("fxp_readv: illegal port: %d", dl_port); fp= &fxp_table[dl_port]; fxp_client= mp->DL_PROC; fp->fxp_client= fxp_client; @@ -1681,7 +1664,7 @@ int from_int; (vir_bytes)fp->fxp_iovec_s, n * sizeof(fp->fxp_iovec_s[0]), D); if (r != OK) - panic("FXP","fxp_readv_s: sys_safecopyfrom failed", r); + panic("fxp_readv_s: sys_safecopyfrom failed: %d", r); for (j= 0, iovp= fp->fxp_iovec_s; jrfd_buf+o), s, D); if (r != OK) { - panic("FXP","fxp_readv: sys_safecopyto failed", - r); + panic("fxp_readv: sys_safecopyto failed: %d", r); } size += s; @@ -1799,7 +1781,7 @@ fxp_t *fp; r= sys_umap(SELF, VM_D, (vir_bytes)&tmpbufp->cc, (phys_bytes)sizeof(tmpbufp->cc), &bus_addr); if (r != OK) - panic("FXP","sys_umap failed", r); + panic("sys_umap failed: %d", r); fxp_cu_ptr_cmd(fp, SC_CU_START, bus_addr, TRUE /* check idle */); @@ -1811,9 +1793,9 @@ fxp_t *fp; } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000)); if (!(tmpbufp->cc.cc_status & CBL_F_C)) - panic("FXP","fxp_do_conf: CU command failed to complete", NO_NUM); + panic("fxp_do_conf: CU command failed to complete"); if (!(tmpbufp->cc.cc_status & CBL_F_OK)) - panic("FXP","fxp_do_conf: CU command failed", NO_NUM); + panic("fxp_do_conf: CU command failed"); } @@ -1836,7 +1818,7 @@ int check_idle; { /* Consistency check. Make sure that CU is idle */ if ((fxp_inb(port, SCB_STATUS) & SS_CUS_MASK) != SS_CU_IDLE) - panic("FXP","fxp_cu_ptr_cmd: CU is not idle", NO_NUM); + panic("fxp_cu_ptr_cmd: CU is not idle"); } fxp_outl(port, SCB_POINTER, bus_addr); @@ -1854,7 +1836,7 @@ int check_idle; } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000)); if ((scb_cmd & SC_CUC_MASK) != SC_CU_NOP) - panic("FXP","fxp_cu_ptr_cmd: CU does not accept command", NO_NUM); + panic("fxp_cu_ptr_cmd: CU does not accept command"); } /*===========================================================================* @@ -1876,7 +1858,7 @@ int check_idle; { /* Consistency check, make sure that RU is idle */ if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_IDLE) - panic("FXP","fxp_ru_ptr_cmd: RU is not idle", NO_NUM); + panic("fxp_ru_ptr_cmd: RU is not idle"); } fxp_outl(port, SCB_POINTER, bus_addr); @@ -1891,7 +1873,7 @@ int check_idle; } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000)); if ((scb_cmd & SC_RUC_MASK) != SC_RU_NOP) - panic("FXP","fxp_ru_ptr_cmd: RU does not accept command", NO_NUM); + panic("fxp_ru_ptr_cmd: RU does not accept command"); } /*===========================================================================* @@ -1921,7 +1903,7 @@ fxp_t *fp; /* Make sure that RU is in the 'No resources' state */ if ((fxp_inb(port, SCB_STATUS) & SS_RUS_MASK) != SS_RU_NORES) - panic("FXP","fxp_restart_ru: RU is in an unexpected state", NO_NUM); + panic("fxp_restart_ru: RU is in an unexpected state"); fxp_ru_ptr_cmd(fp, SC_RU_START, fp->fxp_rx_busaddr, FALSE /* do not check idle */); @@ -1941,7 +1923,7 @@ message *mp; dl_port = mp->DL_PORT; if (dl_port < 0 || dl_port >= FXP_PORT_NR) - panic("FXP","fxp_getstat: illegal port", dl_port); + panic("fxp_getstat: illegal port: %d", dl_port); fp= &fxp_table[dl_port]; fp->fxp_client= mp->DL_PROC; @@ -1964,9 +1946,9 @@ message *mp; } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000)); if (*p == 0) - panic("FXP","fxp_getstat: CU command failed to complete", NO_NUM); + panic("fxp_getstat: CU command failed to complete"); if (*p != SCM_DSC) - panic("FXP","fxp_getstat: bad magic", NO_NUM); + panic("fxp_getstat: bad magic"); stats.ets_recvErr= fp->fxp_stat.sc_rx_crc + @@ -1997,14 +1979,14 @@ message *mp; r= sys_vircopy(SELF, D, (vir_bytes)&stats, mp->DL_PROC, D, (vir_bytes) mp->DL_ADDR, sizeof(stats)); if (r != OK) - panic(__FILE__,"fxp_getstat: sys_vircopy failed", r); + panic("fxp_getstat: sys_vircopy failed: %d", r); mp->m_type= DL_STAT_REPLY; mp->DL_PORT= dl_port; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic(__FILE__, "fxp_getstat: send failed: %d\n", r); + panic("fxp_getstat: send failed: %d", r); } @@ -2021,7 +2003,7 @@ static void fxp_getstat_s(message *mp) dl_port = mp->DL_PORT; if (dl_port < 0 || dl_port >= FXP_PORT_NR) - panic("FXP","fxp_getstat: illegal port", dl_port); + panic("fxp_getstat: illegal port: %d", dl_port); fp= &fxp_table[dl_port]; fp->fxp_client= mp->DL_PROC; @@ -2044,9 +2026,9 @@ static void fxp_getstat_s(message *mp) } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(1000)); if (*p == 0) - panic("FXP","fxp_getstat: CU command failed to complete", NO_NUM); + panic("fxp_getstat: CU command failed to complete"); if (*p != SCM_DSC) - panic("FXP","fxp_getstat: bad magic", NO_NUM); + panic("fxp_getstat: bad magic"); stats.ets_recvErr= fp->fxp_stat.sc_rx_crc + @@ -2077,14 +2059,14 @@ static void fxp_getstat_s(message *mp) r= sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes)&stats, sizeof(stats), D); if (r != OK) - panic(__FILE__,"fxp_getstat_s: sys_safecopyto failed", r); + panic("fxp_getstat_s: sys_safecopyto failed: %d", r); mp->m_type= DL_STAT_REPLY; mp->DL_PORT= dl_port; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic(__FILE__, "fxp_getstat_s: send failed: %d\n", r); + panic("fxp_getstat_s: send failed: %d", r); } @@ -2100,7 +2082,7 @@ static void fxp_getname(message *mp) mp->m_type= DL_NAME_REPLY; r= send(mp->m_source, mp); if (r != OK) - panic("FXP", "fxp_getname: send failed", r); + panic("fxp_getname: send failed: %d", r); } /*===========================================================================* @@ -2687,7 +2669,7 @@ int may_block; } if (r < 0) - panic("FXP","fxp: send failed:", r); + panic("fxp: send failed: %d", r); fp->fxp_read_s = 0; fp->fxp_flags &= ~(FF_PACK_SENT | FF_PACK_RECV); @@ -2701,7 +2683,7 @@ message *req; message *reply_mess; { if (send(req->m_source, reply_mess) != OK) - panic("FXP","fxp: unable to mess_reply", NO_NUM); + panic("fxp: unable to mess_reply"); } /*===========================================================================* @@ -2802,7 +2784,7 @@ fxp_t *fp; break; } if (i >= 32) - panic("FXP","eeprom_addrsize: failed", NO_NUM); + panic("eeprom_addrsize: failed"); fp->fxp_ee_addrlen= i+1; /* Discard 16 data bits */ @@ -2839,7 +2821,7 @@ int reg; fp->fxp_mii_busy++; if (!(fxp_inl(port, CSR_MDI_CTL) & CM_READY)) - panic("FXP","mii_read: MDI not ready", NO_NUM); + panic("mii_read: MDI not ready"); fxp_outl(port, CSR_MDI_CTL, CM_READ | (1 << CM_PHYADDR_SHIFT) | (reg << CM_REG_SHIFT)); @@ -2851,7 +2833,7 @@ int reg; } while (getuptime(&t1)==OK && (t1-t0) < micros_to_ticks(100000)); if (!(v & CM_READY)) - panic("FXP","mii_read: MDI not ready after command", NO_NUM); + panic("mii_read: MDI not ready after command"); fp->fxp_mii_busy--; assert(!fp->fxp_mii_busy); @@ -2873,7 +2855,7 @@ tmr_func_t watchdog; /* watchdog function to be called */ /* Get the current time. */ r= getuptime(&now); if (r != OK) - panic("FXP","unable to get uptime from clock", r); + panic("unable to get uptime from clock: %d", r); /* Add the timer to the local timer queue. */ tmrs_settimer(&fxp_timers, tp, now + delta, watchdog, NULL); @@ -2891,7 +2873,7 @@ tmr_func_t watchdog; /* watchdog function to be called */ #endif r= sys_setalarm(fxp_next_timeout, 1); if (r != OK) - panic("FXP","unable to set synchronous alarm", r); + panic("unable to set synchronous alarm: %d", r); } } @@ -2909,7 +2891,7 @@ PRIVATE void fxp_expire_timers() /* Get the current time to compare the timers against. */ r= getuptime(&now); if (r != OK) - panic("FXP","Unable to get uptime from clock.", r); + panic("Unable to get uptime from clock: %d", r); /* Scan the timers queue for expired timers. Dispatch the watchdog function * for each expired timers. Possibly a new alarm call must be scheduled. @@ -2922,7 +2904,7 @@ PRIVATE void fxp_expire_timers() fxp_next_timeout = fxp_timers->tmr_exp_time; r= sys_setalarm(fxp_next_timeout, 1); if (r != OK) - panic("FXP","Unable to set synchronous alarm.", r); + panic("Unable to set synchronous alarm: %d", r); } } @@ -2933,7 +2915,7 @@ static u8_t do_inb(port_t port) r= sys_inb(port, &value); if (r != OK) - panic("FXP","sys_inb failed", r); + panic("sys_inb failed: %d", r); return value; } @@ -2944,7 +2926,7 @@ static u32_t do_inl(port_t port) r= sys_inl(port, &value); if (r != OK) - panic("FXP","sys_inl failed", r); + panic("sys_inl failed: %d", r); return value; } @@ -2954,7 +2936,7 @@ static void do_outb(port_t port, u8_t value) r= sys_outb(port, value); if (r != OK) - panic("FXP","sys_outb failed", r); + panic("sys_outb failed: %d", r); } static void do_outl(port_t port, u32_t value) @@ -2963,7 +2945,7 @@ static void do_outl(port_t port, u32_t value) r= sys_outl(port, value); if (r != OK) - panic("FXP","sys_outl failed", r); + panic("sys_outl failed: %d", r); } PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func) diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index cfffc5fdf..a6ef17d91 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -147,7 +147,7 @@ unsigned long vir2phys( unsigned long x ) if ( (r=sys_umap( SELF, VM_D, x, 4, &value )) != OK ) { printf("lance: umap of 0x%lx failed\n",x ); - panic( "lance", "sys_umap failed", r ); + panic("sys_umap failed: %d", r); } return value; @@ -289,7 +289,7 @@ void main( int argc, char **argv ) } if ((r= sef_receive(ANY, &m)) != OK) - panic( "lance", "sef_receive failed", r); + panic("sef_receive failed: %d", r); for (i=0;iDL_PORT; @@ -542,7 +542,7 @@ message *mp; } else { - report( "LANCE", "DMA denied because address out of range", NO_NUM ); + printf("LANCE: DMA denied because address out of range\n" ); } if (ec->mode == EC_DISABLED) @@ -744,7 +744,7 @@ int may_block; reply.DL_COUNT = ec->read_s; if ((r=getuptime(&now)) != OK) - panic("lance", "getuptime() failed:", r); + panic("getuptime() failed: %d", r); reply.DL_CLCK = now; r = send(ec->client, &reply); @@ -753,7 +753,7 @@ int may_block; return; } if (r < 0) - panic( "lance", "send failed:", r); + panic("send failed: %d", r); ec->read_s = 0; ec->flags &= ~(ECF_PACK_SEND | ECF_PACK_RECV); @@ -768,7 +768,7 @@ message *req; message *reply_mess; { if (send(req->m_source, reply_mess) != OK) - panic( "lance", "unable to mess_reply", NO_NUM); + panic("unable to mess_reply"); } @@ -867,7 +867,7 @@ ether_card_t *ec; unsigned short ioaddr = ec->ec_port; if (!(ec->flags & ECF_ENABLED)) - panic( "lance", "got premature interrupt", NO_NUM); + panic("got premature interrupt"); for (;;) { @@ -959,7 +959,7 @@ ether_card_t *ec; } else { - panic( "lance", "got premature TX INT...", NO_NUM); + panic("got premature TX INT.."); } if (check==1) { @@ -1065,7 +1065,7 @@ ether_card_t *ec; { case DL_WRITEV_S: do_vwrite_s(&ec->sendmsg, TRUE); break; default: - panic( "lance", "wrong type:", ec->sendmsg.m_type); + panic("wrong type: %d", ec->sendmsg.m_type); break; } } @@ -1088,8 +1088,7 @@ static void do_vread_s(message *mp) (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_s_t), D); if (r != OK) - panic(__FILE__, - "do_vread_s: sys_safecopyfrom failed: %d\n", r); + panic("do_vread_s: sys_safecopyfrom failed: %d", r); ec->read_iovec.iod_iovec_s = count; ec->read_iovec.iod_proc_nr = mp->DL_PROC; ec->read_iovec.iod_grant = (cp_grant_id_t) mp->DL_GRANT; @@ -1207,9 +1206,7 @@ int from_int; (count > IOVEC_NR ? IOVEC_NR : count) * sizeof(iovec_s_t), D); if (r != OK) - panic(__FILE__, - "do_vwrite_s: sys_safecopyfrom failed: %d\n", r); - + panic("do_vwrite_s: sys_safecopyfrom failed: %d", r); ec->write_iovec.iod_iovec_s = count; ec->write_iovec.iod_proc_nr = mp->DL_PROC; ec->write_iovec.iod_grant = mp->DL_GRANT; @@ -1283,7 +1280,7 @@ vir_bytes count; if ( (r=sys_safecopyfrom(iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant, offset, nic_addr, bytes, D )) != OK ) - panic( __FILE__, "ec_user2nic: sys_safecopyfrom failed", r ); + panic("ec_user2nic: sys_safecopyfrom failed: %d", r); count -= bytes; nic_addr += bytes; @@ -1323,7 +1320,7 @@ vir_bytes count; bytes = count; if ( (r=sys_safecopyto( iovp->iod_proc_nr, iovp->iod_iovec[i].iov_grant, offset, nic_addr, bytes, D )) != OK ) - panic( __FILE__, "ec_nic2user: sys_safecopyto failed: ", r ); + panic("ec_nic2user: sys_safecopyto failed: %d", r); count -= bytes; nic_addr += bytes; @@ -1374,8 +1371,7 @@ iovec_dat_t *iovp; IOVEC_NR : iovp->iod_iovec_s) * sizeof(iovec_s_t), D); if (r != OK) - panic(__FILE__, - "ec_next_iovec: sys_safecopyfrom failed: %d\n", r); + panic("ec_next_iovec: sys_safecopyfrom failed: %d", r); } @@ -1390,7 +1386,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= EC_PORT_NR_MAX) - panic( "lance", "illegal port", port); + panic("illegal port: %d", port); ec= &ec_table[port]; ec->client= mp->DL_PROC; @@ -1399,15 +1395,14 @@ message *mp; (vir_bytes)&ec->eth_stat, sizeof(ec->eth_stat), D); if (r != OK) - panic(__FILE__, - "do_getstat_s: sys_safecopyto failed: %d\n", r); + panic("do_getstat_s: sys_safecopyto failed: %d", r); mp->m_type= DL_STAT_REPLY; mp->DL_PORT= port; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic(__FILE__, "do_getstat_s: send failed: %d\n", r); + panic("do_getstat_s: send failed: %d", r); } /*===========================================================================* @@ -1422,7 +1417,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= EC_PORT_NR_MAX) - panic( "lance", "illegal port", port); + panic("illegal port: %d", port); ec = &ec_table[port]; if (!(ec->flags & ECF_ENABLED)) @@ -1516,10 +1511,8 @@ ether_card_t *ec; continue; if (pcitab[i].did != did) continue; - if (pcitab[i].checkclass) - { - panic("lance", - "class check not implemented", NO_NUM); + if (pcitab[i].checkclass) { + panic("class check not implemented"); } break; } @@ -1610,7 +1603,7 @@ message *mp; mp->m_type= DL_NAME_REPLY; r= send(mp->m_source, mp); if (r != OK) - panic("LANCE", "do_getname: send failed", r); + panic("do_getname: send failed: %d", r); } /*===========================================================================* @@ -1731,7 +1724,7 @@ static u8_t in_byte(port_t port) r= sys_inb(port, &value); if (r != OK) - panic("lance","sys_inb failed", r); + panic("sys_inb failed: %d", r); return value; } @@ -1745,7 +1738,7 @@ static u16_t in_word(port_t port) r= sys_inw(port, &value); if (r != OK) - panic("lance","sys_inw failed", r); + panic("sys_inw failed: %d", r); return value; } @@ -1759,7 +1752,7 @@ static void out_word(port_t port, u16_t value) r= sys_outw(port, value); if (r != OK) - panic("lance","sys_outw failed", r); + panic("sys_outw failed: %d", r); } /*===========================================================================* diff --git a/drivers/libdriver/driver.c b/drivers/libdriver/driver.c index 5b3c630bd..5d1c2f32d 100644 --- a/drivers/libdriver/driver.c +++ b/drivers/libdriver/driver.c @@ -146,7 +146,7 @@ int type; /* Driver type (DRIVER_STD or DRIVER_ASYN) */ int s; /* Wait for a request to read or write a disk block. */ if ((s=sef_receive(ANY, &mess)) != OK) - panic((*dp->dr_name)(),"sef_receive() failed", s); + panic("sef_receive() failed: %d", s); } device_caller = mess.m_source; @@ -239,7 +239,7 @@ send_reply: break; default: - panic(__FILE__, "unknown driver type", type); + panic("unknown driver type: %d", type); } } } @@ -256,7 +256,7 @@ PUBLIC void init_buffer(void) */ if(!(tmp_buf = alloc_contig(2*DMA_BUF_SIZE, AC_ALIGN4K, &tmp_phys))) - panic(__FILE__, "can't allocate tmp_buf", DMA_BUF_SIZE); + panic("can't allocate tmp_buf: %d", DMA_BUF_SIZE); } /*===========================================================================* @@ -317,7 +317,7 @@ message *mp; /* pointer to read or write message */ if (OK != sys_safecopyfrom(mp->m_source, (vir_bytes) mp->IO_GRANT, 0, (vir_bytes) iovec, iovec_size, D)) { - panic((*dp->dr_name)(),"bad I/O vector by", mp->m_source); + panic("bad I/O vector by: %d", mp->m_source); } /* Prepare for I/O. */ @@ -331,7 +331,7 @@ message *mp; /* pointer to read or write message */ /* Copy the I/O vector back to the caller. */ if (OK != sys_safecopyto(mp->m_source, (vir_bytes) mp->IO_GRANT, 0, (vir_bytes) iovec, iovec_size, D)) { - panic((*dp->dr_name)(),"couldn't return I/O vector", mp->m_source); + panic("couldn't return I/O vector: %d", mp->m_source); } return(r); @@ -485,7 +485,7 @@ PUBLIC int mq_queue(message *m) mq_t *mq, *mi; if(!(mq = mq_get())) - panic("libdriver","mq_queue: mq_get failed", NO_NUM); + panic("mq_queue: mq_get failed"); memcpy(&mq->mq_mess, m, sizeof(mq->mq_mess)); mq->mq_next = NULL; if(!queue_head) { diff --git a/drivers/log/diag.c b/drivers/log/diag.c index 27e4cfcf3..4d6ac1244 100644 --- a/drivers/log/diag.c +++ b/drivers/log/diag.c @@ -40,9 +40,6 @@ endpoint_t from; /* who sent this message? */ CPF_WRITE); if (gid == -1) { -#if 0 - report("LOG","cpf_grant_direct failed for TTY", errno); -#endif return EDONTREPLY; } @@ -55,7 +52,7 @@ endpoint_t from; /* who sent this message? */ if (r == OK) r= mess.m_type; if (r != OK) { - report("LOG","couldn't get copy of kmessages from TTY", r); + printf("log: couldn't get copy of kmessages from TTY: %d\n", r); return EDONTREPLY; } } @@ -63,7 +60,7 @@ endpoint_t from; /* who sent this message? */ { /* Try to get a fresh copy of the buffer with kernel messages. */ if ((r=sys_getkmessages(&kmess)) != OK) { - report("LOG","couldn't get copy of kmessages", r); + printf("log: couldn't get copy of kmessages: %d\n", r); return EDONTREPLY; } prev_nextp= &kernel_prev_next; diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index 3467b0a2b..0f7d40210 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -128,11 +128,11 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) sa.sa_handler = SIG_MESS; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - if (sigaction(SIGTERM,&sa,NULL)<0) panic("MEM","sigaction failed", errno); + if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno); /* Initialize all minor devices one by one. */ if (OK != (s=sys_getkinfo(&kinfo))) { - panic("MEM","Couldn't get kernel information.",s); + panic("Couldn't get kernel information: %d", s); } #if 0 @@ -255,7 +255,7 @@ unsigned nr_req; /* length of request vector */ dev_vaddr + position, count, D); } if(r != OK) { - panic("MEM","I/O copy failed",r); + panic("I/O copy failed: %d", r); } break; @@ -287,7 +287,7 @@ unsigned nr_req; /* length of request vector */ if(!any_mapped || pagestart_mapped != pagestart) { if(any_mapped) { if(vm_unmap_phys(SELF, vaddr, I386_PAGE_SIZE) != OK) - panic("MEM","vm_unmap_phys failed",NO_NUM); + panic("vm_unmap_phys failed"); any_mapped = 0; } vaddr = vm_map_phys(SELF, (void *) pagestart, I386_PAGE_SIZE); @@ -331,7 +331,7 @@ unsigned nr_req; /* length of request vector */ s=sys_safecopyto(proc_nr, user_vir, vir_offset+suboffset, (vir_bytes) dev_zero, chunk, D); if(s != OK) - report("MEM","sys_safecopyto failed", s); + printf("MEM: sys_safecopyto failed: %d\n", s); left -= chunk; suboffset += chunk; } @@ -372,7 +372,7 @@ message *m_ptr; } if(m_device < 0 || m_device >= NR_DEVS) { - panic("MEM","wrong m_device",m_device); + panic("wrong m_device: %d", m_device); } openct[m_device]++; @@ -392,11 +392,11 @@ message *m_ptr; if (m_prepare(m_ptr->DEVICE) == NIL_DEV) return(ENXIO); if(m_device < 0 || m_device >= NR_DEVS) { - panic("MEM","wrong m_device",m_device); + panic("wrong m_device: %d", m_device); } if(openct[m_device] < 1) { - panic("MEM","closed too often",NO_NUM); + panic("closed too often"); } openct[m_device]--; @@ -449,7 +449,7 @@ message *m_ptr; /* pointer to control message */ if(m_vaddrs[dev]) { u32_t size; if(ex64hi(dv->dv_size)) { - panic("MEM","huge old ramdisk", NO_NUM); + panic("huge old ramdisk"); } size = ex64lo(dv->dv_size); free((void *) m_vaddrs[dev]); diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index b216756bb..b230d8bcf 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) { while (TRUE) { if ((r = sef_receive (ANY, &m)) != OK) - panic(__FILE__, "orinoco: sef_receive failed", NO_NUM); + panic("orinoco: sef_receive failed"); if (is_notify(m.m_type)) { switch (_ENDPOINT_P(m.m_source)) { @@ -275,8 +275,7 @@ int main(int argc, char *argv[]) { break; } default: - panic(__FILE__, - "orinoco: illegal notify from:", + panic("orinoco: illegal notify from: %d", m.m_source); } @@ -316,7 +315,7 @@ int main(int argc, char *argv[]) { or_getname(&m); break; default: - panic(__FILE__,"orinoco: illegal message:", m.m_type); + panic("orinoco: illegal message: %d", m.m_type); } } } @@ -406,7 +405,7 @@ static void or_getname(message *mp) { r = send(mp->m_source, mp); if(r != OK) { - panic(__FILE__, "or_getname: send failed", r); + panic("or_getname: send failed: %d", r); } } @@ -465,7 +464,7 @@ static void or_reset() { u16_t irqmask; if (OK != (r = getuptime(&now))) - panic(__FILE__, "orinoco: getuptime() failed:", r); + panic("orinoco: getuptime() failed: %d", r); if(now - last_reset < system_hz * 10) { printf("Resetting card too often. Going to reset driver\n"); @@ -706,8 +705,7 @@ static int or_probe (t_or * orp) { if (pcitab[i].did != did) continue; if (pcitab[i].checkclass) { - panic(__FILE__, "or_probe:class check not implmnted", - NO_NUM); + panic("or_probe:class check not implmnted"); } /* we have found the card in the pci bus */ break; @@ -769,7 +767,7 @@ static void map_hw_buffer(t_or *orp) { buf = (char *)malloc(size); if(buf == NULL) - panic(__FILE__, "map_hw_buffer: cannot malloc size:", size); + panic("map_hw_buffer: cannot malloc size: %d", size); /* Let the mapped memory by I386_PAGE_SIZE aligned */ o = I386_PAGE_SIZE - ((vir_bytes)buf % I386_PAGE_SIZE); @@ -783,7 +781,7 @@ static void map_hw_buffer(t_or *orp) { #endif if(r!=OK) - panic(__FILE__, "map_hw_buffer: sys_vm_map failed:", r); + panic("map_hw_buffer: sys_vm_map failed: %d", r); hw->locmem = abuf; @@ -814,8 +812,7 @@ static u32_t or_get_bar (int devind, t_or * orp) { bar = pci_attr_r32 (devind, PCI_BAR) & 0xffffffe0; if ((bar & 0x3ff) >= 0x100 - 32 || bar < 0x400) - panic(__FILE__,"base address isn't properly configured", - NO_NUM); + panic("base address isn't properly configured"); /* In I/O space registers are 2 bytes wide, without any spacing * in between */ @@ -827,7 +824,7 @@ static u32_t or_get_bar (int devind, t_or * orp) { orp->or_name, bar, orp->or_irq); } - panic(__FILE__, "Not implemente yet", NO_NUM); + panic("Not implemente yet"); /* Although we are able to find the desired bar and irq for an * I/O spaced card, we haven't implemented the right register * accessing functions. This wouldn't be difficult, but we were @@ -1347,7 +1344,7 @@ static void or_watchdog_f(timer_t *tp) { static void mess_reply (message * req, message * reply_mess) { if (send (req->m_source, reply_mess) != 0) - panic(__FILE__, "orinoco: unable to mess_reply", NO_NUM); + panic("orinoco: unable to mess_reply"); } @@ -1379,7 +1376,7 @@ static void or_writev (message * mp, int from_int, int vectored) { port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= OR_PORT_NR) - panic(__FILE__, "orinoco: illegal port", NO_NUM); + panic("orinoco: illegal port"); or_client = mp->DL_PROC; orp = &or_table[port]; @@ -1555,7 +1552,7 @@ static void or_writev_s (message * mp, int from_int) { port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= OR_PORT_NR) - panic(__FILE__, "orinoco: illegal port", NO_NUM); + panic("orinoco: illegal port"); or_client = mp->DL_PROC; orp = &or_table[port]; @@ -1745,7 +1742,7 @@ static void reply (t_or * orp, int err, int may_block) { reply.DL_COUNT = orp->or_read_s; if (OK != (r = getuptime(&now))) - panic(__FILE__, "orinoco: getuptime() failed:", r); + panic("orinoco: getuptime() failed: %d", r); reply.DL_CLCK = now; r = send (orp->or_client, &reply); @@ -1755,7 +1752,7 @@ static void reply (t_or * orp, int err, int may_block) { } if (r < 0) - panic(__FILE__, "orinoco: send failed:", r); + panic("orinoco: send failed: %d", r); orp->or_read_s = 0; orp->or_flags &= ~(OR_F_PACK_SENT | OR_F_PACK_RECV); @@ -1995,7 +1992,7 @@ static void or_readv (message * mp, int from_int, int vectored) { dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= OR_PORT_NR) - panic(__FILE__, "orinoco: illegal port:", dl_port); + panic("orinoco: illegal port: %d", dl_port); orp = &or_table[dl_port]; or_client = mp->DL_PROC; @@ -2116,7 +2113,7 @@ static void or_readv_s (message * mp, int from_int) { dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= OR_PORT_NR) - panic(__FILE__, "orinoco: illegal port:", dl_port); + panic("orinoco: illegal port: %d", dl_port); orp = &or_table[dl_port]; or_client = mp->DL_PROC; @@ -2162,8 +2159,7 @@ static void or_readv_s (message * mp, int from_int) { (vir_bytes)orp->or_iovec_s, n * sizeof(orp->or_iovec_s[0]), D); if (cps != OK) - panic(__FILE__, - "orinoco: warning, sys_safecopytp failed:", cps); + panic("orinoco: warning: sys_safecopytp failed: %d", cps); for (j = 0, iovp = orp->or_iovec_s; j < n; j++, iovp++) { s = iovp->iov_size; @@ -2174,9 +2170,7 @@ static void or_readv_s (message * mp, int from_int) { cps = sys_safecopyto(or_client, iovp->iov_grant, 0, (vir_bytes) databuf + o, s, D); if (cps != OK) - panic(__FILE__, - "orinoco: warning, sys_safecopy failed:", - cps); + panic("orinoco: warning: sys_safecopy failed: %d", cps); size += s; if (size == length) @@ -2336,7 +2330,7 @@ static void or_getstat (message * mp) { port = mp->DL_PORT; if (port < 0 || port >= OR_PORT_NR) - panic(__FILE__, "orinoco: illegal port:", port); + panic("orinoco: illegal port: %d", port); orp = &or_table[port]; orp->or_client = mp->DL_PROC; @@ -2348,7 +2342,7 @@ static void or_getstat (message * mp) { r = sys_datacopy(SELF, (vir_bytes)&stats, mp->DL_PROC, (vir_bytes) mp->DL_ADDR, sizeof(stats)); if(r != OK) { - panic(__FILE__, "or_getstat: send failed:", r); + panic("or_getstat: send failed: %d", r); } mp->m_type = DL_STAT_REPLY; @@ -2357,7 +2351,7 @@ static void or_getstat (message * mp) { r = send(mp->m_source, mp); if(r != OK) - panic(__FILE__, "orinoco: getstat failed:", r); + panic("orinoco: getstat failed: %d", r); /*reply (orp, OK, FALSE);*/ @@ -2376,7 +2370,7 @@ static void or_getstat_s (message * mp) { port = mp->DL_PORT; if (port < 0 || port >= OR_PORT_NR) - panic(__FILE__, "orinoco: illegal port:", port); + panic("orinoco: illegal port: %d", port); assert(port==0); orp = &or_table[port]; orp->or_client = mp->DL_PROC; @@ -2389,7 +2383,7 @@ static void or_getstat_s (message * mp) { r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes) &stats, sizeof(stats), D); if(r != OK) { - panic(__FILE__, "or_getstat_s: sys_safecopyto failed:", r); + panic("or_getstat_s: sys_safecopyto failed: %d", r); } mp->m_type = DL_STAT_REPLY; @@ -2398,6 +2392,6 @@ static void or_getstat_s (message * mp) { r = send(mp->m_source, mp); if(r != OK) - panic(__FILE__, "orinoco: getstat_s failed:", r); + panic("orinoco: getstat_s failed: %d", r); } diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 29cdfdae2..38cb1489e 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -173,12 +173,12 @@ PUBLIC int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Map all the services in the boot image. */ if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0, (vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) { - panic("pci", "sys_safecopyfrom failed", r); + panic("sys_safecopyfrom failed: %d", r); } for(i=0;i < NR_BOOT_PROCS;i++) { if(rprocpub[i].in_use) { if((r = map_service(&rprocpub[i])) != OK) { - panic("pci", "unable to map service", r); + panic("unable to map service: %d", r); } } } @@ -696,7 +696,7 @@ PRIVATE void pci_intel_init() #endif if (nr_pcibus >= NR_PCIBUS) - panic("PCI","too many PCI busses", nr_pcibus); + panic("too many PCI busses: %d", nr_pcibus); busind= nr_pcibus; nr_pcibus++; pcibus[busind].pb_type= PBT_INTEL_HOST; @@ -766,7 +766,7 @@ PRIVATE void probe_bus(int busind) printf("probe_bus(%d)\n", busind); #endif if (nr_pcidev >= NR_PCIDEV) - panic("PCI","too many PCI devices", nr_pcidev); + panic("too many PCI devices: %d", nr_pcidev); devind= nr_pcidev; busnr= pcibus[busind].pb_busnr; @@ -894,7 +894,7 @@ printf("probe_bus(%d)\n", busind); #endif if (nr_pcidev >= NR_PCIDEV) - panic("PCI","too many PCI devices", nr_pcidev); + panic("too many PCI devices: %d", nr_pcidev); devind= nr_pcidev; if (func == 0 && !(headt & PHT_MULTIFUNC)) @@ -1373,7 +1373,7 @@ PRIVATE void complete_bars(void) r= env_get_param("memory", memstr, sizeof(memstr)); if (r != OK) - panic("pci", "env_get_param failed", r); + panic("env_get_param failed: %d", r); /* Set memgap_low to just above physical memory */ memgap_low= 0; @@ -1444,7 +1444,7 @@ PRIVATE void complete_bars(void) { printf("PCI: bad memory gap: [0x%x .. 0x%x>\n", memgap_low, memgap_high); - panic(NULL, NULL, NO_NUM); + panic(NULL); } iogap_high= 0x10000; @@ -1488,7 +1488,7 @@ PRIVATE void complete_bars(void) printf("iogap_high too low, should panic\n"); } else - panic("pci", "iogap_high too low", iogap_high); + panic("iogap_high too low: %d", iogap_high); } if (debug) printf("I/O range = [0x%x..0x%x>\n", iogap_low, iogap_high); @@ -1507,7 +1507,7 @@ PRIVATE void complete_bars(void) base= memgap_high-size; base &= ~(u32_t)(size-1); if (base < memgap_low) - panic("pci", "memory base too low", base); + panic("memory base too low: %d", base); memgap_high= base; bar_nr= pcidev[i].pd_bar[j].pb_nr; reg= PCI_BAR + 4*bar_nr; @@ -1542,7 +1542,7 @@ PRIVATE void complete_bars(void) base &= 0xfcff; if (base < iogap_low) - panic("pci", "I/O base too low", base); + panic("I/O base too low: %d", base); iogap_high= base; bar_nr= pcidev[i].pd_bar[j].pb_nr; @@ -1581,7 +1581,7 @@ PRIVATE void complete_bars(void) bad_mem_string: printf("PCI: bad memory environment string '%s'\n", memstr); - panic(NULL, NULL, NO_NUM); + panic(NULL); } /*===========================================================================* @@ -1607,7 +1607,7 @@ u32_t io_size; return; } if (type != PBT_CARDBUS) - panic("pci", "update_bridge4dev_io: strange bus type", type); + panic("update_bridge4dev_io: strange bus type: %d", type); if (debug) { @@ -1727,7 +1727,7 @@ int busind; r= do_sis_isabr(bridge_dev); break; default: - panic("PCI","unknown ISA bridge type", type); + panic("unknown ISA bridge type: %d", type); } return r; } @@ -1847,7 +1847,7 @@ int busind; sbusn= pci_attr_r8_u(devind, PPB_SECBN); if (nr_pcibus >= NR_PCIBUS) - panic("PCI","too many PCI busses", nr_pcibus); + panic("too many PCI busses: %d", nr_pcibus); ind= nr_pcibus; nr_pcibus++; pcibus[ind].pb_type= PBT_PCIBRIDGE; @@ -1878,7 +1878,7 @@ int busind; pcibus[ind].pb_wsts= pcibr_via_wsts; break; default: - panic("PCI","unknown PCI-PCI bridge type", type); + panic("unknown PCI-PCI bridge type: %d", type); } if (debug) { @@ -1913,7 +1913,7 @@ int busnr; if (pcibus[i].pb_busnr == busnr) return i; } - panic("pci", "get_busind: can't find bus", busnr); + panic("get_busind: can't find bus: %d", busnr); } /*===========================================================================* @@ -1981,7 +1981,7 @@ PRIVATE int do_amd_isabr(int devind) /* Fake a device with the required function */ if (nr_pcidev >= NR_PCIDEV) - panic("PCI","too many PCI devices", nr_pcidev); + panic("too many PCI devices: %d", nr_pcidev); xdevind= nr_pcidev; pcidev[xdevind].pd_busnr= busnr; pcidev[xdevind].pd_dev= dev; diff --git a/drivers/printer/printer.c b/drivers/printer/printer.c index 3afd39062..92447c37c 100644 --- a/drivers/printer/printer.c +++ b/drivers/printer/printer.c @@ -197,7 +197,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) sa.sa_handler = SIG_MESS; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - if (sigaction(SIGTERM,&sa,NULL)<0) panic("PRN","sigaction failed", errno); + if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno); return(OK); } @@ -258,7 +258,7 @@ int safe; /* use virtual addresses or grant id's? */ while (--retries > 0) { if(sys_inb(port_base + 1, &status) != OK) { printf("printer: sys_inb of %x failed\n", port_base+1); - panic(__FILE__,"sys_inb failed", NO_NUM); + panic("sys_inb failed"); } if ((status & ON_LINE)) { /* printer online! */ prepare_output(); @@ -387,21 +387,21 @@ PRIVATE void do_initialize() /* Get the base port for first printer. */ if(sys_vircopy(SELF, BIOS_SEG, LPT1_IO_PORT_ADDR, SELF, D, (vir_bytes) &port_base, LPT1_IO_PORT_SIZE) != OK) { - panic(__FILE__, "do_initialize: sys_vircopy failed", NO_NUM); + panic("do_initialize: sys_vircopy failed"); } if(sys_outb(port_base + 2, INIT_PRINTER) != OK) { printf("printer: sys_outb of %x failed\n", port_base+2); - panic(__FILE__, "do_initialize: sys_outb init failed", NO_NUM); + panic("do_initialize: sys_outb init failed"); } micro_delay(1000000/20); /* easily satisfies Centronics minimum */ if(sys_outb(port_base + 2, PR_SELECT) != OK) { printf("printer: sys_outb of %x failed\n", port_base+2); - panic(__FILE__, "do_initialize: sys_outb select failed", NO_NUM); + panic("do_initialize: sys_outb select failed"); } irq_hook_id = 0; if(sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id) != OK || sys_irqenable(&irq_hook_id) != OK) { - panic(__FILE__, "do_initialize: irq enabling failed", NO_NUM); + panic("do_initialize: irq enabling failed"); } } @@ -453,10 +453,10 @@ PRIVATE void do_printer_output() */ if(sys_outb(port_base + 2, PR_SELECT) != OK) { printf("printer: sys_outb of %x failed\n", port_base+2); - panic(__FILE__,"sys_outb failed", NO_NUM); + panic("sys_outb failed"); } if(sys_irqenable(&irq_hook_id) != OK) { - panic(__FILE__,"sys_irqenable failed", NO_NUM); + panic("sys_irqenable failed"); } return; } @@ -467,7 +467,7 @@ PRIVATE void do_printer_output() */ if(sys_inb(port_base + 1, &status) != OK) { printf("printer: sys_inb of %x failed\n", port_base+1); - panic(__FILE__,"sys_inb failed", NO_NUM); + panic("sys_inb failed"); } if ((status & STATUS_MASK) == BUSY_STATUS) { /* Still busy with last output. This normally happens @@ -477,7 +477,7 @@ PRIVATE void do_printer_output() * interrupts. It may happen after a spurious interrupt. */ if(sys_irqenable(&irq_hook_id) != OK) { - panic(__FILE__, "sys_irqenable failed\n", NO_NUM); + panic("sys_irqenable failed"); } return; } @@ -489,7 +489,7 @@ PRIVATE void do_printer_output() pv_set(char_out[2], port_base+2, NEGATE_STROBE); if(sys_voutb(char_out, 3) != OK) { /* request series of port outb */ - panic(__FILE__, "sys_voutb failed\n", NO_NUM); + panic("sys_voutb failed"); } user_vir_d++; @@ -499,7 +499,7 @@ PRIVATE void do_printer_output() done_status = status; output_done(); if(sys_irqenable(&irq_hook_id) != OK) { - panic(__FILE__, "sys_irqenable failed\n", NO_NUM); + panic("sys_irqenable failed"); } return; } @@ -510,7 +510,7 @@ PRIVATE void do_printer_output() done_status = OK; output_done(); if(sys_irqenable(&irq_hook_id) != OK) { - panic(__FILE__, "sys_irqenable failed\n", NO_NUM); + panic("sys_irqenable failed"); } } diff --git a/drivers/random/main.c b/drivers/random/main.c index 666a48ecf..4e383a677 100644 --- a/drivers/random/main.c +++ b/drivers/random/main.c @@ -102,7 +102,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Retrieve first randomness buffer with parameters. */ if (OK != (s=sys_getrandomness(&krandom))) { - report("RANDOM", "sys_getrandomness failed", s); + printf("RANDOM: sys_getrandomness failed: %d\n", s); exit(1); } @@ -317,7 +317,7 @@ message *m_ptr; /* pointer to alarm message */ /* Schedule new alarm for next m_random call. */ if (OK != (s=sys_setalarm(KRANDOM_PERIOD, 0))) - report("RANDOM", "sys_setalarm failed", s); + printf("RANDOM: sys_setalarm failed: %d\n", s); } /*============================================================================* diff --git a/drivers/random/random.c b/drivers/random/random.c index 001a1a78f..ad81e3676 100644 --- a/drivers/random/random.c +++ b/drivers/random/random.c @@ -73,7 +73,7 @@ int count; printf("random_update: got %d samples for source %d\n", count, source); #endif if (source < 0 || source >= TOTAL_SOURCES) - panic("memory", "random_update: bad source", source); + panic("random_update: bad source: %d", source); for (i= 0; ire_base_port= bar; @@ -720,7 +716,7 @@ re_t *rep; #define BUF_ALIGNMENT (64*1024) if(!(mallocbuf = alloc_contig(BUF_ALIGNMENT + tot_bufsize, 0, &buf))) { - panic("RTL8139","Couldn't allocate kernel buffer",NO_NUM); + panic("Couldn't allocate kernel buffer"); } /* click-align mallocced buffer. this is what we used to get @@ -816,7 +812,7 @@ re_t *rep; break; } while (getuptime(&t1)==OK && (t1-t0) < system_hz); if (rl_inb(port, RL_BMCR) & MII_CTRL_RST) - panic("rtl8139","reset PHY failed to complete", NO_NUM); + panic("reset PHY failed to complete"); #endif /* Reset the device */ @@ -995,7 +991,7 @@ static void rl_readv(message *mp, int from_int, int vectored) dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= RE_PORT_NR) - panic("rtl8139"," illegal port", dl_port); + panic(" illegal port: %d", dl_port); rep= &re_table[dl_port]; re_client= mp->DL_PROC; rep->re_client= re_client; @@ -1048,7 +1044,7 @@ static void rl_readv(message *mp, int from_int, int vectored) printf("rxstat = 0x%08lx\n", rxstat); printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n", d_start, d_end, rxstat); - panic("rtl8139","received packet not OK", NO_NUM); + panic("received packet not OK"); } totlen= (rxstat >> RL_RXS_LEN_S); if (totlen < 8 || totlen > 2*ETH_MAX_PACK_SIZE) @@ -1060,7 +1056,7 @@ static void rl_readv(message *mp, int from_int, int vectored) printf( "d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n", d_start, d_end, totlen, rxstat); - panic(NULL, NULL, NO_NUM); + panic(NULL); } #if 0 @@ -1167,9 +1163,9 @@ static void rl_readv(message *mp, int from_int, int vectored) #if 0 size= mp->DL_COUNT; if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) - panic("rtl8139","invalid packet size", size); + panic("invalid packet size: %d", size); if (OK != sys_umap(re_client, D, (vir_bytes)mp->DL_ADDR, size, &phys_user)) - panic("rtl8139","umap_local failed", NO_NUM); + panic("umap_local failed"); p= rep->re_tx[tx_head].ret_buf; cps = sys_abscopy(phys_user, p, size); @@ -1243,7 +1239,7 @@ static void rl_readv_s(message *mp, int from_int) dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= RE_PORT_NR) - panic("rtl8139"," illegal port", dl_port); + panic(" illegal port: %d", dl_port); rep= &re_table[dl_port]; re_client= mp->DL_PROC; rep->re_client= re_client; @@ -1296,7 +1292,7 @@ static void rl_readv_s(message *mp, int from_int) printf("rxstat = 0x%08lx\n", rxstat); printf("d_start: 0x%x, d_end: 0x%x, rxstat: 0x%lx\n", d_start, d_end, rxstat); - panic("rtl8139","received packet not OK", NO_NUM); + panic("received packet not OK"); } totlen= (rxstat >> RL_RXS_LEN_S); if (totlen < 8 || totlen > 2*ETH_MAX_PACK_SIZE) @@ -1308,7 +1304,7 @@ static void rl_readv_s(message *mp, int from_int) printf( "d_start: 0x%x, d_end: 0x%x, totlen: %d, rxstat: 0x%lx\n", d_start, d_end, totlen, rxstat); - panic(NULL, NULL, NO_NUM); + panic(NULL); } #if 0 @@ -1337,9 +1333,8 @@ static void rl_readv_s(message *mp, int from_int) cps = sys_safecopyfrom(re_client, mp->DL_GRANT, iov_offset, (vir_bytes) rep->re_iovec_s, n * sizeof(rep->re_iovec_s[0]), D); - if (cps != OK) - { - panic(__FILE__, "rl_readv_s: sys_safecopyfrom failed", + if (cps != OK) { + panic("rl_readv_s: sys_safecopyfrom failed: %d", cps); } @@ -1354,7 +1349,7 @@ static void rl_readv_s(message *mp, int from_int) #if 0 if (sys_umap(re_client, D, iovp->iov_addr, s, &dst_phys) != OK) - panic("rtl8139","umap_local failed\n", NO_NUM); + panic("umap_local failed"); #endif if (o >= RX_BUFSIZE) @@ -1371,20 +1366,15 @@ static void rl_readv_s(message *mp, int from_int) cps = sys_safecopyto(re_client, iovp->iov_grant, 0, (vir_bytes) rep->v_re_rx_buf+o, s1, D); - if (cps != OK) - { - panic(__FILE__, - "rl_readv_s: sys_safecopyto failed", - cps); + if (cps != OK) { + panic("rl_readv_s: sys_safecopyto failed: %d", + cps); } cps = sys_safecopyto(re_client, iovp->iov_grant, s1, (vir_bytes) rep->v_re_rx_buf, s-s1, S); - if (cps != OK) - { - panic(__FILE__, - "rl_readv_s: sys_safecopyto failed", - cps); + if (cps != OK) { + panic("rl_readv_s: sys_safecopyto failed: %d", cps); } } else @@ -1393,9 +1383,7 @@ static void rl_readv_s(message *mp, int from_int) iovp->iov_grant, 0, (vir_bytes) rep->v_re_rx_buf+o, s, D); if (cps != OK) - panic(__FILE__, - "rl_readv_s: sys_safecopyto failed", - cps); + panic("rl_readv_s: sys_safecopyto failed: %d", cps); } size += s; @@ -1474,7 +1462,7 @@ static void rl_writev(message *mp, int from_int, int vectored) port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= RE_PORT_NR) - panic("rtl8139","illegal port", port); + panic("illegal port: %d", port); rep= &re_table[port]; re_client= mp->DL_PROC; rep->re_client= re_client; @@ -1532,14 +1520,12 @@ if (cps != OK) printf("RTL8139: warning, sys_vircopy failed: %d\n", cps); for (j= 0, iovp= rep->re_iovec; jiov_size; - if (size + s > ETH_MAX_PACK_SIZE_TAGGED) - { - panic("rtl8139","invalid packet size", - NO_NUM); + if (size + s > ETH_MAX_PACK_SIZE_TAGGED) { + panic("invalid packet size"); } if (OK != sys_umap(re_client, D, iovp->iov_addr, s, &phys_user)) - panic("rtl8139","umap_local failed\n", NO_NUM); + panic("umap_local failed"); cps = sys_vircopy(re_client, D, iovp->iov_addr, SELF, D, (vir_bytes) ret, s); @@ -1549,13 +1535,13 @@ if (cps != OK) printf("RTL8139: warning, sys_vircopy failed: %d\n", cps); } } if (size < ETH_MIN_PACK_SIZE) - panic("rtl8139","invalid packet size", size); + panic("invalid packet size: %d", size); } else { size= mp->DL_COUNT; if (size < ETH_MIN_PACK_SIZE || size > ETH_MAX_PACK_SIZE_TAGGED) - panic("rtl8139","invalid packet size", size); + panic("invalid packet size: %d", size); ret = rep->re_tx[tx_head].v_ret_buf; cps = sys_vircopy(re_client, D, (vir_bytes)mp->DL_ADDR, SELF, D, (vir_bytes) ret, size); @@ -1595,7 +1581,7 @@ suspend: #endif if (from_int) - panic("rtl8139","should not be sending\n", NO_NUM); + panic("should not be sending"); rep->re_tx_mess= *mp; reply(rep, OK, FALSE); @@ -1617,7 +1603,7 @@ static void rl_writev_s(message *mp, int from_int) port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= RE_PORT_NR) - panic("rtl8139","illegal port", port); + panic("illegal port: %d", port); rep= &re_table[port]; re_client= mp->DL_PROC; rep->re_client= re_client; @@ -1666,34 +1652,27 @@ static void rl_writev_s(message *mp, int from_int) cps = sys_safecopyfrom(re_client, mp->DL_GRANT, iov_offset, (vir_bytes) rep->re_iovec_s, n * sizeof(rep->re_iovec_s[0]), D); - if (cps != OK) - { - panic(__FILE__, "rl_writev_s: sys_safecopyfrom failed", - cps); + if (cps != OK) { + panic("rl_writev_s: sys_safecopyfrom failed: %d", cps); } for (j= 0, iovp= rep->re_iovec_s; jiov_size; - if (size + s > ETH_MAX_PACK_SIZE_TAGGED) - { - panic("rtl8139","invalid packet size", - NO_NUM); + if (size + s > ETH_MAX_PACK_SIZE_TAGGED) { + panic("invalid packet size"); } cps = sys_safecopyfrom(re_client, iovp->iov_grant, 0, (vir_bytes) ret, s, D); - if (cps != OK) - { - panic(__FILE__, - "rl_writev_s: sys_safecopyfrom failed", - cps); + if (cps != OK) { + panic("rl_writev_s: sys_safecopyfrom failed: %d", cps); } size += s; ret += s; } } if (size < ETH_MIN_PACK_SIZE) - panic("rtl8139","invalid packet size", size); + panic("invalid packet size: %d", size); rl_outl(rep->re_base_port, RL_TSD0+tx_head*4, rep->re_ertxth | size); @@ -1728,7 +1707,7 @@ suspend: #endif if (from_int) - panic("rtl8139","should not be sending\n", NO_NUM); + panic("should not be sending"); rep->re_tx_mess= *mp; reply(rep, OK, FALSE); @@ -2152,7 +2131,7 @@ re_t *rep; break; } while (getuptime(&t1)==OK && (t1-t0) < system_hz); if (rl_inb(port, RL_CR) & RL_CR_RE) - panic("rtl8139","cannot disable receiver", NO_NUM); + panic("cannot disable receiver"); #if 0 printf("RBSTART = 0x%08x\n", rl_inl(port, RL_RBSTART)); @@ -2200,7 +2179,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= RE_PORT_NR) - panic("rtl8139","illegal port", port); + panic("illegal port: %d", port); rep= &re_table[port]; rep->re_client= mp->DL_PROC; @@ -2212,14 +2191,14 @@ message *mp; r = sys_datacopy(SELF, (vir_bytes) &stats, mp->DL_PROC, (vir_bytes) mp->DL_ADDR, sizeof(stats)); if (r != OK) - panic(__FILE__, "rl_getstat: sys_datacopy failed", r); + panic("rl_getstat: sys_datacopy failed: %d", r); mp->m_type= DL_STAT_REPLY; mp->DL_PORT= port; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic("RTL8139", "rl_getstat: send failed: %d\n", r); + panic("rl_getstat: send failed: %d", r); } /*===========================================================================* @@ -2234,7 +2213,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= RE_PORT_NR) - panic("rtl8139","illegal port", port); + panic("illegal port: %d", port); rep= &re_table[port]; rep->re_client= mp->DL_PROC; @@ -2246,14 +2225,14 @@ message *mp; r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes) &stats, sizeof(stats), D); if (r != OK) - panic(__FILE__, "rl_getstat_s: sys_safecopyto failed", r); + panic("rl_getstat_s: sys_safecopyto failed: %d", r); mp->m_type= DL_STAT_REPLY; mp->DL_PORT= port; mp->DL_STAT= OK; r= send(mp->m_source, mp); if (r != OK) - panic("RTL8139", "rl_getstat_s: send failed: %d\n", r); + panic("rl_getstat_s: send failed: %d", r); } @@ -2270,7 +2249,7 @@ message *mp; mp->m_type= DL_NAME_REPLY; r= send(mp->m_source, mp); if (r != OK) - panic("RTL8139", "rl_getname: send failed: %d\n", r); + panic("rl_getname: send failed: %d", r); } @@ -2299,7 +2278,7 @@ int may_block; reply.DL_STAT = status | ((u32_t) err << 16); reply.DL_COUNT = rep->re_read_s; if (OK != (r = getuptime(&now))) - panic("rtl8139","getuptime() failed:", r); + panic("getuptime() failed: %d", r); reply.DL_CLCK = now; r= send(rep->re_client, &reply); @@ -2314,7 +2293,7 @@ int may_block; if (r < 0) { printf("RTL8139 tried sending to %d, type %d\n", rep->re_client, reply.m_type); - panic("rtl8139","send failed:", r); + panic("send failed: %d", r); } rep->re_read_s = 0; @@ -2329,7 +2308,7 @@ message *req; message *reply_mess; { if (send(req->m_source, reply_mess) != OK) - panic("rtl8139","unable to mess_reply", NO_NUM); + panic("unable to mess_reply"); } #if 0 @@ -2553,10 +2532,8 @@ re_t *rep; if (!(rl_inb(port, RL_CR) & RL_CR_TE)) break; } while (getuptime(&t1)==OK && (t1-t0) < system_hz); - if (rl_inb(port, RL_CR) & RL_CR_TE) - { - panic("rtl8139","cannot disable transmitter", - NO_NUM); + if (rl_inb(port, RL_CR) & RL_CR_TE) { + panic("cannot disable transmitter"); } rl_outb(port, RL_CR, cr | RL_CR_TE); @@ -2963,7 +2940,7 @@ u16_t w; break; } while (getuptime(&t1) == OK && (t1 == t0)); if (!(inb_reg3(dep, 1) & 1)) - panic("set_ee_word","device remains busy", NO_NUM); + panic("device remains busy"); } static void ee_wds(dep) diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index 0dae314f1..26d5fc5c9 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -296,7 +296,7 @@ int main(int argc, char *argv[]) while (TRUE) { if ((r = sef_receive(ANY, &m)) != OK) - panic("rtl8169", "sef_receive failed", r); + panic("sef_receive failed: %d", r); if (is_notify(m.m_type)) { switch (_ENDPOINT_P(m.m_source)) { @@ -333,8 +333,7 @@ int main(int argc, char *argv[]) break; } default: - panic("rtl8169", "illegal notify from", - m.m_type); + panic("illegal notify from: %d", m.m_type); } /* done, get nwe message */ @@ -349,7 +348,7 @@ int main(int argc, char *argv[]) case DL_GETSTAT_S: rl_getstat_s(&m); break; case DL_GETNAME: rl_getname(&m); break; default: - panic("rtl8169", "illegal message", m.m_type); + panic("illegal message: %d", m.m_type); } } } @@ -750,8 +749,7 @@ re_t *rep; if (pcitab[i].did != did) continue; if (pcitab[i].checkclass) { - panic("rtl_probe", - "class check not implemented", NO_NUM); + panic("class check not implemented"); } break; } @@ -780,8 +778,7 @@ re_t *rep; pci_reserve(devind); bar = pci_attr_r32(devind, PCI_BAR) & 0xffffffe0; if (bar < 0x400) { - panic("rtl_probe", - "base address is not properly configured", NO_NUM); + panic("base address is not properly configured"); } rep->re_base_port = bar; @@ -855,7 +852,7 @@ re_t *rep; tot_bufsize += 4096 - (tot_bufsize % 4096); if (!(mallocbuf = alloc_contig(tot_bufsize, AC_ALIGN64K, &buf))) - panic("RTL8169", "Couldn't allocate kernel buffer", NO_NUM); + panic("Couldn't allocate kernel buffer"); /* Rx Descriptor */ rep->re_rx_desc = (re_desc *)mallocbuf; @@ -1279,7 +1276,7 @@ void transmittest(re_t *rep) message m; int r; if ((r = sef_receive(ANY, &m)) != OK) - panic("rtl8169", "sef_receive failed", r); + panic("sef_receive failed: %d", r); } while(m.m_source != HARDWARE); assert(!(rep->re_flags & REF_SEND_AVAIL)); rep->re_flags |= REF_SEND_AVAIL; @@ -1306,7 +1303,7 @@ static void rl_readv_s(message *mp, int from_int) dl_port = mp->DL_PORT; count = mp->DL_COUNT; if (dl_port < 0 || dl_port >= RE_PORT_NR) - panic("rtl8169", " illegal port", dl_port); + panic(" illegal port: %d", dl_port); rep = &re_table[dl_port]; re_client = mp->DL_PROC; rep->re_client = re_client; @@ -1355,7 +1352,7 @@ readvs_loop: /* Someting went wrong */ printf("rl_readv_s: bad length (%u) in status 0x%08lx\n", totlen, rxstat); - panic(NULL, NULL, NO_NUM); + panic(NULL); } /* Should subtract the CRC */ @@ -1372,8 +1369,7 @@ readvs_loop: (vir_bytes) rep->re_iovec_s, n * sizeof(rep->re_iovec_s[0]), D); if (cps != OK) { - panic(__FILE__, "rl_readv_s: sys_safecopyfrom failed", - cps); + panic("rl_readv_s: sys_safecopyfrom failed: %d", cps); } for (j = 0, iovp = rep->re_iovec_s; j < n; j++, iovp++) { @@ -1386,8 +1382,7 @@ readvs_loop: cps = sys_safecopyto(re_client, iovp->iov_grant, 0, (vir_bytes) rep->re_rx[index].v_ret_buf + size, s, D); if (cps != OK) - panic(__FILE__, - "rl_readv_s: sys_safecopyto failed", cps); + panic("rl_readv_s: sys_safecopyto failed: %d", cps); size += s; if (size == packlen) @@ -1449,7 +1444,7 @@ static void rl_writev_s(message *mp, int from_int) port = mp->DL_PORT; count = mp->DL_COUNT; if (port < 0 || port >= RE_PORT_NR) - panic("rtl8169", "illegal port", port); + panic("illegal port: %d", port); rep = &re_table[port]; assert(mp); assert(port >= 0 && port < RE_PORT_NR); @@ -1516,21 +1511,18 @@ static void rl_writev_s(message *mp, int from_int) (vir_bytes) rep->re_iovec_s, n * sizeof(rep->re_iovec_s[0]), D); if (cps != OK) { - panic(__FILE__, "rl_writev_s: sys_safecopyfrom failed", - cps); + panic("rl_writev_s: sys_safecopyfrom failed: %d", cps); } for (j = 0, iovp = rep->re_iovec_s; j < n; j++, iovp++) { s = iovp->iov_size; if (size + s > ETH_MAX_PACK_SIZE_TAGGED) - panic("rtl8169", "invalid packet size", NO_NUM); + panic("invalid packet size"); cps = sys_safecopyfrom(re_client, iovp->iov_grant, 0, (vir_bytes) ret, s, D); if (cps != OK) { - panic(__FILE__, - "rl_writev_s: sys_safecopyfrom failed", - cps); + panic("rl_writev_s: sys_safecopyfrom failed: %d", cps); } size += s; ret += s; @@ -1538,7 +1530,7 @@ static void rl_writev_s(message *mp, int from_int) } assert(desc); if (size < ETH_MIN_PACK_SIZE) - panic("rtl8169", "invalid packet size", size); + panic("invalid packet size: %d", size); rep->re_tx[tx_head].ret_busy = TRUE; @@ -1567,7 +1559,7 @@ static void rl_writev_s(message *mp, int from_int) suspend: if (from_int) - panic("rtl8169", "should not be sending\n", NO_NUM); + panic("should not be sending"); rep->re_tx_mess = *mp; reply(rep, OK, FALSE); @@ -1673,7 +1665,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= RE_PORT_NR) - panic("rtl8169", "illegal port", port); + panic("illegal port: %d", port); rep = &re_table[port]; rep->re_client = mp->DL_PROC; @@ -1685,14 +1677,14 @@ message *mp; r = sys_datacopy(SELF, (vir_bytes) &stats, mp->DL_PROC, (vir_bytes) mp->DL_ADDR, sizeof(stats)); if (r != OK) - panic(__FILE__, "rl_getstat: sys_datacopy failed", r); + panic("rl_getstat: sys_datacopy failed: %d", r); mp->m_type = DL_STAT_REPLY; mp->DL_PORT = port; mp->DL_STAT = OK; r = send(mp->m_source, mp); if (r != OK) - panic("RTL8169", "rl_getstat: send failed: %d\n", r); + panic("rl_getstat: send failed: %d", r); } /*===========================================================================* @@ -1707,7 +1699,7 @@ message *mp; port = mp->DL_PORT; if (port < 0 || port >= RE_PORT_NR) - panic("rtl8169", "illegal port", port); + panic("illegal port: %d", port); rep = &re_table[port]; rep->re_client = mp->DL_PROC; @@ -1719,14 +1711,14 @@ message *mp; r = sys_safecopyto(mp->DL_PROC, mp->DL_GRANT, 0, (vir_bytes) &stats, sizeof(stats), D); if (r != OK) - panic(__FILE__, "rl_getstat_s: sys_safecopyto failed", r); + panic("rl_getstat_s: sys_safecopyto failed: %d", r); mp->m_type = DL_STAT_REPLY; mp->DL_PORT = port; mp->DL_STAT = OK; r = send(mp->m_source, mp); if (r != OK) - panic("RTL8169", "rl_getstat_s: send failed: %d\n", r); + panic("rl_getstat_s: send failed: %d", r); } @@ -1743,7 +1735,7 @@ message *mp; mp->m_type = DL_NAME_REPLY; r = send(mp->m_source, mp); if (r != OK) - panic("RTL8169", "rl_getname: send failed: %d\n", r); + panic("rl_getname: send failed: %d", r); } @@ -1772,7 +1764,7 @@ int may_block; reply.DL_STAT = status | ((u32_t) err << 16); reply.DL_COUNT = rep->re_read_s; if (OK != (r = getuptime(&now))) - panic("rtl8169", "getuptime() failed:", r); + panic("getuptime() failed: %d", r); reply.DL_CLCK = now; r = send(rep->re_client, &reply); @@ -1785,7 +1777,7 @@ int may_block; if (r < 0) { printf("RTL8169 tried sending to %d, type %d\n", rep->re_client, reply.m_type); - panic("rtl8169", "send failed:", r); + panic("send failed: %d", r); } rep->re_read_s = 0; @@ -1800,7 +1792,7 @@ message *req; message *reply_mess; { if (send(req->m_source, reply_mess) != OK) - panic("rtl8169", "unable to mess_reply", NO_NUM); + panic("unable to mess_reply"); } static void dump_phy(re_t *rep) diff --git a/drivers/sb16/sb16.c b/drivers/sb16/sb16.c index 11f5f6f42..c8cd4bfee 100644 --- a/drivers/sb16/sb16.c +++ b/drivers/sb16/sb16.c @@ -27,7 +27,7 @@ int port; unsigned long value; if ((s=sys_inb(port, &value)) != OK) - panic("SB16DSP","sys_inb() failed", s); + panic("sys_inb() failed: %d", s); return value; } @@ -43,5 +43,5 @@ int value; int s; if ((s=sys_outb(port, value)) != OK) - panic("SB16DSP","sys_outb() failed", s); + panic("sys_outb() failed: %d", s); } diff --git a/drivers/sb16/sb16_dsp.c b/drivers/sb16/sb16_dsp.c index 67e7ca935..26722e661 100644 --- a/drivers/sb16/sb16_dsp.c +++ b/drivers/sb16/sb16_dsp.c @@ -182,7 +182,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) DmaPhys += left; } #else /* CHIP != INTEL */ - panic("SB16DSP","initialization failed, CHIP != INTEL", 0); + panic("initialization failed: CHIP != INTEL: %d", 0); #endif /* CHIP == INTEL */ return(OK); @@ -452,9 +452,9 @@ PRIVATE int dsp_init() /* register interrupt vector and enable irq */ if ((s=sys_irqsetpolicy(SB_IRQ, IRQ_REENABLE, &irq_hook_id )) != OK) - panic("SB16DSP", "Couldn't set IRQ policy", s); + panic("Couldn't set IRQ policy: %d", s); if ((s=sys_irqenable(&irq_hook_id)) != OK) - panic("SB16DSP", "Couldn't enable IRQ", s); + panic("Couldn't enable IRQ: %d", s); DspAvail = 1; return OK; diff --git a/drivers/ti1225/ti1225.c b/drivers/ti1225/ti1225.c index fe232de1e..b48e8de74 100644 --- a/drivers/ti1225/ti1225.c +++ b/drivers/ti1225/ti1225.c @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) { r= sef_receive(ANY, &m); if (r != OK) - panic("ti1225", "sef_receive failed", r); + panic("sef_receive failed: %d", r); printf("ti1225: got message %u from %d\n", m.m_type, m.m_source); } @@ -116,16 +116,16 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) : (progname=env_argv[0]); if((r=tsc_calibrate()) != OK) - panic("ti1225", "tsc_calibrate failed", r); + panic("tsc_calibrate failed: %d", r); debug= 0; while (c= getopt(env_argc, env_argv, "d?"), c != -1) { switch(c) { - case '?': panic("ti1225", "Usage: ti1225 [-d]", NO_NUM); + case '?': panic("Usage: ti1225 [-d]"); case 'd': debug++; break; - default: panic("ti1225", "getopt failed", NO_NUM); + default: panic("getopt failed"); } } @@ -151,11 +151,8 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) continue; if (pcitab_ti[i].did != did) continue; - if (pcitab_ti[i].checkclass) - { - panic("ti1225", - "fxp_probe: class check not implemented", - NO_NUM); + if (pcitab_ti[i].checkclass) { + panic("fxp_probe: class check not implemented"); } break; } @@ -236,7 +233,7 @@ struct port *pp; } if (v32 == 0) - panic("ti1225", "bad legacy-mode base address 0x%x\n", v32); + panic("bad legacy-mode base address: %d", v32); pp->p_exca_port= v32; if (debug) @@ -249,7 +246,7 @@ struct port *pp; pp->p_hook = pp->p_irq; r= sys_irqsetpolicy(pp->p_irq, 0, &pp->p_hook); if (r != OK) - panic("ti1225","sys_irqsetpolicy failed", r); + panic("sys_irqsetpolicy failed: %d", r); #endif /* Clear CBB_BC_INTEXCA */ @@ -279,7 +276,7 @@ struct port *pp; #if USE_INTS r= sys_irqenable(&pp->p_hook); if (r != OK) - panic("ti1225","unable enable interrupts", r); + panic("unable enable interrupts: %d", r); #endif } @@ -308,7 +305,7 @@ PRIVATE void map_regs(struct port *pp, u32_t base) r = ENOSYS; #endif if (r != OK) - panic("ti1225", "map_regs: sys_vm_map failed", r); + panic("map_regs: sys_vm_map failed: %d", r); } PRIVATE void do_int(pp) @@ -489,7 +486,7 @@ struct port *pp; #if USE_INTS r= sys_irqenable(&pp->p_hook); if (r != OK) - panic("ti1225","unable enable interrupts", r); + panic("unable enable interrupts: %d", r); #endif } @@ -502,7 +499,7 @@ PRIVATE u8_t do_inb(port_t port) r= sys_inb(port, &value); if (r != OK) - panic("ti1225","sys_inb failed", r); + panic("sys_inb failed: %d", r); return value; } @@ -512,7 +509,7 @@ PRIVATE void do_outb(port_t port, u8_t value) r= sys_outb(port, value); if (r != OK) - panic("ti1225","sys_outb failed", r); + panic("sys_outb failed: %d", r); } diff --git a/drivers/tty/console.c b/drivers/tty/console.c index 618c98a4e..8e1cbcb30 100644 --- a/drivers/tty/console.c +++ b/drivers/tty/console.c @@ -773,7 +773,7 @@ PRIVATE void beep() /* Fetch current time in advance to prevent beeping delay. */ if ((s=getuptime(&now)) != OK) - panic("TTY","Console couldn't get clock's uptime.", s); + panic("Console couldn't get clock's uptime: %d", s); if (!beeping) { /* Set timer channel 2, square wave, with given frequency. */ pv_set(char_out[0], TIMER_MODE, 0xB6); @@ -790,7 +790,7 @@ PRIVATE void beep() if (tty_timers->tmr_exp_time != tty_next_timeout) { tty_next_timeout = tty_timers->tmr_exp_time; if ((s=sys_setalarm(tty_next_timeout, 1)) != OK) - panic("TTY","Console couldn't set alarm.", s); + panic("Console couldn't set alarm: %d", s); } } @@ -901,7 +901,7 @@ clock_t dur; /* Fetch current time in advance to prevent beeping delay. */ if ((s=getuptime(&now)) != OK) - panic("TTY","Console couldn't get clock's uptime.", s); + panic("Console couldn't get clock's uptime: %d", s); if (!beeping) { /* Set timer channel 2, square wave, with given frequency. */ pv_set(char_out[0], TIMER_MODE, 0xB6); @@ -918,7 +918,7 @@ clock_t dur; if (tty_timers->tmr_exp_time != tty_next_timeout) { tty_next_timeout = tty_timers->tmr_exp_time; if ((s=sys_setalarm(tty_next_timeout, 1)) != OK) - panic("TTY","Console couldn't set alarm.", s); + panic("Console couldn't set alarm: %d", s); } } @@ -994,12 +994,12 @@ tty_t *tp; console_memory = vm_map_phys(SELF, (void *) vid_base, vid_size); if(console_memory == MAP_FAILED) - panic("TTY","Console couldn't map video memory", NO_NUM); + panic("Console couldn't map video memory"); font_memory = vm_map_phys(SELF, (void *)GA_VIDEO_ADDRESS, GA_FONT_SIZE); if(font_memory == MAP_FAILED) - panic("TTY","Console couldn't map font memory", NO_NUM); + panic("Console couldn't map font memory"); vid_size >>= 1; /* word count */ @@ -1050,10 +1050,6 @@ PUBLIC void kputc(int c) return; #endif -#if 0 - if (panicing) -#endif - cons_putk(c); if (c != 0) { kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */ if (kmess.km_size < _KMESS_BUF_SIZE) diff --git a/drivers/tty/keyboard.c b/drivers/tty/keyboard.c index f1fbfadbf..9a3be7b6f 100644 --- a/drivers/tty/keyboard.c +++ b/drivers/tty/keyboard.c @@ -259,7 +259,7 @@ message *m; if (kbdp->offset + n > KBD_BUFSZ) n= KBD_BUFSZ-kbdp->offset; if (n <= 0) - panic("TTY", "do_kbd(READ): bad n", n); + panic("do_kbd(READ): bad n: %d", n); if(safecopy) { r= sys_safecopyto(m->IO_ENDPT, (vir_bytes) m->ADDRESS, 0, (vir_bytes) &kbdp->buf[kbdp->offset], n, D); @@ -427,7 +427,7 @@ message *m; if (kbdp->offset + n > KBD_BUFSZ) n= KBD_BUFSZ-kbdp->offset; if (n <= 0) - panic("TTY", "kbd_status: bad n", n); + panic("kbd_status: bad n: %d", n); kbdp->req_size= 0; if(kbdp->req_safe) { r= sys_safecopyto(kbdp->req_proc, kbdp->req_addr_g, 0, @@ -519,7 +519,7 @@ message *m_ptr; if (isaux) kbdp= &kbdaux; - else if (kbd.nr_open && !panicing) + else if (kbd.nr_open) kbdp= &kbd; else kbdp= NULL; @@ -707,13 +707,13 @@ PRIVATE void kbd_send() * alarm. */ if ((r= getuptime(&now)) != OK) - panic("TTY","Keyboard couldn't get clock's uptime.", r); + panic("Keyboard couldn't get clock's uptime: %d", r); tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog, NULL); if (tty_timers->tmr_exp_time != tty_next_timeout) { tty_next_timeout = tty_timers->tmr_exp_time; if ((r= sys_setalarm(tty_next_timeout, 1)) != OK) - panic("TTY","Keyboard couldn't set alarm.", r); + panic("Keyboard couldn't set alarm: %d", r); } kbd_watchdog_set= 1; } @@ -919,7 +919,7 @@ PRIVATE int kbc_read() #if 0 while (micro_elapsed(&ms) < 1000000); #endif - panic("TTY", "kbc_read failed to complete", NO_NUM); + panic("kbc_read failed to complete"); return EINVAL; } @@ -1017,18 +1017,18 @@ PUBLIC void kb_init_once(void) /* Set interrupt handler and enable keyboard IRQ. */ irq_hook_id = KEYBOARD_IRQ; /* id to be returned on interrupt */ if ((i=sys_irqsetpolicy(KEYBOARD_IRQ, IRQ_REENABLE, &irq_hook_id)) != OK) - panic("TTY", "Couldn't set keyboard IRQ policy", i); + panic("Couldn't set keyboard IRQ policy: %d", i); if ((i=sys_irqenable(&irq_hook_id)) != OK) - panic("TTY", "Couldn't enable keyboard IRQs", i); + panic("Couldn't enable keyboard IRQs: %d", i); kbd_irq_set |= (1 << KEYBOARD_IRQ); /* Set AUX interrupt handler and enable AUX IRQ. */ aux_irq_hook_id = KBD_AUX_IRQ; /* id to be returned on interrupt */ if ((i=sys_irqsetpolicy(KBD_AUX_IRQ, IRQ_REENABLE, &aux_irq_hook_id)) != OK) - panic("TTY", "Couldn't set AUX IRQ policy", i); + panic("Couldn't set AUX IRQ policy: %d", i); if ((i=sys_irqenable(&aux_irq_hook_id)) != OK) - panic("TTY", "Couldn't enable AUX IRQs", i); + panic("Couldn't enable AUX IRQs: %d", i); kbd_irq_set |= (1 << KBD_AUX_IRQ); /* Disable the keyboard and aux */ @@ -1319,13 +1319,13 @@ timer_t *tmrp; kbd_alive= 0; if ((r= getuptime(&now)) != OK) - panic("TTY","Keyboard couldn't get clock's uptime.", r); + panic("Keyboard couldn't get clock's uptime: %d", r); tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog, NULL); if (tty_timers->tmr_exp_time != tty_next_timeout) { tty_next_timeout = tty_timers->tmr_exp_time; if ((r= sys_setalarm(tty_next_timeout, 1)) != OK) - panic("TTY","Keyboard couldn't set alarm.", r); + panic("Keyboard couldn't set alarm: %d", r); } kbd_watchdog_set= 1; } diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index 9f737eb1b..dbe450806 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -171,7 +171,7 @@ PUBLIC int main(void) /* Get a request message. */ r= sef_receive(ANY, &tty_mess); if (r != 0) - panic("TTY", "sef_receive failed with %d", r); + panic("sef_receive failed with: %d", r); /* First handle all kernel notification types that the TTY supports. * - An alarm went off, expire all timers and handle the events. @@ -342,7 +342,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Get kernel environment (protected_mode, pc_at and ega are needed). */ if (OK != (r=sys_getmachine(&machine))) { - panic("TTY","Couldn't obtain kernel environment.", r); + panic("Couldn't obtain kernel environment: %d", r); } /* Initialize the TTY driver. */ @@ -1538,9 +1538,8 @@ int status; /* reply code */ * placeholder for something that is not supposed to be a message. */ if(code == TTY_REVIVE) { - panicing = 1; printf("%s:%d: ", file, line); - panic("TTY","tty_reply sending TTY_REVIVE", NO_NUM); + panic("tty_reply sending TTY_REVIVE"); } status = sendnb(replyee, &tty_mess); @@ -1565,7 +1564,7 @@ int mayflush; if (tp->tty_pgrp != 0) { if (OK != (status = sys_kill(tp->tty_pgrp, sig))) { - panic("TTY","Error, call to sys_kill failed", status); + panic("Error; call to sys_kill failed: %d", status); } } @@ -1668,7 +1667,7 @@ PRIVATE void expire_timers(void) /* Get the current time to compare the timers against. */ if ((s=getuptime(&now)) != OK) - panic("TTY","Couldn't get uptime from clock.", s); + panic("Couldn't get uptime from clock: %d", s); /* Scan the queue of timers for expired timers. This dispatch the watchdog * functions of expired timers. Possibly a new alarm call must be scheduled. @@ -1678,7 +1677,7 @@ PRIVATE void expire_timers(void) else { /* set new sync alarm */ tty_next_timeout = tty_timers->tmr_exp_time; if ((s=sys_setalarm(tty_next_timeout, 1)) != OK) - panic("TTY","Couldn't set synchronous alarm.", s); + panic("Couldn't set synchronous alarm: %d", s); } } @@ -1695,7 +1694,7 @@ int enable; /* set timer if true, otherwise unset */ /* Get the current time to calculate the timeout time. */ if ((s=getuptime(&now)) != OK) - panic("TTY","Couldn't get uptime from clock.", s); + panic("Couldn't get uptime from clock: %d", s); if (enable) { exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (system_hz/10); /* Set a new timer for enabling the TTY events flags. */ @@ -1714,7 +1713,7 @@ int enable; /* set timer if true, otherwise unset */ else if (tty_timers->tmr_exp_time != tty_next_timeout) { tty_next_timeout = tty_timers->tmr_exp_time; if ((s=sys_setalarm(tty_next_timeout, 1)) != OK) - panic("TTY","Couldn't set synchronous alarm.", s); + panic("Couldn't set synchronous alarm: %d", s); } } diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h index 82da3a700..e60978109 100644 --- a/drivers/tty/tty.h +++ b/drivers/tty/tty.h @@ -111,8 +111,6 @@ extern u32_t system_hz; /* system clock frequency */ extern unsigned long kbd_irq_set; extern unsigned long rs_irq_set; -extern int panicing; /* From panic.c in sysutil */ - /* Values for the fields. */ #define NOT_ESCAPED 0 /* previous character is not LNEXT (^V) */ #define ESCAPED 1 /* previous character was LNEXT (^V) */ diff --git a/include/minix/const.h b/include/minix/const.h index 1d6ac73cb..ea3aa37bc 100644 --- a/include/minix/const.h +++ b/include/minix/const.h @@ -60,7 +60,6 @@ #define BYTE 0377 /* mask for 8 bits */ #define READING 0 /* copy data to user */ #define WRITING 1 /* copy data from user */ -#define NO_NUM 0x8000 /* used as numerical argument to panic() */ #define NIL_PTR (char *) 0 /* generally useful expression */ #define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */ diff --git a/include/minix/devio.h b/include/minix/devio.h index fbcd6f962..dc3d7ea7f 100644 --- a/include/minix/devio.h +++ b/include/minix/devio.h @@ -32,7 +32,7 @@ typedef struct { u16_t port; u32_t value; } pvl_pair_t; printf("%s:%d: actual port: 0x%x != 0x%lx || " \ "actual value: 0x%x != 0x%lx\n", \ __FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \ - panic(__FILE__, "pv_set(" #pv ", " #p ", " #v ")", NO_NUM); \ + panic("pv_set(" #pv ", " #p ", " #v ")"); \ } \ } while(0) diff --git a/include/minix/sysutil.h b/include/minix/sysutil.h index cc09c2dd4..c6e4edb33 100644 --- a/include/minix/sysutil.h +++ b/include/minix/sysutil.h @@ -44,8 +44,7 @@ _PROTOTYPE( int fkey_ctl, (int req, int *fkeys, int *sfkeys) ); _PROTOTYPE( int printf, (const char *fmt, ...)); _PROTOTYPE( void kputc, (int c)); -_PROTOTYPE( void report, (char *who, char *mess, int num)); -_PROTOTYPE( void panic, (char *who, char *mess, int num)); +_PROTOTYPE( void panic, (const char *fmt, ...)); _PROTOTYPE( int getuptime, (clock_t *ticks)); _PROTOTYPE( int getuptime2, (clock_t *ticks, time_t *boottime)); _PROTOTYPE( int tickdelay, (clock_t ticks)); @@ -65,7 +64,7 @@ _PROTOTYPE( void get_randomness, (struct k_randomness *, int)); #define asynsend(ep, msg) asynsend3(ep, msg, 0) _PROTOTYPE( int asynsend3, (endpoint_t ep, message *msg, int flags)); -#define ASSERT(c) if(!(c)) { panic(__FILE__, "assert " #c " failed at line", __LINE__); } +#define ASSERT(c) if(!(c)) { panic("%s:%d: assert %s failed", __FILE__, __LINE__, #c); } /* timing library */ #define TIMING_CATEGORIES 20 diff --git a/include/minix/type.h b/include/minix/type.h index f176632d1..4503cddb4 100644 --- a/include/minix/type.h +++ b/include/minix/type.h @@ -167,7 +167,7 @@ struct memory { #define STATICINIT(v, n) \ if(!(v)) { \ if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \ - panic(__FILE__, "allocating " #v " failed", n); \ + panic("allocating " #v " failed: %d", n); \ } \ } diff --git a/kernel/arch/i386/arch_do_vmctl.c b/kernel/arch/i386/arch_do_vmctl.c index 78ca63f6b..d3b32a855 100644 --- a/kernel/arch/i386/arch_do_vmctl.c +++ b/kernel/arch/i386/arch_do_vmctl.c @@ -48,8 +48,7 @@ struct proc *p; return ESRCH; pagefaults = rp->p_nextpagefault; if(!RTS_ISSET(rp, RTS_PAGEFAULT)) - minix_panic("non-PAGEFAULT process on pagefault chain", - rp->p_endpoint); + panic( "non-PAGEFAULT process on pagefault chain: %d", rp->p_endpoint); m_ptr->SVMCTL_PF_WHO = rp->p_endpoint; m_ptr->SVMCTL_PF_I386_CR2 = rp->p_pagefault.pf_virtual; m_ptr->SVMCTL_PF_I386_ERR = rp->p_pagefault.pf_flags; diff --git a/kernel/arch/i386/exception.c b/kernel/arch/i386/exception.c index 4d9393abb..004b67a05 100644 --- a/kernel/arch/i386/exception.c +++ b/kernel/arch/i386/exception.c @@ -70,7 +70,7 @@ void pagefault( struct proc *pr, proc_stacktrace(proc_addr(SYSTEM)); } printf("pc of pagefault: 0x%lx\n", frame->eip); - minix_panic("page fault in system process", pr->p_endpoint); + panic("page fault in system process: %d", pr->p_endpoint); return; } @@ -163,8 +163,7 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame) frame->eip = (reg_t) __user_copy_msg_pointer_failure; return; default: - minix_panic("Copy involving a user pointer " - "failed unexpectedly!", NO_NUM); + panic("Copy involving a user pointer failed unexpectedly!"); } } } @@ -216,11 +215,11 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame) (unsigned) saved_proc->p_reg.pc); proc_stacktrace(saved_proc); - minix_panic("exception in a kernel task", saved_proc->p_endpoint); + panic("exception in a kernel task: %d", saved_proc->p_endpoint); } else { /* in an early stage of boot process we don't have processes yet */ - minix_panic("exception in kernel while booting", NO_NUM); + panic("exception in kernel while booting"); } } diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index 095913cdd..742539502 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -48,7 +48,7 @@ FORWARD _PROTOTYPE( void vm_enable_paging, (void) ); PUBLIC void vm_init(struct proc *newptproc) { if(vm_running) - minix_panic("vm_init: vm_running", NO_NUM); + panic("vm_init: vm_running"); switch_address_space(newptproc); vm_enable_paging(); vm_running = 1; @@ -198,7 +198,7 @@ PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr, NOREC_RETURN(linlincopy, EFAULT_DST); } - minix_panic("lin_lin_copy fault out of range", NO_NUM); + panic("lin_lin_copy fault out of range"); /* Not reached. */ NOREC_RETURN(linlincopy, EFAULT); @@ -229,7 +229,7 @@ PRIVATE u32_t phys_get32(phys_bytes addr) if((r=lin_lin_copy(NULL, addr, proc_addr(SYSTEM), vir2phys(&v), sizeof(v))) != OK) { - minix_panic("lin_lin_copy for phys_get32 failed", r); + panic("lin_lin_copy for phys_get32 failed: %d", r); } return v; @@ -364,7 +364,7 @@ vir_bytes bytes; /* # of bytes to be copied */ phys_bytes seg_base; if(seg != T && seg != D && seg != S) - minix_panic("umap_local: wrong seg", seg); + panic("umap_local: wrong seg: %d", seg); if (bytes <= 0) return( (phys_bytes) 0); if (vir_addr + bytes <= vir_addr) return 0; /* overflow */ @@ -413,7 +413,7 @@ vir_bytes bytes; /* # of bytes to be copied */ phys = 0; } if(phys == 0) - minix_panic("vm_lookup returned phys", phys); + panic("vm_lookup returned phys: %d", phys); } @@ -603,7 +603,7 @@ int delivermsg(struct proc *rp) printf("vir: 0x%lx lin was: 0x%lx umap now: 0x%lx\n", rp->p_delivermsg_vir, rp->p_delivermsg_lin, umap_local(rp, D, rp->p_delivermsg_vir, sizeof(message))); - minix_panic("that's wrong", NO_NUM); + panic("that's wrong"); } #endif @@ -847,7 +847,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */ struct proc *target; phys_bytes lin; if(r != EFAULT_SRC && r != EFAULT_DST) - minix_panic("lin_lin_copy failed", r); + panic("lin_lin_copy failed: %d", r); if(!vmcheck || !caller) { NOREC_RETURN(virtualcopy, r); } @@ -861,7 +861,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */ lin = phys_addr[_DST_]; target = procs[_DST_]; } else { - minix_panic("r strange", r); + panic("r strange: %d", r); } #if 0 diff --git a/kernel/arch/i386/mpx386.S b/kernel/arch/i386/mpx386.S index 539948d0b..7866c8d52 100644 --- a/kernel/arch/i386/mpx386.S +++ b/kernel/arch/i386/mpx386.S @@ -648,9 +648,8 @@ copr_return: jmp restart copr_not_available_in_kernel: - movl $NO_NUM, 4(%esp) movl $0, (%esp) - call minix_panic + call panic double_fault: EXCEPTION_ERR_CODE(DOUBLE_FAULT_VECTOR) diff --git a/kernel/arch/i386/protect.c b/kernel/arch/i386/protect.c index 4fa728518..bbef77763 100644 --- a/kernel/arch/i386/protect.c +++ b/kernel/arch/i386/protect.c @@ -135,7 +135,7 @@ PUBLIC void prot_init(void) /* Click-round kernel. */ if(kinfo.data_base % CLICK_SIZE) - minix_panic("kinfo.data_base not aligned", NO_NUM); + panic("kinfo.data_base not aligned"); kinfo.data_size = (phys_bytes) (CLICK_CEIL(kinfo.data_size)); /* Build gdt and idt pointers in GDT where the BIOS expects them. */ @@ -330,7 +330,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) { } if(fail) { printf("%d/%d checks failed\n", fail, checked); - minix_panic("wrong", fail); + panic("wrong: %d", fail); } } @@ -391,7 +391,7 @@ PUBLIC void printseg(char *banner, int iscs, struct proc *pr, u32_t selector) } if(desc->granularity & 0x20) { /* reserved */ - minix_panic("granularity reserved field set", NO_NUM); + panic("granularity reserved field set"); } if(!(desc->access & PRESENT)) diff --git a/kernel/arch/i386/watchdog.c b/kernel/arch/i386/watchdog.c index a3f09ff0d..8cada4f63 100644 --- a/kernel/arch/i386/watchdog.c +++ b/kernel/arch/i386/watchdog.c @@ -118,7 +118,7 @@ void arch_watchdog_lockup(struct nmi_frame * frame) frame->cs, frame->eflags ); - minix_panic("Kernel lockup\n", NO_NUM); + panic("Kernel lockup"); } void i386_watchdog_start(void) diff --git a/kernel/debug.c b/kernel/debug.c index 60d3c1a68..407a8ebfd 100644 --- a/kernel/debug.c +++ b/kernel/debug.c @@ -24,8 +24,7 @@ check_runqueues_f(char *file, int line) FIXME("check_runqueues being done"); #define MYPANIC(msg) { \ - printf("check_runqueues:%s:%d: %s\n", file, line, msg); \ - minix_panic("check_runqueues failed", NO_NUM); \ + panic("check_runqueues:%s:%d: %s\n", file, line, msg); \ } for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) { diff --git a/kernel/debug.h b/kernel/debug.h index cf376434a..52dd75cba 100644 --- a/kernel/debug.h +++ b/kernel/debug.h @@ -60,20 +60,18 @@ #if DEBUG_VMASSERT #define vmassert(t) { \ - if(!(t)) { minix_panic("vm: assert " #t " failed in " __FILE__, __LINE__); } } + if(!(t)) { panic("kernel:%s:%d: assert %s failed", __FILE__, __LINE__, #t); } } #else #define vmassert(t) { } #endif #define NOT_REACHABLE do { \ - printf("NOT_REACHABLE at %s:%d\n", __FILE__, __LINE__); \ - minix_panic("execution at an unexpected location\n", NO_NUM); \ + panic("NOT_REACHABLE at %s:%d", __FILE__, __LINE__); \ for(;;); \ } while(0) #define NOT_IMPLEMENTED do { \ - printf("NOT_IMPLEMENTED at %s:%d\n", __FILE__, __LINE__); \ - minix_panic("NOT_IMPLEMENTED", NO_NUM); \ + panic("NOT_IMPLEMENTED at %s:%d", __FILE__, __LINE__); \ } while(0) #ifdef CONFIG_BOOT_VERBOSE diff --git a/kernel/interrupt.c b/kernel/interrupt.c index 33380b5ef..d1168113d 100644 --- a/kernel/interrupt.c +++ b/kernel/interrupt.c @@ -32,7 +32,7 @@ PUBLIC void put_irq_handler( irq_hook_t* hook, int irq, irq_handler_t handler) unsigned long bitmap; if( irq < 0 || irq >= NR_IRQ_VECTORS ) - minix_panic("invalid call to put_irq_handler", irq); + panic("invalid call to put_irq_handler: %d", irq); line = &irq_handlers[irq]; @@ -48,7 +48,7 @@ PUBLIC void put_irq_handler( irq_hook_t* hook, int irq, irq_handler_t handler) if (!(bitmap & id)) break; if(id == 0) - minix_panic("Too many handlers for irq", irq); + panic("Too many handlers for irq: %d", irq); hook->next = NULL; hook->handler = handler; @@ -76,7 +76,7 @@ PUBLIC void rm_irq_handler( irq_hook_t* hook ) { irq_hook_t **line; if( irq < 0 || irq >= NR_IRQ_VECTORS ) - minix_panic("invalid call to rm_irq_handler", irq); + panic("invalid call to rm_irq_handler: %d", irq); /* disable the irq. */ irq_actids[hook->irq] |= hook->id; diff --git a/kernel/main.c b/kernel/main.c index 17e99b290..baa9d5f8b 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -241,10 +241,10 @@ PUBLIC void main() /* * enable timer interrupts and clock task on the boot CPU */ + if (boot_cpu_init_timer(system_hz)) { - minix_panic("FATAL : failed to initialize timer interrupts, " - "cannot continue without any clock source!", - NO_NUM); + panic( "FATAL : failed to initialize timer interrupts; " + "cannot continue without any clock source!"); } /* Warnings for sanity checks that take time. These warnings are printed diff --git a/kernel/proc.c b/kernel/proc.c index 26d612252..e159945e5 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -210,8 +210,7 @@ check_misc_flags: #if DEBUG_SCHED_CHECK if (proc_ptr->p_misc_flags & MF_SC_ACTIVE) - minix_panic("MF_SC_ACTIVE and MF_SC_DEFER set", - NO_NUM); + panic("MF_SC_ACTIVE and MF_SC_DEFER set"); #endif arch_do_syscall(proc_ptr); @@ -311,7 +310,7 @@ long bit_map; /* notification event set or flags */ #if DEBUG_SCHED_CHECK if (caller_ptr->p_misc_flags & MF_SC_ACTIVE) - minix_panic("MF_SC_ACTIVE already set", NO_NUM); + panic("MF_SC_ACTIVE already set"); #endif /* Set a flag to allow reliable tracing of leaving the system call. */ @@ -322,7 +321,7 @@ long bit_map; /* notification event set or flags */ if(caller_ptr->p_misc_flags & MF_DELIVERMSG) { printf("sys_call: MF_DELIVERMSG on for %s / %d\n", caller_ptr->p_name, caller_ptr->p_endpoint); - minix_panic("MF_DELIVERMSG on", NO_NUM); + panic("MF_DELIVERMSG on"); } #endif @@ -699,7 +698,7 @@ int flags; vmassert(!(caller_ptr->p_misc_flags & MF_DELIVERMSG)); vmassert(src_e == ANY || hisep == src_e); if((r=QueueMess(hisep, vir2phys(&m), caller_ptr)) != OK) { - minix_panic("mini_receive: local QueueMess failed", NO_NUM); + panic("mini_receive: local QueueMess failed"); } return(OK); /* report success */ } @@ -794,7 +793,7 @@ endpoint_t dst_e; /* which process to notify */ BuildNotifyMessage(&m, proc_nr(caller_ptr), dst_ptr); vmassert(!(dst_ptr->p_misc_flags & MF_DELIVERMSG)); if((r=QueueMess(caller_ptr->p_endpoint, vir2phys(&m), dst_ptr)) != OK) { - minix_panic("mini_notify: local QueueMess failed", NO_NUM); + panic("mini_notify: local QueueMess failed"); } RTS_UNSET(dst_ptr, RTS_RECEIVING); return(OK); @@ -1165,7 +1164,7 @@ register struct proc *rp; /* this process is now runnable */ NOREC_ENTER(enqueuefunc); #if DEBUG_SCHED_CHECK - if (rp->p_ready) minix_panic("enqueue already ready process", NO_NUM); + if (rp->p_ready) panic("enqueue already ready process"); #endif /* Determine where to insert to process. */ @@ -1224,7 +1223,7 @@ PRIVATE void enqueue_head(struct proc *rp) int q = rp->p_priority; /* scheduling queue to use */ #if DEBUG_SCHED_CHECK - if (rp->p_ready) minix_panic("enqueue already ready process", NO_NUM); + if (rp->p_ready) panic("enqueue already ready process"); #endif /* @@ -1271,12 +1270,12 @@ register struct proc *rp; /* this process is no longer runnable */ /* Side-effect for kernel: check if the task's stack still is ok? */ if (iskernelp(rp)) { if (*priv(rp)->s_stack_guard != STACK_GUARD) - minix_panic("stack overrun by task", proc_nr(rp)); + panic("stack overrun by task: %d", proc_nr(rp)); } #endif #if DEBUG_SCHED_CHECK - if (! rp->p_ready) minix_panic("dequeue() already unready process", NO_NUM); + if (! rp->p_ready) panic("dequeue() already unready process"); #endif /* Now make sure that the process is not in its ready queue. Remove the @@ -1466,7 +1465,7 @@ int *p, fatalflag; #endif } else ok = 1; if(!ok && fatalflag) { - minix_panic("invalid endpoint ", e); + panic("invalid endpoint: %d", e); } return ok; } diff --git a/kernel/proto.h b/kernel/proto.h index fc099f645..eb9141876 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -35,9 +35,6 @@ _PROTOTYPE( void main, (void) ); _PROTOTYPE( void prepare_shutdown, (int how) ); _PROTOTYPE( void minix_shutdown, (struct timer *tp) ); -/* utility.c */ -_PROTOTYPE( void minix_panic, (char *s, int n) ); - /* proc.c */ _PROTOTYPE( int do_ipc, (int call_nr, int src_dst, message *m_ptr, long bit_map) ); diff --git a/kernel/system.c b/kernel/system.c index 1674e5897..6cc9179b3 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -324,7 +324,7 @@ PUBLIC void send_sig(int proc_nr, int sig_nr) register struct proc *rp; if(!isokprocn(proc_nr) || isemptyn(proc_nr)) - minix_panic("send_sig to empty process", proc_nr); + panic("send_sig to empty process: %d", proc_nr); rp = proc_addr(proc_nr); sigaddset(&priv(rp)->s_sig_pending, sig_nr); @@ -354,7 +354,7 @@ int sig_nr; /* signal to be sent */ register struct proc *rp; if (proc_nr == PM_PROC_NR) - minix_panic("cause_sig: PM gets signal", NO_NUM); + panic("cause_sig: PM gets signal"); /* Check if the signal is already pending. Process it otherwise. */ rp = proc_addr(proc_nr); @@ -458,7 +458,7 @@ register struct proc *rc; /* slot of process to clean up */ register struct proc *rp; /* iterate over process table */ register struct proc **xpp; /* iterate over caller queue */ - if(isemptyp(rc)) minix_panic("clear_proc: empty process", rc->p_endpoint); + if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint); if(rc->p_endpoint == PM_PROC_NR || rc->p_endpoint == VFS_PROC_NR || rc->p_endpoint == VM_PROC_NR) @@ -468,7 +468,7 @@ register struct proc *rc; /* slot of process to clean up */ */ printf("died: "); proc_stacktrace(rc); - minix_panic("system process died", rc->p_endpoint); + panic("system process died: %d", rc->p_endpoint); } /* Make sure that the exiting process is no longer scheduled. */ diff --git a/kernel/system/do_irqctl.c b/kernel/system/do_irqctl.c index ac078b6f1..7656e2586 100644 --- a/kernel/system/do_irqctl.c +++ b/kernel/system/do_irqctl.c @@ -147,7 +147,7 @@ irq_hook_t *hook; * automatically get their interrupt hooks unhooked. */ if(!isokendpt(hook->proc_nr_e, &proc_nr)) - minix_panic("invalid interrupt handler", hook->proc_nr_e); + panic("invalid interrupt handler: %d", hook->proc_nr_e); /* Add a bit for this interrupt to the process' pending interrupts. When * sending the notification message, this bit map will be magically set diff --git a/kernel/system/do_safecopy.c b/kernel/system/do_safecopy.c index 721c8349f..688ce223d 100644 --- a/kernel/system/do_safecopy.c +++ b/kernel/system/do_safecopy.c @@ -350,7 +350,7 @@ PUBLIC int do_safecopy(struct proc * caller, message * m_ptr) src_seg = m_ptr->SCP_SEG; dst_seg = D; access = CPF_WRITE; - } else minix_panic("Impossible system call nr. ", m_ptr->m_type); + } else panic("Impossible system call nr.: %d", m_ptr->m_type); return safecopy(caller, m_ptr->SCP_FROM_TO, caller->p_endpoint, (cp_grant_id_t) m_ptr->SCP_GID, src_seg, dst_seg, diff --git a/kernel/system/do_sysctl.c b/kernel/system/do_sysctl.c index f9b06b002..0bb925795 100644 --- a/kernel/system/do_sysctl.c +++ b/kernel/system/do_sysctl.c @@ -47,7 +47,7 @@ PUBLIC int do_sysctl(struct proc * caller, message * m_ptr) return(EINVAL); } - minix_panic("do_sysctl: can't happen", NO_NUM); + panic("do_sysctl: can't happen"); return(OK); } diff --git a/kernel/system/do_umap.c b/kernel/system/do_umap.c index 4ed207d39..6a4d66a5a 100644 --- a/kernel/system/do_umap.c +++ b/kernel/system/do_umap.c @@ -91,7 +91,7 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr) return EFAULT; } if(phys_addr == 0) - minix_panic("vm_lookup returned zero physical address", NO_NUM); + panic("vm_lookup returned zero physical address"); break; default: if((r=arch_umap(targetpr, offset, count, seg_type, &lin_addr)) diff --git a/kernel/system/do_vdevio.c b/kernel/system/do_vdevio.c index 87bd52f78..d4ca807ec 100644 --- a/kernel/system/do_vdevio.c +++ b/kernel/system/do_vdevio.c @@ -158,7 +158,7 @@ PUBLIC int do_vdevio(struct proc * caller, message * m_ptr) return(OK); bad: - minix_panic("do_vdevio: unaligned port", port); + panic("do_vdevio: unaligned port: %d", port); return EPERM; } diff --git a/kernel/system/do_vmctl.c b/kernel/system/do_vmctl.c index d5955fd27..94adbde3c 100644 --- a/kernel/system/do_vmctl.c +++ b/kernel/system/do_vmctl.c @@ -56,8 +56,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr) #if 0 if(!RTS_ISSET(target, RTS_VMREQTARGET)) { printf("set stack: %s\n", rp->p_vmrequest.stacktrace); - minix_panic("RTS_VMREQTARGET not set for target", - NO_NUM); + panic( "RTS_VMREQTARGET not set for target"); } #endif #endif @@ -95,7 +94,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr) (void *) rp->p_endpoint; break; default: - minix_panic("VMREQUEST wrong type", NO_NUM); + panic("VMREQUEST wrong type"); } rp->p_vmrequest.vmresult = VMSUSPEND; @@ -148,8 +147,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr) printf("suspended with stack: %s\n", p->p_vmrequest.stacktrace); #endif - minix_panic("strange request type", - p->p_vmrequest.type); + panic( "strange request type: %d",p->p_vmrequest.type); } RTS_UNSET(p, RTS_VMREQUEST); @@ -157,17 +155,17 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr) case VMCTL_ENABLE_PAGING: if(vm_running) - minix_panic("do_vmctl: paging already enabled", NO_NUM); + panic("do_vmctl: paging already enabled"); vm_init(p); if(!vm_running) - minix_panic("do_vmctl: paging enabling failed", NO_NUM); + panic("do_vmctl: paging enabling failed"); vmassert(p->p_delivermsg_lin == umap_local(p, D, p->p_delivermsg_vir, sizeof(message))); if ((err = arch_enable_paging()) != OK) { return err; } if(newmap(caller, p, (struct mem_map *) m_ptr->SVMCTL_VALUE) != OK) - minix_panic("do_vmctl: newmap failed", NO_NUM); + panic("do_vmctl: newmap failed"); FIXLINMSG(p); vmassert(p->p_delivermsg_lin); return OK; diff --git a/kernel/utility.c b/kernel/utility.c index 3c46a2d71..5a1cf4fc8 100644 --- a/kernel/utility.c +++ b/kernel/utility.c @@ -1,42 +1,35 @@ /* This file contains a collection of miscellaneous procedures: - * minix_panic: abort MINIX due to a fatal error + * panic: abort MINIX due to a fatal error * kputc: buffered putc used by kernel printf */ #include "kernel.h" #include "proc.h" +#include #include +#include #include #include -/*===========================================================================* - * panic * - *===========================================================================*/ -PUBLIC void panic(char *what, char *mess,int nr) -{ -/* This function is for when a library call wants to panic. - * The library call calls printf() and tries to exit a process, - * which isn't applicable in the kernel. - */ - minix_panic(mess, nr); -} +#define ARE_PANICING 0xDEADC0FF /*===========================================================================* - * minix_panic * + * panic * *===========================================================================*/ -PUBLIC void minix_panic(char *mess,int nr) +PUBLIC void panic(const char *fmt, ...) { -/* The system has run aground of a fatal kernel error. Terminate execution. */ -if (minix_panicing++) { + va_list arg; + /* The system has run aground of a fatal kernel error. Terminate execution. */ + if (minix_panicing == ARE_PANICING) { arch_monitor(); -} - - if (mess != NULL) { - printf("kernel panic: %s", mess); - if(nr != NO_NUM) - printf(" %d", nr); + } + minix_panicing = ARE_PANICING; + if (fmt != NULL) { + printf("kernel panic: "); + va_start(arg, fmt); + vprintf(fmt, arg); printf("\n"); } diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index 3198f4d54..afd80727b 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -103,7 +103,6 @@ SRCS= \ env_prefix.c \ fkey_ctl.c \ tsc_util.c \ - report.c \ read_tsc.S \ read_tsc_64.c \ ser_putc.c \ @@ -111,6 +110,7 @@ SRCS= \ sys_hz.c \ timing.c \ profile_extern.c \ - profile.c + profile.c \ + vprintf.c .include diff --git a/lib/libsys/alloc_util.c b/lib/libsys/alloc_util.c index 217d1a793..d3c01234e 100644 --- a/lib/libsys/alloc_util.c +++ b/lib/libsys/alloc_util.c @@ -68,7 +68,7 @@ void *alloc_contig(size_t len, int flags, phys_bytes *phys) /* Get physical address, if requested. */ if(phys != NULL && sys_umap_data_fb(SELF, buf, len, phys) != OK) - panic("alloc_contig.c", "sys_umap_data_fb failed", NO_NUM); + panic("sys_umap_data_fb failed"); return (void *) buf; } diff --git a/lib/libsys/assert.c b/lib/libsys/assert.c index 22f312532..fa2da1fd9 100644 --- a/lib/libsys/assert.c +++ b/lib/libsys/assert.c @@ -9,6 +9,5 @@ #include void __bad_assertion(const char *mess) { - printf("%s", mess); - panic(NULL, NULL, NO_NUM); + panic("%s", mess); } diff --git a/lib/libsys/asynsend.c b/lib/libsys/asynsend.c index 86def12ab..7c942edb0 100644 --- a/lib/libsys/asynsend.c +++ b/lib/libsys/asynsend.c @@ -79,7 +79,7 @@ int fl; /* Tell the kernel to stop processing */ r= senda(NULL, 0); if (r != OK) - panic(__FILE__, "asynsend: senda failed", r); + panic("asynsend: senda failed: %d", r); dst_ind= 0; for (src_ind= first_slot; src_ind= ASYN_NR) - panic(__FILE__, "asynsend: msgtable full", NO_NUM); + panic("asynsend: msgtable full"); } fl |= AMF_VALID; diff --git a/lib/libsys/env_panic.c b/lib/libsys/env_panic.c index 9d724feec..d487cc5d0 100644 --- a/lib/libsys/env_panic.c +++ b/lib/libsys/env_panic.c @@ -14,6 +14,6 @@ char *key; /* environment variable whose value is bogus */ printf("WARNING: env_get_param() failed in env_panic(): %d\n", s); } printf("Bad environment setting: '%s = %s'\n", key, value); - panic("","", NO_NUM); + panic(""); } diff --git a/lib/libsys/kprintf.c b/lib/libsys/kprintf.c index 5d8e2196c..6453349e7 100644 --- a/lib/libsys/kprintf.c +++ b/lib/libsys/kprintf.c @@ -3,189 +3,19 @@ */ #define nil 0 #include +#include #include #include -#define isdigit(c) ((unsigned) ((c) - '0') < (unsigned) 10) - -#if !__STDC__ -/* Classic C stuff, ignore. */ -void kputc(); -int printf(fmt) char *fmt; -#else - -/* Printf() uses kputc() to print characters. */ -void kputc(int c); - -#define count_kputc(c) do { charcount++; kputc(c); } while(0) - int printf(const char *fmt, ...) -#endif { - int c, charcount = 0; - enum { LEFT, RIGHT } adjust; - enum { LONG, INT } intsize; - int fill; - int width, max, len, base; - static char X2C_tab[]= "0123456789ABCDEF"; - static char x2c_tab[]= "0123456789abcdef"; - char *x2c; - char *p; - long i; - unsigned long u; - char temp[8 * sizeof(long) / 3 + 2]; - - va_list argp; - - va_start(argp, fmt); - - while ((c= *fmt++) != 0) { - if (c != '%') { - /* Ordinary character. */ - count_kputc(c); - continue; - } - - /* Format specifier of the form: - * %[adjust][fill][width][.max]keys - */ - c= *fmt++; - - adjust= RIGHT; - if (c == '-') { - adjust= LEFT; - c= *fmt++; - } - - fill= ' '; - if (c == '0') { - fill= '0'; - c= *fmt++; - } - - width= 0; - if (c == '*') { - /* Width is specified as an argument, e.g. %*d. */ - width= va_arg(argp, int); - c= *fmt++; - } else - if (isdigit(c)) { - /* A number tells the width, e.g. %10d. */ - do { - width= width * 10 + (c - '0'); - } while (isdigit(c= *fmt++)); - } - - max= INT_MAX; - if (c == '.') { - /* Max field length coming up. */ - if ((c= *fmt++) == '*') { - max= va_arg(argp, int); - c= *fmt++; - } else - if (isdigit(c)) { - max= 0; - do { - max= max * 10 + (c - '0'); - } while (isdigit(c= *fmt++)); - } - } + int n; + va_list ap; - /* Set a few flags to the default. */ - x2c= x2c_tab; - i= 0; - base= 10; - intsize= INT; - if (c == 'l' || c == 'L') { - /* "Long" key, e.g. %ld. */ - intsize= LONG; - c= *fmt++; - } - if (c == 0) break; + va_start(ap, fmt); + n = vprintf(fmt, ap); + va_end(ap); - switch (c) { - /* Decimal. */ - case 'd': - i= intsize == LONG ? va_arg(argp, long) - : va_arg(argp, int); - u= i < 0 ? -i : i; - goto int2ascii; - - /* Octal. */ - case 'o': - base= 010; - goto getint; - - /* Pointer, interpret as %X or %lX. */ - case 'p': - if (sizeof(char *) > sizeof(int)) intsize= LONG; - - /* Hexadecimal. %X prints upper case A-F, not %lx. */ - case 'X': - x2c= X2C_tab; - case 'x': - base= 0x10; - goto getint; - - /* Unsigned decimal. */ - case 'u': - getint: - u= intsize == LONG ? va_arg(argp, unsigned long) - : va_arg(argp, unsigned int); - int2ascii: - p= temp + sizeof(temp)-1; - *p= 0; - do { - *--p= x2c[(ptrdiff_t) (u % base)]; - } while ((u /= base) > 0); - goto string_length; - - /* A character. */ - case 'c': - p= temp; - *p= va_arg(argp, int); - len= 1; - goto string_print; - - /* Simply a percent. */ - case '%': - p= temp; - *p= '%'; - len= 1; - goto string_print; - - /* A string. The other cases will join in here. */ - case 's': - p= va_arg(argp, char *); - - string_length: - for (len= 0; p[len] != 0 && len < max; len++) {} - - string_print: - width -= len; - if (i < 0) width--; - if (fill == '0' && i < 0) count_kputc('-'); - if (adjust == RIGHT) { - while (width > 0) { count_kputc(fill); width--; } - } - if (fill == ' ' && i < 0) count_kputc('-'); - while (len > 0) { count_kputc((unsigned char) *p++); len--; } - while (width > 0) { count_kputc(fill); width--; } - break; - - /* Unrecognized format key, echo it back. */ - default: - count_kputc('%'); - count_kputc(c); - } - } - - /* Mark the end with a null (should be something else, like -1). */ - kputc(0); - va_end(argp); - return charcount; + return n; } -/* - * $PchId: kprintf.c,v 1.5 1996/04/11 06:59:05 philip Exp $ - */ diff --git a/lib/libsys/panic.c b/lib/libsys/panic.c index 0128c9e04..0abab10db 100644 --- a/lib/libsys/panic.c +++ b/lib/libsys/panic.c @@ -1,19 +1,15 @@ #include #include #include +#include #include #include "syslib.h" -int panicing= 0; - /*===========================================================================* - * panic * + * panic * *===========================================================================*/ -PUBLIC void panic(who, mess, num) -char *who; /* server identification */ -char *mess; /* message format string */ -int num; /* number to go with format string */ +PUBLIC void panic(const char *fmt, ...) { /* Something awful has happened. Panics are caused when an internal * inconsistency is detected, e.g., a programming error or illegal @@ -23,24 +19,29 @@ int num; /* number to go with format string */ endpoint_t me = NONE; char name[20]; void (*suicide)(void); + static int panicing= 0; + va_list args; + if(panicing) return; panicing= 1; if(sys_whoami(&me, name, sizeof(name)) == OK && me != NONE) - printf("%s(%d): ", name, me); + printf("%s(%d): panic: ", name, me); else - printf("(sys_whoami failed): "); + printf("(sys_whoami failed): panic: "); + + if(fmt) { + va_start(args, fmt); + vprintf(fmt, args); + va_end(fmt); + } else { + printf("no message\n"); + } + printf("\n"); + printf("syslib:panic.c: stacktrace: "); util_stacktrace(); - if (NULL != who && NULL != mess) { - if (num != NO_NUM) { - printf("Panic in %s: %s: %d\n", who, mess, num); - } else { - printf("Panic in %s: %s\n", who, mess); - } - } - /* Try exit */ _exit(1); diff --git a/lib/libsys/pci_attr_r16.c b/lib/libsys/pci_attr_r16.c index 03de6151a..e040c6bfe 100644 --- a/lib/libsys/pci_attr_r16.c +++ b/lib/libsys/pci_attr_r16.c @@ -22,10 +22,10 @@ int port; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_attr_r16: can't talk to PCI", r); + panic("pci_attr_r16: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_attr_r16: got bad reply from PCI", m.m_type); + panic("pci_attr_r16: got bad reply from PCI: %d", m.m_type); return m.m2_l1; } diff --git a/lib/libsys/pci_attr_r32.c b/lib/libsys/pci_attr_r32.c index 0a3aefe49..ef3b23af9 100644 --- a/lib/libsys/pci_attr_r32.c +++ b/lib/libsys/pci_attr_r32.c @@ -22,10 +22,10 @@ int port; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_attr_r32: can't talk to PCI", r); + panic("pci_attr_r32: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_attr_r32: got bad reply from PCI", m.m_type); + panic("pci_attr_r32: got bad reply from PCI: %d", m.m_type); return m.m2_l1; } diff --git a/lib/libsys/pci_attr_r8.c b/lib/libsys/pci_attr_r8.c index d08a6851e..4ee072d17 100644 --- a/lib/libsys/pci_attr_r8.c +++ b/lib/libsys/pci_attr_r8.c @@ -22,10 +22,10 @@ int port; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_attr_r8: can't talk to PCI", r); + panic("pci_attr_r8: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_attr_r8: got bad reply from PCI", m.m_type); + panic("pci_attr_r8: got bad reply from PCI: %d", m.m_type); return m.m2_l1; } diff --git a/lib/libsys/pci_attr_w16.c b/lib/libsys/pci_attr_w16.c index a201f5c00..7fee1322a 100644 --- a/lib/libsys/pci_attr_w16.c +++ b/lib/libsys/pci_attr_w16.c @@ -24,9 +24,9 @@ u16_t value; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_attr_w16: can't talk to PCI", r); + panic("pci_attr_w16: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_attr_w16: got bad reply from PCI", m.m_type); + panic("pci_attr_w16: got bad reply from PCI: %d", m.m_type); } diff --git a/lib/libsys/pci_attr_w32.c b/lib/libsys/pci_attr_w32.c index 775570b68..05bbefcf0 100644 --- a/lib/libsys/pci_attr_w32.c +++ b/lib/libsys/pci_attr_w32.c @@ -24,9 +24,9 @@ u32_t value; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_attr_w32: can't talk to PCI", r); + panic("pci_attr_w32: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_attr_w32: got bad reply from PCI", m.m_type); + panic("pci_attr_w32: got bad reply from PCI: %d", m.m_type); } diff --git a/lib/libsys/pci_attr_w8.c b/lib/libsys/pci_attr_w8.c index f4fa9eb2f..65ec7e9c9 100644 --- a/lib/libsys/pci_attr_w8.c +++ b/lib/libsys/pci_attr_w8.c @@ -24,9 +24,9 @@ u8_t value; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_attr_w8: can't talk to PCI", r); + panic("pci_attr_w8: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_attr_w8: got bad reply from PCI", m.m_type); + panic("pci_attr_w8: got bad reply from PCI: %d", m.m_type); } diff --git a/lib/libsys/pci_del_acl.c b/lib/libsys/pci_del_acl.c index 9fc5db494..6b4184f15 100644 --- a/lib/libsys/pci_del_acl.c +++ b/lib/libsys/pci_del_acl.c @@ -24,9 +24,7 @@ endpoint_t proc_ep; r= ds_retrieve_label_num("pci", &u32); if (r != 0) { - panic("syslib/" __FILE__, - "pci_del_acl: _pm_findproc failed for 'pci'", - r); + panic("pci_del_acl: _pm_findproc failed for 'pci': %d", r); } pci_procnr = u32; } @@ -37,7 +35,7 @@ endpoint_t proc_ep; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_del_acl: can't talk to PCI", r); + panic("pci_del_acl: can't talk to PCI: %d", r); return m.m_type; } diff --git a/lib/libsys/pci_dev_name.c b/lib/libsys/pci_dev_name.c index 3469205eb..88ac26f40 100644 --- a/lib/libsys/pci_dev_name.c +++ b/lib/libsys/pci_dev_name.c @@ -37,7 +37,7 @@ u16_t did; r= sendrec(pci_procnr, &m); cpf_revoke(gid); if (r != 0) - panic("syslib/" __FILE__, "pci_dev_name: can't talk to PCI", r); + panic("pci_dev_name: can't talk to PCI: %d", r); if (m.m_type == ENOENT) { @@ -47,7 +47,7 @@ u16_t did; return NULL; /* No name for this device */ } if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_dev_name: got bad reply from PCI", m.m_type); + panic("pci_dev_name: got bad reply from PCI: %d", m.m_type); name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL * terminated. diff --git a/lib/libsys/pci_find_dev.c b/lib/libsys/pci_find_dev.c index db60548cb..1761dbe0e 100644 --- a/lib/libsys/pci_find_dev.c +++ b/lib/libsys/pci_find_dev.c @@ -25,7 +25,7 @@ int *devindp; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_find_dev: can't talk to PCI", r); + panic("pci_find_dev: can't talk to PCI: %d", r); if (m.m_type == 1) { @@ -35,7 +35,7 @@ int *devindp; return 1; } if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_find_dev: got bad reply from PCI", m.m_type); + panic("pci_find_dev: got bad reply from PCI: %d", m.m_type); printf("pci_find_dev: got nothing\n"); return 0; diff --git a/lib/libsys/pci_first_dev.c b/lib/libsys/pci_first_dev.c index 55d51f6b0..9937c278a 100644 --- a/lib/libsys/pci_first_dev.c +++ b/lib/libsys/pci_first_dev.c @@ -20,7 +20,7 @@ u16_t *didp; m.m_type= BUSC_PCI_FIRST_DEV; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_first_dev: can't talk to PCI", r); + panic("pci_first_dev: can't talk to PCI: %d", r); if (m.m_type == 1) { *devindp= m.m1_i1; @@ -33,7 +33,7 @@ u16_t *didp; return 1; } if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_first_dev: got bad reply from PCI", m.m_type); + panic("pci_first_dev: got bad reply from PCI: %d", m.m_type); #if DEBUG printf("pci_first_dev: got nothing\n"); diff --git a/lib/libsys/pci_ids.c b/lib/libsys/pci_ids.c index 38c30a485..910db54af 100644 --- a/lib/libsys/pci_ids.c +++ b/lib/libsys/pci_ids.c @@ -22,10 +22,10 @@ u16_t *didp; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_ids: can't talk to PCI", r); + panic("pci_ids: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_ids: got bad reply from PCI", m.m_type); + panic("pci_ids: got bad reply from PCI: %d", m.m_type); *vidp= m.m1_i1; *didp= m.m1_i2; printf("pci_ids: %04x/%04x\n", *vidp, *didp); diff --git a/lib/libsys/pci_init1.c b/lib/libsys/pci_init1.c index 758d88b0d..be929d9b8 100644 --- a/lib/libsys/pci_init1.c +++ b/lib/libsys/pci_init1.c @@ -24,7 +24,7 @@ char *name; r= ds_retrieve_label_num("pci", &u32); if (r != 0) - panic("syslib/" __FILE__, "pci_init1: ds_retrieve_label_num failed for 'pci'", r); + panic("pci_init1: ds_retrieve_label_num failed for 'pci': %d", r); pci_procnr= u32; m.m_type= BUSC_PCI_INIT; @@ -39,8 +39,8 @@ char *name; } r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_init1: can't talk to PCI", r); + panic("pci_init1: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_init1: got bad reply from PCI", m.m_type); + panic("pci_init1: got bad reply from PCI: %d", m.m_type); } diff --git a/lib/libsys/pci_next_dev.c b/lib/libsys/pci_next_dev.c index 547186881..5bd989510 100644 --- a/lib/libsys/pci_next_dev.c +++ b/lib/libsys/pci_next_dev.c @@ -22,7 +22,7 @@ u16_t *didp; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_next_dev: can't talk to PCI", r); + panic("pci_next_dev: can't talk to PCI: %d", r); if (m.m_type == 1) { @@ -36,7 +36,7 @@ u16_t *didp; return 1; } if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_next_dev: got bad reply from PCI", m.m_type); + panic("pci_next_dev: got bad reply from PCI: %d", m.m_type); return 0; } diff --git a/lib/libsys/pci_rescan_bus.c b/lib/libsys/pci_rescan_bus.c index ef0aed1ef..a60a238d2 100644 --- a/lib/libsys/pci_rescan_bus.c +++ b/lib/libsys/pci_rescan_bus.c @@ -20,12 +20,11 @@ u8_t busnr; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_rescan_bus: can't talk to PCI", r); + panic("pci_rescan_bus: can't talk to PCI: %d", r); if (m.m_type != 0) { - panic("syslib/" __FILE__, "pci_rescan_bus: got bad reply from PCI", - m.m_type); + panic("pci_rescan_bus: got bad reply from PCI: %d", m.m_type); } } diff --git a/lib/libsys/pci_reserve.c b/lib/libsys/pci_reserve.c index b00d6d826..60e570297 100644 --- a/lib/libsys/pci_reserve.c +++ b/lib/libsys/pci_reserve.c @@ -20,10 +20,10 @@ int devind; r= sendrec(pci_procnr, &m); if (r != 0) - panic("syslib/" __FILE__, "pci_reserve: can't talk to PCI", r); + panic("pci_reserve: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_reserve: got bad reply from PCI", m.m_type); + panic("pci_reserve: got bad reply from PCI: %d", m.m_type); } /*===========================================================================* diff --git a/lib/libsys/pci_set_acl.c b/lib/libsys/pci_set_acl.c index 12cafbca0..d81e4e4a6 100644 --- a/lib/libsys/pci_set_acl.c +++ b/lib/libsys/pci_set_acl.c @@ -25,9 +25,7 @@ struct rs_pci *rs_pci; r= ds_retrieve_label_num("pci", &u32); if (r != 0) { - panic("syslib/" __FILE__, - "pci_set_acl: ds_retrieve_label_num failed for 'pci'", - r); + panic("pci_set_acl: ds_retrieve_label_num failed for 'pci': %d", r); } pci_procnr = u32; } @@ -48,7 +46,7 @@ struct rs_pci *rs_pci; r= sendrec(pci_procnr, &m); cpf_revoke(gid); if (r != 0) - panic("syslib/" __FILE__, "pci_set_acl: can't talk to PCI", r); + panic("pci_set_acl: can't talk to PCI: %d", r); return m.m_type; } diff --git a/lib/libsys/pci_slot_name.c b/lib/libsys/pci_slot_name.c index ad2d84092..e9ff0f8a2 100644 --- a/lib/libsys/pci_slot_name.c +++ b/lib/libsys/pci_slot_name.c @@ -35,10 +35,10 @@ int devind; r= sendrec(pci_procnr, &m); cpf_revoke(gid); if (r != 0) - panic("syslib/" __FILE__, "pci_slot_name: can't talk to PCI", r); + panic("pci_slot_name: can't talk to PCI: %d", r); if (m.m_type != 0) - panic("syslib/" __FILE__, "pci_slot_name: got bad reply from PCI", m.m_type); + panic("pci_slot_name: got bad reply from PCI: %d", m.m_type); name[sizeof(name)-1]= '\0'; /* Make sure that the string is NUL * terminated. diff --git a/lib/libsys/report.c b/lib/libsys/report.c deleted file mode 100644 index e4f9d5ef1..000000000 --- a/lib/libsys/report.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "sysutil.h" - -/*===========================================================================* - * report * - *===========================================================================*/ -PUBLIC void report(who, mess, num) -char *who; /* server identification */ -char *mess; /* message format to print */ -int num; /* number to go with the message */ -{ -/* Display a message for a server. */ - - if (num != NO_NUM) { - printf("%s: %s %d\n", who, mess, num); - } else { - printf("%s: %s\n", who, mess); - } -} - - diff --git a/lib/libsys/sef.c b/lib/libsys/sef.c index a2536d8d7..65303c978 100644 --- a/lib/libsys/sef.c +++ b/lib/libsys/sef.c @@ -48,22 +48,22 @@ PUBLIC void sef_startup() /* Intercept SEF Init requests. */ if(sef_self_endpoint == RS_PROC_NR) { if((r = do_sef_rs_init()) != OK) { - panic("SEF", "unable to complete init", r); + panic("unable to complete init: %d", r); } } else { message m; if((r = receive(RS_PROC_NR, &m)) != OK) { - panic("SEF", "unable to receive from RS", r); + panic("unable to receive from RS: %d", r); } if(IS_SEF_INIT_REQUEST(&m)) { if((r = do_sef_init_request(&m)) != OK) { - panic("SEF", "unable to process init request", r); + panic("unable to process init request: %d", r); } } else { - panic("SEF", "unable to receive init request", NO_NUM); + panic("unable to receive init request"); } } #endif diff --git a/lib/libsys/sef_liveupdate.c b/lib/libsys/sef_liveupdate.c index 862f113ce..8da36e590 100644 --- a/lib/libsys/sef_liveupdate.c +++ b/lib/libsys/sef_liveupdate.c @@ -122,7 +122,7 @@ PUBLIC void sef_lu_ready(int result) m.RS_LU_RESULT = result; r = sendrec(RS_PROC_NR, &m); if ( r != OK) { - panic("SEF", "sendrec failed", r); + panic("sendrec failed: %d", r); } } diff --git a/lib/libsys/timing.c b/lib/libsys/timing.c index 4842dc087..4cf7b27a6 100644 --- a/lib/libsys/timing.c +++ b/lib/libsys/timing.c @@ -22,7 +22,7 @@ void util_timer_start(util_timingdata_t *timingdata, char *name) } if (timingdata->starttimes[HIGHCOUNT]) { - panic(__FILE__, "restart timer?", NO_NUM); + panic("restart timer?"); return; } @@ -37,7 +37,7 @@ void util_timer_end(util_timingdata_t *timingdata) read_tsc(&h, &l); if (!timingdata->starttimes[HIGHCOUNT]) { - panic(__FILE__, "timer stopped but not started", NO_NUM); + panic("timer stopped but not started"); return; } if (timingdata->starttimes[HIGHCOUNT] == h) { @@ -73,7 +73,7 @@ void util_timer_end(util_timingdata_t *timingdata) timingdata->binsize; if (bin < 0 || bin >= TIMING_POINTS) { /* not serious, but can't happen, so shouldn't */ - panic(__FILE__, "bin out of range", bin); + panic("bin out of range: %d", bin); } else { timingdata->lock_timings[bin]++; timingdata->measurements++; diff --git a/lib/libsys/tsc_util.c b/lib/libsys/tsc_util.c index 6a5060f07..dfb1218e0 100644 --- a/lib/libsys/tsc_util.c +++ b/lib/libsys/tsc_util.c @@ -17,7 +17,7 @@ if(!calibrated) { \ int r; \ if((r=tsc_calibrate()) != OK) \ - panic(__FILE__, "calibrate failed\n", r); \ + panic("calibrate failed: %d", r); \ } static u32_t calib_tsc, Hz = 0; @@ -48,9 +48,7 @@ tsc_calibrate(void) diff = sub64(end, start); if(ex64hi(diff) != 0) - panic(__FILE__, - "tsc_calibrate: CALIBRATE_TICKS too high " - "for TSC frequency\n", NO_NUM); + panic("tsc_calibrate: CALIBRATE_TICKS too high for TSC frequency"); calib_tsc = ex64lo(diff); #if 0 printf("tsc_calibrate: " diff --git a/lib/libsys/vprintf.c b/lib/libsys/vprintf.c new file mode 100644 index 000000000..4a97efe42 --- /dev/null +++ b/lib/libsys/vprintf.c @@ -0,0 +1,175 @@ + +#include +#include +#include +#include + +/* vprintf() uses kputc() to print characters. */ +void kputc(int c); + +#define count_kputc(c) do { charcount++; kputc(c); } while(0) + +int vprintf(const char *fmt, va_list argp) +{ + int c, charcount = 0; + enum { LEFT, RIGHT } adjust; + enum { LONG, INT } intsize; + int fill; + int width, max, len, base; + static char X2C_tab[]= "0123456789ABCDEF"; + static char x2c_tab[]= "0123456789abcdef"; + char *x2c; + char *p; + long i; + unsigned long u; + char temp[8 * sizeof(long) / 3 + 2]; + + while ((c= *fmt++) != 0) { + if (c != '%') { + /* Ordinary character. */ + count_kputc(c); + continue; + } + + /* Format specifier of the form: + * %[adjust][fill][width][.max]keys + */ + c= *fmt++; + + adjust= RIGHT; + if (c == '-') { + adjust= LEFT; + c= *fmt++; + } + + fill= ' '; + if (c == '0') { + fill= '0'; + c= *fmt++; + } + + width= 0; + if (c == '*') { + /* Width is specified as an argument, e.g. %*d. */ + width= va_arg(argp, int); + c= *fmt++; + } else + if (isdigit(c)) { + /* A number tells the width, e.g. %10d. */ + do { + width= width * 10 + (c - '0'); + } while (isdigit(c= *fmt++)); + } + + max= INT_MAX; + if (c == '.') { + /* Max field length coming up. */ + if ((c= *fmt++) == '*') { + max= va_arg(argp, int); + c= *fmt++; + } else + if (isdigit(c)) { + max= 0; + do { + max= max * 10 + (c - '0'); + } while (isdigit(c= *fmt++)); + } + } + + /* Set a few flags to the default. */ + x2c= x2c_tab; + i= 0; + base= 10; + intsize= INT; + if (c == 'l' || c == 'L') { + /* "Long" key, e.g. %ld. */ + intsize= LONG; + c= *fmt++; + } + if (c == 0) break; + + switch (c) { + /* Decimal. */ + case 'd': + i= intsize == LONG ? va_arg(argp, long) + : va_arg(argp, int); + u= i < 0 ? -i : i; + goto int2ascii; + + /* Octal. */ + case 'o': + base= 010; + goto getint; + + /* Pointer, interpret as %X or %lX. */ + case 'p': + if (sizeof(char *) > sizeof(int)) intsize= LONG; + + /* Hexadecimal. %X prints upper case A-F, not %lx. */ + case 'X': + x2c= X2C_tab; + case 'x': + base= 0x10; + goto getint; + + /* Unsigned decimal. */ + case 'u': + getint: + u= intsize == LONG ? va_arg(argp, unsigned long) + : va_arg(argp, unsigned int); + int2ascii: + p= temp + sizeof(temp)-1; + *p= 0; + do { + *--p= x2c[(ptrdiff_t) (u % base)]; + } while ((u /= base) > 0); + goto string_length; + + /* A character. */ + case 'c': + p= temp; + *p= va_arg(argp, int); + len= 1; + goto string_print; + + /* Simply a percent. */ + case '%': + p= temp; + *p= '%'; + len= 1; + goto string_print; + + /* A string. The other cases will join in here. */ + case 's': + p= va_arg(argp, char *); + + string_length: + for (len= 0; p[len] != 0 && len < max; len++) {} + + string_print: + width -= len; + if (i < 0) width--; + if (fill == '0' && i < 0) count_kputc('-'); + if (adjust == RIGHT) { + while (width > 0) { count_kputc(fill); width--; } + } + if (fill == ' ' && i < 0) count_kputc('-'); + while (len > 0) { count_kputc((unsigned char) *p++); len--; } + while (width > 0) { count_kputc(fill); width--; } + break; + + /* Unrecognized format key, echo it back. */ + default: + count_kputc('%'); + count_kputc(c); + } + } + + /* Mark the end with a null (should be something else, like -1). */ + kputc(0); + return charcount; +} + +/* + * $PchId: kprintf.c,v 1.5 1996/04/11 06:59:05 philip Exp $ + */ diff --git a/servers/ds/main.c b/servers/ds/main.c index d1195ad5d..64f7c521b 100644 --- a/servers/ds/main.c +++ b/servers/ds/main.c @@ -52,7 +52,7 @@ PUBLIC int main(int argc, char **argv) sig_handler(); break; default: - report("DS","warning, got illegal notify from:", + printf("DS: warning, got illegal notify from: %d\n", m.m_source); result = EINVAL; goto send_reply; @@ -87,7 +87,7 @@ PUBLIC int main(int argc, char **argv) result = do_getsysinfo(&m); break; default: - report("DS","warning, got illegal request from:", m.m_source); + printf("DS: warning, got illegal request from %d\n", m.m_source); result = EINVAL; } @@ -153,7 +153,7 @@ message *m_ptr; /* message buffer */ int status = 0; status = sef_receive(ANY, m_ptr); /* this blocks until message arrives */ if (OK != status) - panic("DS","failed to receive message!", status); + panic("failed to receive message!: %d", status); who_e = m_ptr->m_source; /* message arrived! set sender */ callnr = m_ptr->m_type; /* set function call number */ } diff --git a/servers/ds/store.c b/servers/ds/store.c index 17e893d5c..2adf376fe 100644 --- a/servers/ds/store.c +++ b/servers/ds/store.c @@ -266,12 +266,12 @@ PUBLIC int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Map all the services in the boot image. */ if((r = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0, (vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) { - panic("DS", "sys_safecopyfrom failed", r); + panic("sys_safecopyfrom failed: %d", r); } for(i=0;i < NR_BOOT_PROCS;i++) { if(rprocpub[i].in_use) { if((r = map_service(&rprocpub[i])) != OK) { - panic("DS", "unable to map service", r); + panic("unable to map service: %d", r); } } } diff --git a/servers/hgfs/inode.c b/servers/hgfs/inode.c index 5f545da7e..0aa688a87 100644 --- a/servers/hgfs/inode.c +++ b/servers/hgfs/inode.c @@ -120,7 +120,7 @@ struct inode *ino; ino->i_ref++; if (ino->i_ref == 0) - panic("HGFS", "inode reference count wrapped", NO_NUM); + panic("inode reference count wrapped"); } /*===========================================================================* diff --git a/servers/hgfs/main.c b/servers/hgfs/main.c index 9f0924a64..89e1e3c64 100644 --- a/servers/hgfs/main.c +++ b/servers/hgfs/main.c @@ -176,7 +176,7 @@ endpoint_t *who_e; int r; if ((r = sef_receive(ANY, &m_in)) != OK) - panic("HGFS", "receive failed", r); + panic("receive failed: %d", r); *who_e = m_in.m_source; diff --git a/servers/inet/inet.c b/servers/inet/inet.c index 0e43e7f51..4ee2cec23 100644 --- a/servers/inet/inet.c +++ b/servers/inet/inet.c @@ -329,7 +329,7 @@ PUBLIC void inet_panic() { printf("\ninet stacktrace: "); util_stacktrace(); - (panic)("INET","aborted due to a panic",NO_NUM); + (panic)("aborted due to a panic"); for(;;); } diff --git a/servers/is/dmp.c b/servers/is/dmp.c index f5d9c782b..dfe123d3b 100644 --- a/servers/is/dmp.c +++ b/servers/is/dmp.c @@ -63,7 +63,7 @@ int map; else s = fkey_unmap(&fkeys, &sfkeys); if (s != OK) - report("IS", "warning, fkey_ctl failed:", s); + printf("IS: warning, fkey_ctl failed: %d\n", s); } /*===========================================================================* @@ -82,7 +82,7 @@ message *m; /* notification message */ m->m_type = FKEY_CONTROL; m->FKEY_REQUEST = FKEY_EVENTS; if (OK != (s=sendrec(TTY_PROC_NR, m))) - report("IS", "warning, sendrec to TTY failed", s); + printf("IS: warning, sendrec to TTY failed: %d\n", s); /* Now check which keys were pressed: F1-F12, SF1-SF12. */ for(h=0; h < NHOOKS; h++) diff --git a/servers/is/dmp_kernel.c b/servers/is/dmp_kernel.c index 8c0ea2b53..cf1fae81e 100644 --- a/servers/is/dmp_kernel.c +++ b/servers/is/dmp_kernel.c @@ -65,7 +65,7 @@ PUBLIC void timing_dmp() static int offsetlines = 0; if ((r = sys_getlocktimings(&timingdata[0])) != OK) { - report("IS","warning: couldn't get copy of lock timings", r); + printf("IS: warning: couldn't get copy of lock timings: %d\n", r); return; } @@ -103,7 +103,7 @@ PUBLIC void kmessages_dmp() /* Try to get a copy of the kernel messages. */ if ((r = sys_getkmessages(&kmess)) != OK) { - report("IS","warning: couldn't get copy of kmessages", r); + printf("IS: warning: couldn't get copy of kmessages: %d\n", r); return; } @@ -134,7 +134,7 @@ PUBLIC void monparams_dmp() /* Try to get a copy of the boot monitor parameters. */ if ((r = sys_getmonparams(val, sizeof(val))) != OK) { - report("IS","warning: couldn't get copy of monitor params", r); + printf("IS: warning: couldn't get copy of monitor params: %d\n", r); return; } @@ -161,11 +161,11 @@ PUBLIC void irqtab_dmp() struct irq_hook *e; /* irq tab entry */ if ((r = sys_getirqhooks(irq_hooks)) != OK) { - report("IS","warning: couldn't get copy of irq hooks", r); + printf("IS: warning: couldn't get copy of irq hooks: %d\n", r); return; } if ((r = sys_getirqactids(irq_actids)) != OK) { - report("IS","warning: couldn't get copy of irq mask", r); + printf("IS: warning: couldn't get copy of irq mask: %d\n", r); return; } @@ -217,7 +217,7 @@ PUBLIC void image_dmp() struct boot_image *ip; if ((r = sys_getimage(image)) != OK) { - report("IS","warning: couldn't get copy of image table", r); + printf("IS: warning: couldn't get copy of image table: %d\n", r); return; } printf("Image table dump showing all processes included in system image.\n"); @@ -241,11 +241,11 @@ PUBLIC void kenv_dmp() struct machine machine; int r; if ((r = sys_getkinfo(&kinfo)) != OK) { - report("IS","warning: couldn't get copy of kernel info struct", r); + printf("IS: warning: couldn't get copy of kernel info struct: %d\n", r); return; } if ((r = sys_getmachine(&machine)) != OK) { - report("IS","warning: couldn't get copy of kernel machine struct", r); + printf("IS: warning: couldn't get copy of kernel machine struct: %d\n", r); return; } @@ -319,11 +319,11 @@ PUBLIC void privileges_dmp() /* First obtain a fresh copy of the current process and system table. */ if ((r = sys_getprivtab(priv)) != OK) { - report("IS","warning: couldn't get copy of system privileges table", r); + printf("IS: warning: couldn't get copy of system privileges table: %d\n", r); return; } if ((r = sys_getproctab(proc)) != OK) { - report("IS","warning: couldn't get copy of process table", r); + printf("IS: warning: couldn't get copy of process table: %d\n", r); return; } @@ -386,7 +386,7 @@ PUBLIC void proctab_dmp() /* First obtain a fresh copy of the current process table. */ if ((r = sys_getproctab(proc)) != OK) { - report("IS","warning: couldn't get copy of process table", r); + printf("IS: warning: couldn't get copy of process table: %d\n", r); return; } @@ -422,7 +422,7 @@ PUBLIC void procstack_dmp() /* First obtain a fresh copy of the current process table. */ if ((r = sys_getproctab(proc)) != OK) { - report("IS","warning: couldn't get copy of process table", r); + printf("IS: warning: couldn't get copy of process table: %d\n", r); return; } @@ -446,7 +446,7 @@ PUBLIC void memmap_dmp() /* First obtain a fresh copy of the current process table. */ if ((r = sys_getproctab(proc)) != OK) { - report("IS","warning: couldn't get copy of process table", r); + printf("IS: warning: couldn't get copy of process table: %d\n", r); return; } diff --git a/servers/is/dmp_vm.c b/servers/is/dmp_vm.c index 3201a1fdd..47c742ff3 100644 --- a/servers/is/dmp_vm.c +++ b/servers/is/dmp_vm.c @@ -39,7 +39,7 @@ PUBLIC void vm_dmp() if (prev_i == -1) { if ((r = vm_info_stats(&vsi)) != OK) { - report("IS", "warning: couldn't talk to VM", r); + printf("IS: warning: couldn't talk to VM: %d\n", r); return; } @@ -55,7 +55,7 @@ PUBLIC void vm_dmp() } if ((r = sys_getproctab(proc)) != OK) { - report("IS", "warning: couldn't get copy of process table", r); + printf("IS: warning: couldn't get copy of process table: %d\n", r); return; } diff --git a/servers/is/main.c b/servers/is/main.c index 8e0d71b07..773798004 100644 --- a/servers/is/main.c +++ b/servers/is/main.c @@ -115,7 +115,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) sigact.sa_mask = ~0; /* block all other signals */ sigact.sa_flags = 0; /* default behaviour */ if (sigaction(SIGTERM, &sigact, NULL) < 0) - report("IS","warning, sigaction() failed", errno); + printf("IS: warning, sigaction() failed: %d\n", errno); /* Set key mappings. */ map_unmap_fkeys(TRUE /*map*/); @@ -150,7 +150,7 @@ PRIVATE void get_work() int status = 0; status = sef_receive(ANY, &m_in); /* this blocks until message arrives */ if (OK != status) - panic("IS","sef_receive failed!", status); + panic("sef_receive failed!: %d", status); who_e = m_in.m_source; /* message arrived! set sender */ callnr = m_in.m_type; /* set function call number */ } @@ -166,7 +166,7 @@ int result; /* report result to replyee */ m_out.m_type = result; /* build reply message */ send_status = send(who, &m_out); /* send the message */ if (OK != send_status) - panic("IS", "unable to send reply!", send_status); + panic("unable to send reply!: %d", send_status); } diff --git a/servers/iso9660fs/device.c b/servers/iso9660fs/device.c index 1c867a8cc..623eda530 100644 --- a/servers/iso9660fs/device.c +++ b/servers/iso9660fs/device.c @@ -62,8 +62,7 @@ vir_bytes bytes; if((*gid=cpf_grant_direct(driver, (vir_bytes) *buf, bytes, *op == DEV_READ_S ? CPF_WRITE : CPF_READ)) < 0) { - panic(__FILE__, - "cpf_grant_magic of buffer failed\n", NO_NUM); + panic("cpf_grant_magic of buffer failed"); } break; @@ -77,21 +76,19 @@ vir_bytes bytes; if((*gid = cpf_grant_direct(driver, (vir_bytes) new_iovec, bytes * sizeof(iovec_t), CPF_READ | CPF_WRITE)) < 0) { - panic(__FILE__, - "cpf_grant_direct of vector failed", NO_NUM); + panic("cpf_grant_direct of vector failed"); } v = (iovec_t *) *buf; /* Grant access to i/o buffers. */ for(j = 0; j < bytes; j++) { if(j >= NR_IOREQS) - panic(__FILE__, "vec too big", bytes); + panic("vec too big: %d", bytes); new_iovec[j].iov_addr = gids[j] = cpf_grant_direct(driver, (vir_bytes) v[j].iov_addr, v[j].iov_size, *op == DEV_GATHER_S ? CPF_WRITE : CPF_READ); if(!GRANT_VALID(gids[j])) { - panic(__FILE__, "mfs: grant to iovec buf failed", - NO_NUM); + panic("mfs: grant to iovec buf failed"); } new_iovec[j].iov_size = v[j].iov_size; (*vec_grants)++; @@ -155,7 +152,7 @@ int flags; /* mode bits and flags */ major = (dev >> MAJOR) & BYTE; if (major >= NR_DEVICES) major = 0; r = gen_opcl(driver_e, DEV_OPEN, dev, proc, flags); - if (r == SUSPEND) panic(__FILE__,"suspend on open from", NO_NUM); + if (r == SUSPEND) panic("suspend on open from"); return(r); } @@ -193,7 +190,7 @@ int flags; /* special flags, like O_NONBLOCK */ /* The io vector copying relies on this I/O being for FS itself. */ if(proc_e != SELF_E) { printf("ISOFS(%d) doing block_dev_io for non-self %d\n", SELF_E, proc_e); - panic(__FILE__, "doing block_dev_io for non-self", proc_e); + panic("doing block_dev_io for non-self: %d", proc_e); } /* By default, these are right. */ @@ -238,7 +235,7 @@ int flags; /* special flags, like O_NONBLOCK */ return(r); } else - panic(__FILE__,"call_task: can't send/receive", r); + panic("call_task: can't send/receive: %d", r); } else { /* Did the process we did the sendrec() for get a result? */ if (m.REP_ENDPT != proc_e) { @@ -249,7 +246,7 @@ int flags; /* special flags, like O_NONBLOCK */ /* Task has completed. See if call completed. */ if (m.REP_STATUS == SUSPEND) { - panic(__FILE__, "ISOFS block_dev_io: driver returned SUSPEND", NO_NUM); + panic("ISOFS block_dev_io: driver returned SUSPEND"); } if(buf != buf_used && r == OK) { @@ -304,8 +301,7 @@ message *mess_ptr; /* pointer to message for task */ if (r != OK) { if (r == EDEADSRCDST) { printf("fs: dead driver %d\n", task_nr); - panic(__FILE__, "should handle crashed drivers", - NO_NUM); + panic("should handle crashed drivers"); /* dmap_unmap_by_endpt(task_nr); */ return r; } @@ -313,7 +309,7 @@ message *mess_ptr; /* pointer to message for task */ printf("fs: ELOCKED talking to %d\n", task_nr); return r; } - panic(__FILE__,"call_task: can't send/receive", r); + panic("call_task: can't send/receive: %d", r); } /* Did the process we did the sendrec() for get a result? */ diff --git a/servers/iso9660fs/main.c b/servers/iso9660fs/main.c index a2e84f8b5..c948445aa 100644 --- a/servers/iso9660fs/main.c +++ b/servers/iso9660fs/main.c @@ -95,7 +95,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) fs_m_in.m_type = FS_READY; if ((r = send(FS_PROC_NR, &fs_m_in)) != OK) { - panic("ISOFS", "Error sending login to VFS", r); + panic("Error sending login to VFS: %d", r); } return(OK); @@ -109,7 +109,7 @@ message *m_in; /* pointer to message */ { int s; /* receive status */ if (OK != (s = sef_receive(ANY, m_in))) /* wait for message */ - panic("ISOFS","sef_receive failed", s); + panic("sef_receive failed: %d", s); } /*===========================================================================* diff --git a/servers/iso9660fs/proto.h b/servers/iso9660fs/proto.h index 40cd7b2e4..d5c339121 100644 --- a/servers/iso9660fs/proto.h +++ b/servers/iso9660fs/proto.h @@ -72,5 +72,4 @@ _PROTOTYPE(int create_v_pri, (struct iso9660_vd_pri *v_pri, char *buffer, /* utility.c */ _PROTOTYPE(int no_sys, (void)); -_PROTOTYPE(void panic, (char *who, char *mess, int num)); diff --git a/servers/iso9660fs/read.c b/servers/iso9660fs/read.c index ed2158d8d..789eade94 100644 --- a/servers/iso9660fs/read.c +++ b/servers/iso9660fs/read.c @@ -229,9 +229,7 @@ PUBLIC int fs_getdents(void) { (vir_bytes)getdents_buf, tmpbuf_offset, D); if (r != OK) - panic(__FILE__, - "fs_getdents: sys_safecopyto failed\n",r); - + panic("fs_getdents: sys_safecopyto failed: %d", r); userbuf_off += tmpbuf_offset; tmpbuf_offset= 0; } @@ -264,7 +262,7 @@ PUBLIC int fs_getdents(void) { r = sys_safecopyto(FS_PROC_NR, gid, userbuf_off, (vir_bytes) getdents_buf, tmpbuf_offset, D); if (r != OK) - panic(__FILE__, "fs_getdents: sys_safecopyto failed\n", r); + panic("fs_getdents: sys_safecopyto failed: %d", r); userbuf_off += tmpbuf_offset; } @@ -324,7 +322,7 @@ int *completed; /* number of bytes copied */ /* In all cases, bp now points to a valid buffer. */ if (bp == NIL_BUF) { - panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM); + panic("bp not valid in rw_chunk; this can't happen"); } r = sys_safecopyto(FS_PROC_NR, gid, buf_off, diff --git a/servers/iso9660fs/utility.c b/servers/iso9660fs/utility.c index 85da41e9e..65f140081 100644 --- a/servers/iso9660fs/utility.c +++ b/servers/iso9660fs/utility.c @@ -5,8 +5,6 @@ #include #include -static int panicking; - /*===========================================================================* * no_sys * *===========================================================================*/ @@ -16,22 +14,3 @@ PUBLIC int no_sys() return(EINVAL); } -/*===========================================================================* - * panic * - *===========================================================================*/ -PUBLIC void panic(who, mess, num) -char *who; /* who caused the panic */ -char *mess; /* panic message string */ -int num; /* number to go with it */ -{ -/* Something awful has happened. Panics are caused when an internal - * inconsistency is detected, e.g., a programming error or illegal value of a - * defined constant. - */ - if (panicking) return; /* do not panic during a sync */ - panicking = TRUE; /* prevent another panic during the sync */ - - printf("FS panic (%s): %s ", who, mess); - if (num != NO_NUM) printf("%d",num); - exit(1); -} diff --git a/servers/mfs/cache.c b/servers/mfs/cache.c index 2b53c0e02..3dbb4d0bf 100644 --- a/servers/mfs/cache.c +++ b/servers/mfs/cache.c @@ -79,7 +79,7 @@ int only_search; /* if NO_READ, don't read, else act normal */ } /* Desired block is not on available chain. Take oldest block ('front'). */ - if ((bp = front) == NIL_BUF) panic(__FILE__,"all buffers in use", NR_BUFS); + if ((bp = front) == NIL_BUF) panic("all buffers in use: %d", NR_BUFS); if(bp->b_bytes < fs_block_size) { ASSERT(!bp->bp); @@ -90,7 +90,7 @@ int only_search; /* if NO_READ, don't read, else act normal */ bp && bp->b_bytes < fs_block_size; bp = bp->b_next) ; if(!bp) { - panic("MFS", "no buffer available", NO_NUM); + panic("no buffer available"); } } else { bp->b_bytes = fs_block_size; @@ -475,13 +475,11 @@ PUBLIC void set_blocksize(int blocksize) for (bp = &buf[0]; bp < &buf[NR_BUFS]; bp++) if(bp->b_count != 0) - panic("MFS", "change blocksize with buffer in use", - NO_NUM); + panic("change blocksize with buffer in use"); for (rip = &inode[0]; rip < &inode[NR_INODES]; rip++) if (rip->i_count > 0) - panic("MFS", "change blocksize with inode in use", - NO_NUM); + panic("change blocksize with inode in use"); fs_sync(); diff --git a/servers/mfs/device.c b/servers/mfs/device.c index 668e18639..4d547c026 100644 --- a/servers/mfs/device.c +++ b/servers/mfs/device.c @@ -76,7 +76,7 @@ vir_bytes bytes; if((*gid=cpf_grant_direct(driver, (vir_bytes) *buf, bytes, *op == DEV_READ_S?CPF_WRITE:CPF_READ))<0) { - panic(__FILE__,"cpf_grant_magic of buffer failed\n", NO_NUM); + panic("cpf_grant_magic of buffer failed"); } break; @@ -89,20 +89,19 @@ vir_bytes bytes; if((*gid = cpf_grant_direct(driver, (vir_bytes) new_iovec, bytes * sizeof(iovec_t), CPF_READ | CPF_WRITE)) < 0) { - panic(__FILE__, "cpf_grant_direct of vector failed", NO_NUM); + panic("cpf_grant_direct of vector failed"); } v = (iovec_t *) *buf; /* Grant access to i/o buffers. */ for(j = 0; j < bytes; j++) { if(j >= NR_IOREQS) - panic(__FILE__, "vec too big", bytes); + panic("vec too big: %d", bytes); new_iovec[j].iov_addr = gids[j] = cpf_grant_direct(driver, (vir_bytes) v[j].iov_addr, v[j].iov_size, *op == DEV_GATHER_S ? CPF_WRITE : CPF_READ); if(!GRANT_VALID(gids[j])) { - panic(__FILE__, "mfs: grant to iovec buf failed", - NO_NUM); + panic("mfs: grant to iovec buf failed"); } new_iovec[j].iov_size = v[j].iov_size; (*vec_grants)++; @@ -184,7 +183,7 @@ int flags; /* special flags, like O_NONBLOCK */ /* The io vector copying relies on this I/O being for FS itself. */ if(proc_e != SELF_E) { printf("MFS(%d) doing block_dev_io for non-self %d\n", SELF_E, proc_e); - panic(__FILE__, "doing block_dev_io for non-self", proc_e); + panic("doing block_dev_io for non-self: %d", proc_e); } /* By default, these are right. */ @@ -231,7 +230,7 @@ int flags; /* special flags, like O_NONBLOCK */ return r; } else - panic(__FILE__,"call_task: can't send/receive", r); + panic("call_task: can't send/receive: %d", r); } else { /* Did the process we did the sendrec() for get a result? */ @@ -243,7 +242,7 @@ int flags; /* special flags, like O_NONBLOCK */ /* Task has completed. See if call completed. */ if (m.REP_STATUS == SUSPEND) { - panic(__FILE__, "MFS block_dev_io: driver returned SUSPEND", NO_NUM); + panic("MFS block_dev_io: driver returned SUSPEND"); } if(buf != buf_used && r == OK) { @@ -271,7 +270,7 @@ int flags; /* mode bits and flags */ major = (dev >> MAJOR) & BYTE; if (major >= NR_DEVICES) major = 0; r = gen_opcl(driver_e, DEV_OPEN, dev, proc, flags); - if (r == SUSPEND) panic(__FILE__,"suspend on open from", NO_NUM); + if (r == SUSPEND) panic("suspend on open from"); return(r); } @@ -331,8 +330,7 @@ message *mess_ptr; /* pointer to message for task */ if (r != OK) { if (r == EDEADSRCDST) { printf("fs: dead driver %d\n", task_nr); - panic(__FILE__, "should handle crashed drivers", - NO_NUM); + panic("should handle crashed drivers"); /* dmap_unmap_by_endpt(task_nr); */ return r; } @@ -340,7 +338,7 @@ message *mess_ptr; /* pointer to message for task */ printf("fs: ELOCKED talking to %d\n", task_nr); return r; } - panic(__FILE__,"call_task: can't send/receive", r); + panic("call_task: can't send/receive: %d", r); } /* Did the process we did the sendrec() for get a result? */ diff --git a/servers/mfs/inode.c b/servers/mfs/inode.c index 214d8b057..7c314e4e0 100644 --- a/servers/mfs/inode.c +++ b/servers/mfs/inode.c @@ -45,18 +45,18 @@ PUBLIC int fs_putnode() if(!rip) { printf("%s:%d put_inode: inode #%d dev: %d not found\n", __FILE__, __LINE__, fs_m_in.REQ_INODE_NR, fs_dev); - panic(__FILE__, "fs_putnode failed", NO_NUM); + panic("fs_putnode failed"); } count = fs_m_in.REQ_COUNT; if (count <= 0) { printf("%s:%d put_inode: bad value for count: %d\n", __FILE__, __LINE__, count); - panic(__FILE__, "fs_putnode failed", NO_NUM); + panic("fs_putnode failed"); } else if(count > rip->i_count) { printf("%s:%d put_inode: count too high: %d > %d\n", __FILE__, __LINE__, count, rip->i_count); - panic(__FILE__, "fs_putnode failed", NO_NUM); + panic("fs_putnode failed"); } /* Decrease reference counter, but keep one reference; it will be consumed by @@ -217,7 +217,7 @@ register struct inode *rip; /* pointer to inode to be released */ if (rip == NIL_INODE) return; /* checking here is easier than in caller */ if (rip->i_count < 1) - panic(__FILE__, "put_inode: i_count already below 1", rip->i_count); + panic("put_inode: i_count already below 1: %d", rip->i_count); if (--rip->i_count == 0) { /* i_count == 0 means no one is using it now */ if (rip->i_nlinks == 0) { diff --git a/servers/mfs/link.c b/servers/mfs/link.c index 8a0e2c665..28939ddad 100644 --- a/servers/mfs/link.c +++ b/servers/mfs/link.c @@ -657,7 +657,7 @@ off_t len; if( (b = read_map(rip, pos)) == NO_BLOCK) return; while (len > 0) { if( (bp = get_block(rip->i_dev, b, NORMAL)) == NIL_BUF) - panic(__FILE__, "zerozone_range: no block", NO_NUM); + panic("zerozone_range: no block"); offset = pos % block_size; bytes = block_size - offset; if (bytes > len) diff --git a/servers/mfs/main.c b/servers/mfs/main.c index a4bee343a..426114e09 100644 --- a/servers/mfs/main.c +++ b/servers/mfs/main.c @@ -122,7 +122,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) fs_m_in.m_type = FS_READY; if ((r = send(FS_PROC_NR, &fs_m_in)) != OK) { - panic("MFS", "Error sending login to VFS", r); + panic("Error sending login to VFS: %d", r); } return(OK); @@ -140,7 +140,7 @@ message *m_in; /* pointer to message */ do { if ((r = sef_receive(ANY, m_in)) != OK) /* wait for message */ - panic("MFS","sef_receive failed", r); + panic("sef_receive failed: %d", r); src = fs_m_in.m_source; if (src != FS_PROC_NR) { diff --git a/servers/mfs/mount.c b/servers/mfs/mount.c index 64e129003..24a4ab6f8 100644 --- a/servers/mfs/mount.c +++ b/servers/mfs/mount.c @@ -166,7 +166,7 @@ PUBLIC int fs_unmount() if ((root_ip = find_inode(fs_dev, ROOT_INODE)) == NIL_INODE) { printf("MFS: couldn't find root inode. Unmount failed.\n"); - panic(__FILE__, "MFS: couldn't find root inode", EINVAL); + panic("MFS: couldn't find root inode: %d", EINVAL); return(EINVAL); } diff --git a/servers/mfs/open.c b/servers/mfs/open.c index 72ea55c75..270cf1368 100644 --- a/servers/mfs/open.c +++ b/servers/mfs/open.c @@ -160,7 +160,7 @@ PUBLIC int fs_mkdir() /* It was not possible to enter . or .. probably disk was full - * links counts haven't been touched. */ if(search_dir(ldirp, lastc, (ino_t *) 0, DELETE, IGN_PERM) != OK) - panic(__FILE__, "Dir disappeared ", rip->i_num); + panic("Dir disappeared: %d", rip->i_num); rip->i_nlinks--; /* undo the increment done in new_node() */ } rip->i_dirt = DIRTY; /* either way, i_nlinks has changed */ @@ -232,7 +232,7 @@ PUBLIC int fs_slink() if(search_dir(ldirp, string, (ino_t *) 0, DELETE, IGN_PERM) != OK) - panic(__FILE__, "Symbolic link vanished", NO_NUM); + panic("Symbolic link vanished"); } } diff --git a/servers/mfs/path.c b/servers/mfs/path.c index c9bb8514e..d5268b281 100644 --- a/servers/mfs/path.c +++ b/servers/mfs/path.c @@ -337,9 +337,7 @@ char *suffix; /* current remaining path. Has to point in the if (slen > 0) { /* Do we have path after the link? */ /* For simplicity we require that suffix starts with a slash */ if (suffix[0] != '/') { - panic(__FILE__, - "ltraverse: suffix does not start with a slash", - NO_NUM); + panic("ltraverse: suffix does not start with a slash"); } /* To be able to expand the , we have to move the 'suffix' @@ -540,7 +538,7 @@ int check_permissions; /* check permissions when flag is !IS_EMPTY */ bp = get_block(ldir_ptr->i_dev, b, NORMAL); /* get a dir block */ if (bp == NO_BLOCK) - panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM); + panic("get_block returned NO_BLOCK"); /* Search a directory block. */ for (dp = &bp->b_dir[0]; diff --git a/servers/mfs/read.c b/servers/mfs/read.c index 99aefdd31..e7f794287 100644 --- a/servers/mfs/read.c +++ b/servers/mfs/read.c @@ -228,7 +228,7 @@ int *completed; /* number of bytes copied */ dev = (dev_t) rip->i_zone[0]; } else { if (ex64hi(position) != 0) - panic(__FILE__, "rw_chunk: position too high", NO_NUM); + panic("rw_chunk: position too high"); b = read_map(rip, ex64lo(position)); dev = rip->i_dev; } @@ -259,7 +259,7 @@ int *completed; /* number of bytes copied */ /* In all cases, bp now points to a valid buffer. */ if (bp == NIL_BUF) - panic(__FILE__,"bp not valid in rw_chunk, this can't happen", NO_NUM); + panic("bp not valid in rw_chunk; this can't happen"); if (rw_flag == WRITING && chunk != block_size && !block_spec && ex64lo(position) >= rip->i_size && off == 0) { @@ -367,7 +367,7 @@ int index; /* index into *bp */ zone_t zone; /* V2 zones are longs (shorts in V1) */ if(bp == NIL_BUF) - panic(__FILE__, "rd_indir() on NIL_BUF", NO_NUM); + panic("rd_indir() on NIL_BUF"); sp = get_super(bp->b_dev); /* need super block to find file sys type */ @@ -381,7 +381,7 @@ int index; /* index into *bp */ (zone < (zone_t) sp->s_firstdatazone || zone >= sp->s_zones)) { printf("Illegal zone number %ld in indirect block, index %d\n", (long) zone, index); - panic(__FILE__,"check file system", NO_NUM); + panic("check file system"); } return(zone); @@ -576,7 +576,7 @@ PUBLIC int fs_getdents(void) bp = get_block(rip->i_dev, b, NORMAL); /* get a dir block */ if(bp == NO_BLOCK) - panic(__FILE__,"get_block returned NO_BLOCK", NO_NUM); + panic("get_block returned NO_BLOCK"); /* Search a directory block. */ if (block_pos < pos) @@ -608,9 +608,7 @@ PUBLIC int fs_getdents(void) (vir_bytes)getdents_buf, tmpbuf_off, D); if (r != OK) - panic(__FILE__, - "fs_getdents: sys_safecopyto failed\n", - r); + panic("fs_getdents: sys_safecopyto failed: %d", r); userbuf_off += tmpbuf_off; tmpbuf_off = 0; @@ -646,7 +644,7 @@ PUBLIC int fs_getdents(void) r = sys_safecopyto(FS_PROC_NR, gid, userbuf_off, (vir_bytes) getdents_buf, tmpbuf_off, D); if (r != OK) - panic(__FILE__, "fs_getdents: sys_safecopyto failed\n", r); + panic("fs_getdents: sys_safecopyto failed: %d", r); userbuf_off += tmpbuf_off; } diff --git a/servers/mfs/super.c b/servers/mfs/super.c index 52ea86a96..207d0597d 100644 --- a/servers/mfs/super.c +++ b/servers/mfs/super.c @@ -40,7 +40,7 @@ bit_t origin; /* number of bit to start searching at */ bit_t i, b; if (sp->s_rd_only) - panic(__FILE__,"can't allocate bit on read-only filesys.", NO_NUM); + panic("can't allocate bit on read-only filesys"); if (map == IMAP) { start_block = START_BLOCK; @@ -113,7 +113,7 @@ bit_t bit_returned; /* number of bit to insert into the map */ block_t start_block; if (sp->s_rd_only) - panic(__FILE__,"can't free bit on read-only filesys.", NO_NUM); + panic("can't free bit on read-only filesys"); if (map == IMAP) { start_block = START_BLOCK; @@ -131,8 +131,7 @@ bit_t bit_returned; /* number of bit to insert into the map */ k = conv2(sp->s_native, (int) bp->b_bitmap[word]); if (!(k & mask)) { - panic(__FILE__,map == IMAP ? "tried to free unused inode" : - "tried to free unused block", bit_returned); + panic(map == IMAP ? "tried to free unused inode" : "tried to free unused block: %d", bit_returned); } k &= ~mask; @@ -150,10 +149,10 @@ PUBLIC struct super_block *get_super(dev) dev_t dev; /* device number whose super_block is sought */ { if (dev == NO_DEV) - panic(__FILE__,"request for super_block of NO_DEV", NO_NUM); + panic("request for super_block of NO_DEV"); if(superblock.s_dev != dev) - panic(__FILE__,"wrong superblock", (int) dev); + panic("wrong superblock: %d", (int) dev); return(&superblock); } @@ -165,7 +164,7 @@ dev_t dev; /* device number whose super_block is sought */ PUBLIC int get_block_size(dev_t dev) { if (dev == NO_DEV) - panic(__FILE__,"request for block size of NO_DEV", NO_NUM); + panic("request for block size of NO_DEV"); return(fs_block_size); @@ -189,7 +188,7 @@ register struct super_block *sp; /* pointer to a superblock */ dev = sp->s_dev; /* save device (will be overwritten by copy) */ if (dev == NO_DEV) - panic(__FILE__,"request for super_block of NO_DEV", NO_NUM); + panic("request for super_block of NO_DEV"); r = block_dev_io(MFS_DEV_READ, dev, SELF_E, sbbuf, cvu64(SUPER_BLOCK_BYTES), _MIN_BLOCK_SIZE, 0); diff --git a/servers/mfs/utility.c b/servers/mfs/utility.c index d8a75c5f9..e4b99379c 100644 --- a/servers/mfs/utility.c +++ b/servers/mfs/utility.c @@ -68,10 +68,10 @@ PUBLIC time_t clock_time() if (use_getuptime2) { if ( (k=getuptime2(&uptime,&boottime)) != OK) - panic(__FILE__,"clock_time: getuptme2 failed", k); + panic("clock_time: getuptme2 failed: %d", k); } else { if ( (k=getuptime(&uptime)) != OK) - panic(__FILE__,"clock_time err", k); + panic("clock_time err: %d", k); } return( (time_t) (boottime + (uptime/sys_hz()))); @@ -86,7 +86,7 @@ PUBLIC int mfs_min_f(char *file, int line, int v1, int v2) if(v1 < 0 || v2 < 0) { printf("mfs:%s:%d: strange string lengths: %d, %d\n", file, line, v1, v2); - panic(file, "strange string lengths", NO_NUM); + panic("strange string lengths"); } if(v2 >= v1) return v1; @@ -101,7 +101,7 @@ PUBLIC void mfs_nul_f(char *file, int line, char *str, int len, int maxlen) { if(len < 1) { printf("mfs:%s:%d: %d-length string?!\n", file, line, len); - panic(file, "strange string length", NO_NUM); + panic("strange string length"); } if(len < maxlen && str[len-1] != '\0') { printf("mfs:%s:%d: string (length %d, maxlen %d) " @@ -111,7 +111,7 @@ PUBLIC void mfs_nul_f(char *file, int line, char *str, int len, int maxlen) } #define MYASSERT(c) if(!(c)) { printf("MFS:%s:%d: sanity check: %s failed\n", \ - file, line, #c); panic("MFS", "sanity check " #c " failed", __LINE__); } + file, line, #c); panic("sanity check " #c " failed: %d", __LINE__); } /*===========================================================================* diff --git a/servers/mfs/write.c b/servers/mfs/write.c index b2e90b2a1..a19e5b91b 100644 --- a/servers/mfs/write.c +++ b/servers/mfs/write.c @@ -196,7 +196,7 @@ zone_t zone; /* zone to write */ struct super_block *sp; if(bp == NIL_BUF) - panic(__FILE__, "wr_indir() on NIL_BUF", NO_NUM); + panic("wr_indir() on NIL_BUF"); sp = get_super(bp->b_dev); /* need super block to find file sys type */ diff --git a/servers/pfs/inode.c b/servers/pfs/inode.c index 324844198..31ed005d1 100644 --- a/servers/pfs/inode.c +++ b/servers/pfs/inode.c @@ -41,18 +41,18 @@ PUBLIC int fs_putnode() if(!rip) { printf("%s:%d put_inode: inode #%d dev: %d not found\n", __FILE__, __LINE__, fs_m_in.REQ_INODE_NR, fs_m_in.REQ_DEV); - panic(__FILE__, "fs_putnode failed", NO_NUM); + panic("fs_putnode failed"); } count = fs_m_in.REQ_COUNT; if (count <= 0) { printf("%s:%d put_inode: bad value for count: %d\n", __FILE__, __LINE__, count); - panic(__FILE__, "fs_putnode failed", NO_NUM); + panic("fs_putnode failed"); } else if(count > rip->i_count) { printf("%s:%d put_inode: count too high: %d > %d\n", __FILE__, __LINE__, count, rip->i_count); - panic(__FILE__, "fs_putnode failed", NO_NUM); + panic("fs_putnode failed"); } /* Decrease reference counter, but keep one reference; it will be consumed by @@ -210,7 +210,7 @@ register struct inode *rip; /* pointer to inode to be released */ if (rip == NIL_INODE) return; /* checking here is easier than in caller */ if (rip->i_count < 1) - panic(__FILE__, "put_inode: i_count already below 1", rip->i_count); + panic("put_inode: i_count already below 1: %d", rip->i_count); if (--rip->i_count == 0) { /* i_count == 0 means no one is using it now */ if (rip->i_nlinks == 0) { diff --git a/servers/pfs/main.c b/servers/pfs/main.c index d52a506fa..aa36d28c1 100644 --- a/servers/pfs/main.c +++ b/servers/pfs/main.c @@ -121,7 +121,7 @@ message *m_in; /* pointer to message */ do { if ((r = sef_receive(ANY, m_in)) != OK) /* wait for message */ - panic("PFS","sef_receive failed", r); + panic("sef_receive failed: %d", r); src = fs_m_in.m_source; if (src != VFS_PROC_NR) { diff --git a/servers/pfs/utility.c b/servers/pfs/utility.c index 2956a0cd9..e18a88255 100644 --- a/servers/pfs/utility.c +++ b/servers/pfs/utility.c @@ -26,7 +26,7 @@ PUBLIC time_t clock_time() clock_t uptime, boottime; if ((r = getuptime2(&uptime,&boottime)) != OK) - panic(__FILE__,"clock_time: getuptme2 failed", r); + panic("clock_time: getuptme2 failed: %d", r); return( (time_t) (boottime + (uptime/sys_hz()))); } diff --git a/servers/pm/alarm.c b/servers/pm/alarm.c index 8033eebb3..4c29103e4 100644 --- a/servers/pm/alarm.c +++ b/servers/pm/alarm.c @@ -145,7 +145,7 @@ PUBLIC int do_itimer() break; default: - panic(__FILE__, "invalid timer type", m_in.which_timer); + panic("invalid timer type: %d", m_in.which_timer); } /* If requested, copy the old interval timer to user space. */ @@ -227,14 +227,14 @@ struct itimerval *ovalue; switch (which) { case ITIMER_VIRTUAL: num = VT_VIRTUAL; break; case ITIMER_PROF: num = VT_PROF; break; - default: panic(__FILE__, "invalid vtimer type", which); + default: panic("invalid vtimer type: %d", which); } /* Make the kernel call. If requested, also retrieve and store * the old timer value. */ if ((r = sys_vtimer(rmp->mp_endpoint, num, nptr, optr)) != OK) - panic(__FILE__, "sys_vtimer failed", r); + panic("sys_vtimer failed: %d", r); if (ovalue != NULL) { /* If the alarm expired already, we should take into account the @@ -262,7 +262,7 @@ int sig; switch (sig) { case SIGVTALRM: which = ITIMER_VIRTUAL; num = VT_VIRTUAL; break; case SIGPROF: which = ITIMER_PROF; num = VT_PROF; break; - default: panic(__FILE__, "invalid vtimer signal", sig); + default: panic("invalid vtimer signal: %d", sig); } /* If a repetition interval was set for this virtual timer, tell the @@ -287,7 +287,7 @@ struct itimerval *value; /* First determine remaining time, in ticks, of previous alarm, if set. */ if (rmp->mp_flags & ALARM_ON) { if ( (s = getuptime(&uptime)) != OK) - panic(__FILE__, "get_realtimer couldn't get uptime", s); + panic("get_realtimer couldn't get uptime: %d", s); exptime = *tmr_exp_time(&rmp->mp_timer); remaining = exptime - uptime; diff --git a/servers/pm/exec.c b/servers/pm/exec.c index e1c8e7f75..d464ad21c 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -73,17 +73,15 @@ PUBLIC int do_exec_newmem() return EPERM; proc_e= m_in.EXC_NM_PROC; - if (pm_isokendpt(proc_e, &proc_n) != OK) - { - panic(__FILE__, "do_exec_newmem: got bad endpoint", - proc_e); + if (pm_isokendpt(proc_e, &proc_n) != OK) { + panic("do_exec_newmem: got bad endpoint: %d", proc_e); } rmp= &mproc[proc_n]; ptr= m_in.EXC_NM_PTR; r= sys_datacopy(who_e, (vir_bytes)ptr, SELF, (vir_bytes)&args, sizeof(args)); if (r != OK) - panic(__FILE__, "do_exec_newmem: sys_datacopy failed", r); + panic("do_exec_newmem: sys_datacopy failed: %d", r); if((r=vm_exec_newmem(proc_e, &args, sizeof(args), &stack_top, &flags)) == OK) { allow_setuid= 0; /* Do not allow setuid execution */ @@ -127,10 +125,8 @@ PUBLIC int do_execrestart() return EPERM; proc_e= m_in.EXC_RS_PROC; - if (pm_isokendpt(proc_e, &proc_n) != OK) - { - panic(__FILE__, "do_execrestart: got bad endpoint", - proc_e); + if (pm_isokendpt(proc_e, &proc_n) != OK) { + panic("do_execrestart: got bad endpoint: %d", proc_e); } rmp= &mproc[proc_n]; result= m_in.EXC_RS_RESULT; @@ -191,6 +187,6 @@ int result; new_sp= (char *)rmp->mp_procargs; pc= 0; /* for now */ r= sys_exec(rmp->mp_endpoint, new_sp, rmp->mp_name, pc); - if (r != OK) panic(__FILE__, "sys_exec failed", r); + if (r != OK) panic("sys_exec failed: %d", r); } diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index f2796f2c9..cb87baaf1 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -68,10 +68,10 @@ PUBLIC int do_fork() n++; } while((mproc[next_child].mp_flags & IN_USE) && n <= NR_PROCS); if(n > NR_PROCS) - panic(__FILE__,"do_fork can't find child slot", NO_NUM); + panic("do_fork can't find child slot"); if(next_child < 0 || next_child >= NR_PROCS || (mproc[next_child].mp_flags & IN_USE)) - panic(__FILE__,"do_fork finds wrong child slot", next_child); + panic("do_fork finds wrong child slot: %d", next_child); /* Memory part of the forking. */ if((s=vm_fork(rmp->mp_endpoint, next_child, &child_ep)) != OK) { @@ -158,10 +158,10 @@ PUBLIC int do_fork_nb() n++; } while((mproc[next_child].mp_flags & IN_USE) && n <= NR_PROCS); if(n > NR_PROCS) - panic(__FILE__,"do_fork can't find child slot", NO_NUM); + panic("do_fork can't find child slot"); if(next_child < 0 || next_child >= NR_PROCS || (mproc[next_child].mp_flags & IN_USE)) - panic(__FILE__,"do_fork finds wrong child slot", next_child); + panic("do_fork finds wrong child slot: %d", next_child); if((s=vm_fork(rmp->mp_endpoint, next_child, &child_ep)) != OK) { printf("PM: vm_fork failed: %d\n", s); @@ -261,7 +261,7 @@ int dump_core; /* flag indicating whether to dump core */ /* Do accounting: fetch usage times and accumulate at parent. */ if((r=sys_times(proc_nr_e, &user_time, &sys_time, NULL, NULL)) != OK) - panic(__FILE__,"exit_proc: sys_times failed", r); + panic("exit_proc: sys_times failed: %d", r); p_mp = &mproc[rmp->mp_parent]; /* process' parent */ p_mp->mp_child_utime += user_time + rmp->mp_child_utime; /* add user time */ @@ -274,10 +274,10 @@ int dump_core; /* flag indicating whether to dump core */ * such as copying to/ from the exiting process, before it is gone. */ if ((r = sys_stop(proc_nr_e)) != OK) /* stop the process */ - panic(__FILE__, "sys_stop failed", r); + panic("sys_stop failed: %d", r); if((r=vm_willexit(proc_nr_e)) != OK) { - panic(__FILE__, "exit_proc: vm_willexit failed", r); + panic("exit_proc: vm_willexit failed: %d", r); } vm_notify_sig_wrapper(rmp->mp_endpoint); @@ -288,7 +288,7 @@ int dump_core; /* flag indicating whether to dump core */ } if (proc_nr_e == FS_PROC_NR) { - panic(__FILE__, "exit_proc: FS died", r); + panic("exit_proc: FS died: %d", r); } /* Tell FS about the exiting process. */ @@ -304,7 +304,7 @@ int dump_core; /* flag indicating whether to dump core */ * driver that FS is blocked waiting on. */ if((r= sys_exit(rmp->mp_endpoint)) != OK) - panic(__FILE__, "exit_proc: sys_exit failed", r); + panic("exit_proc: sys_exit failed: %d", r); } /* Clean up most of the flags describing the process's state before the exit, @@ -364,12 +364,12 @@ int dump_core; /* flag indicating whether to dump core */ { /* destroy the (user) process */ if((r=sys_exit(rmp->mp_endpoint)) != OK) - panic(__FILE__, "exit_restart: sys_exit failed", r); + panic("exit_restart: sys_exit failed: %d", r); } /* Release the memory occupied by the child. */ if((r=vm_exit(rmp->mp_endpoint)) != OK) { - panic(__FILE__, "exit_restart: vm_exit failed", r); + panic("exit_restart: vm_exit failed: %d", r); } if (rmp->mp_flags & TRACE_EXIT) @@ -508,7 +508,7 @@ struct mproc *rmp; struct mproc *t_mp; if (rmp->mp_flags & (TRACE_ZOMBIE | ZOMBIE)) - panic(__FILE__, "zombify: process was already a zombie", NO_NUM); + panic("zombify: process was already a zombie"); /* See if we have to notify a tracer process first. */ if (rmp->mp_tracer != NO_TRACER && rmp->mp_tracer != rmp->mp_parent) { @@ -579,11 +579,11 @@ register struct mproc *child; /* tells which process is exiting */ mp_parent= child->mp_parent; if (mp_parent <= 0) - panic(__FILE__, "tell_parent: bad value in mp_parent", mp_parent); + panic("tell_parent: bad value in mp_parent: %d", mp_parent); if(!(child->mp_flags & ZOMBIE)) - panic(__FILE__, "tell_parent: child not a zombie", NO_NUM); + panic("tell_parent: child not a zombie"); if(child->mp_flags & TOLD_PARENT) - panic(__FILE__, "tell_parent: telling parent again", NO_NUM); + panic("tell_parent: telling parent again"); parent = &mproc[mp_parent]; /* Wake up the parent by sending the reply message. */ @@ -606,9 +606,9 @@ struct mproc *child; /* tells which process is exiting */ mp_tracer = child->mp_tracer; if (mp_tracer <= 0) - panic(__FILE__, "tell_tracer: bad value in mp_tracer", mp_tracer); + panic("tell_tracer: bad value in mp_tracer: %d", mp_tracer); if(!(child->mp_flags & TRACE_ZOMBIE)) - panic(__FILE__, "tell_tracer: child not a zombie", NO_NUM); + panic("tell_tracer: child not a zombie"); tracer = &mproc[mp_tracer]; exitstatus = (child->mp_exitstatus << 8) | (child->mp_sigstatus & 0377); diff --git a/servers/pm/main.c b/servers/pm/main.c index 3a59900b0..a4fb748e6 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -229,15 +229,15 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) * reported, but it must be corrected for the kernel and system processes. */ if ((s=sys_getmonparams(monitor_params, sizeof(monitor_params))) != OK) - panic(__FILE__,"get monitor params failed",s); + panic("get monitor params failed: %d", s); if ((s=sys_getkinfo(&kinfo)) != OK) - panic(__FILE__,"get kernel info failed",s); + panic("get kernel info failed: %d", s); /* Initialize PM's process table. Request a copy of the system image table * that is defined at the kernel level to see which slots to fill in. */ if (OK != (s=sys_getimage(image))) - panic(__FILE__,"couldn't get image table: %d\n", s); + panic("couldn't get image table: %d", s); procs_in_use = 0; /* start populating table */ for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) { if (ip->proc_nr >= 0) { /* task have negative nrs */ @@ -285,7 +285,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) mess.PM_PID = rmp->mp_pid; mess.PM_PROC = rmp->mp_endpoint; if (OK != (s=send(FS_PROC_NR, &mess))) - panic(__FILE__,"can't sync up with FS", s); + panic("can't sync up with FS: %d", s); } } @@ -295,7 +295,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Tell FS that no more system processes follow and synchronize. */ mess.PR_ENDPT = NONE; if (sendrec(FS_PROC_NR, &mess) != OK || mess.m_type != OK) - panic(__FILE__,"can't sync up with FS", NO_NUM); + panic("can't sync up with FS"); #if (CHIP == INTEL) uts_val.machine[0] = 'i'; @@ -325,10 +325,10 @@ PRIVATE void get_work() { /* Wait for the next message and extract useful information from it. */ if (sef_receive(ANY, &m_in) != OK) - panic(__FILE__,"PM sef_receive error", NO_NUM); + panic("PM sef_receive error"); who_e = m_in.m_source; /* who sent the message */ if(pm_isokendpt(who_e, &who_p) != OK) - panic(__FILE__, "PM got message from invalid endpoint", who_e); + panic("PM got message from invalid endpoint: %d", who_e); call_nr = m_in.m_type; /* system call number */ /* Process slot of caller. Misuse PM's own process slot if the kernel is @@ -337,8 +337,7 @@ PRIVATE void get_work() */ mp = &mproc[who_p < 0 ? PM_PROC_NR : who_p]; if(who_p >= 0 && mp->mp_endpoint != who_e) { - panic(__FILE__, "PM endpoint number out of sync with source", - mp->mp_endpoint); + panic("PM endpoint number out of sync with source: %d", mp->mp_endpoint); } } @@ -356,7 +355,7 @@ int result; /* result of call (usually OK or error #) */ register struct mproc *rmp = &mproc[proc_nr]; if(proc_nr < 0 || proc_nr >= NR_PROCS) - panic(__FILE__,"setreply arg out of range", proc_nr); + panic("setreply arg out of range: %d", proc_nr); rmp->mp_reply.reply_res = result; rmp->mp_flags |= REPLY; /* reply pending */ @@ -395,7 +394,7 @@ void checkme(char *str, int line) boned=1; } } - if(boned) panic(__FILE__, "corrupt mp_endpoint?", NO_NUM); + if(boned) panic("corrupt mp_endpoint?"); } } @@ -430,19 +429,19 @@ PRIVATE void handle_fs_reply() proc_e = m_in.PM_PROC; if (pm_isokendpt(proc_e, &proc_n) != OK) { - panic(__FILE__, "handle_fs_reply: got bad endpoint from FS", proc_e); + panic("handle_fs_reply: got bad endpoint from FS: %d", proc_e); } rmp = &mproc[proc_n]; /* Now that FS replied, mark the process as FS-idle again */ if (!(rmp->mp_flags & FS_CALL)) - panic(__FILE__, "handle_fs_reply: reply without request", call_nr); + panic("handle_fs_reply: reply without request: %d", call_nr); rmp->mp_flags &= ~FS_CALL; if (rmp->mp_flags & UNPAUSED) - panic(__FILE__, "handle_fs_reply: UNPAUSED set on entry", call_nr); + panic("handle_fs_reply: UNPAUSED set on entry: %d", call_nr); /* Call-specific handler code */ switch (call_nr) { @@ -499,7 +498,7 @@ PRIVATE void handle_fs_reply() break; default: - panic(__FILE__, "handle_fs_reply: unknown reply code", call_nr); + panic("handle_fs_reply: unknown reply code: %d", call_nr); } /* Now that the process is idle again, look at pending signals */ diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 7394bb1c7..f4d3c6ca0 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -221,13 +221,13 @@ PUBLIC int ksig_pending() int r; /* get an arbitrary pending signal */ if((r=sys_getksig(&proc_nr_e, &sig_map)) != OK) - panic(__FILE__,"sys_getksig failed", r); + panic("sys_getksig failed: %d", r); if (NONE == proc_nr_e) { /* stop if no more pending signals */ break; } else { int proc_nr_p; if(pm_isokendpt(proc_nr_e, &proc_nr_p) != OK) - panic(__FILE__,"sys_getksig strange process", proc_nr_e); + panic("sys_getksig strange process: %d", proc_nr_e); handle_ksig(proc_nr_e, sig_map); /* handle the received signal */ /* If the process still exists to the kernel after the signal * has been handled ... @@ -235,7 +235,7 @@ PUBLIC int ksig_pending() if ((mproc[proc_nr_p].mp_flags & (IN_USE | EXITING)) == IN_USE) { if((r=sys_endksig(proc_nr_e)) != OK) /* ... tell kernel it's done */ - panic(__FILE__,"sys_endksig failed", r); + panic("sys_endksig failed: %d", r); } } } @@ -309,13 +309,13 @@ sigset_t sig_map; rmp->mp_flags &= ~DELAY_CALL; if (rmp->mp_flags & (FS_CALL | PM_SIG_PENDING)) - panic(__FILE__, "handle_ksig: bad process state", NO_NUM); + panic("handle_ksig: bad process state"); /* Process as many normal signals as possible. */ check_pending(rmp); if (rmp->mp_flags & DELAY_CALL) - panic(__FILE__, "handle_ksig: multiple delay calls?", NO_NUM); + panic("handle_ksig: multiple delay calls?"); } } @@ -357,7 +357,7 @@ int ksig; /* non-zero means signal comes from kernel */ slot = (int) (rmp - mproc); if ((rmp->mp_flags & (IN_USE | EXITING)) != IN_USE) { printf("PM: signal %d sent to exiting process %d\n", signo, slot); - panic(__FILE__,"", NO_NUM); + panic(""); } if (trace == TRUE && rmp->mp_tracer != NO_TRACER && signo != SIGKILL) { @@ -380,7 +380,7 @@ int ksig; /* non-zero means signal comes from kernel */ if (!(rmp->mp_flags & PM_SIG_PENDING)) { /* No delay calls: FS_CALL implies the process called us. */ if ((r = sys_stop(rmp->mp_endpoint)) != OK) - panic(__FILE__, "sys_stop failed", r); + panic("sys_stop failed: %d", r); rmp->mp_flags |= PM_SIG_PENDING; } @@ -585,7 +585,7 @@ struct mproc *rmp; rmp->mp_flags &= ~(PM_SIG_PENDING | UNPAUSED); if ((r = sys_resume(rmp->mp_endpoint)) != OK) - panic(__FILE__, "sys_resume failed", r); + panic("sys_resume failed: %d", r); } } } @@ -613,7 +613,7 @@ struct mproc *rmp; /* which process */ if (rmp->mp_flags & (PAUSED | WAITING | SIGSUSPENDED)) { /* Stop process from running. No delay calls: it called us. */ if ((r = sys_stop(rmp->mp_endpoint)) != OK) - panic(__FILE__, "sys_stop failed", r); + panic("sys_stop failed: %d", r); rmp->mp_flags |= UNPAUSED; @@ -635,7 +635,7 @@ struct mproc *rmp; /* which process */ return; } - else if (r != OK) panic(__FILE__, "sys_stop failed", r); + else if (r != OK) panic("sys_stop failed: %d", r); rmp->mp_flags |= PM_SIG_PENDING; } @@ -664,7 +664,7 @@ int signo; /* signal to send to process (1 to _NSIG-1) */ int r, sigflags, slot; if (!(rmp->mp_flags & UNPAUSED)) - panic(__FILE__, "sig_send: process not unpaused", NO_NUM); + panic("sig_send: process not unpaused"); sigflags = rmp->mp_sigact[signo].sa_flags; slot = (int) (rmp - mproc); @@ -698,7 +698,7 @@ int signo; /* signal to send to process (1 to _NSIG-1) */ /* Ask the kernel to deliver the signal */ r = sys_sigsend(rmp->mp_endpoint, &sigmsg); if (r != OK) - panic(__FILE__, "sys_sigsend failed", r); + panic("sys_sigsend failed: %d", r); /* Was the process suspended in PM? Then interrupt the blocking call. */ if (rmp->mp_flags & (PAUSED | WAITING | SIGSUSPENDED)) { @@ -712,7 +712,7 @@ int signo; /* signal to send to process (1 to _NSIG-1) */ rmp->mp_flags &= ~UNPAUSED; if ((r = sys_resume(rmp->mp_endpoint)) != OK) - panic(__FILE__, "sys_resume failed", r); + panic("sys_resume failed: %d", r); } return(TRUE); diff --git a/servers/pm/time.c b/servers/pm/time.c index ffbceb5ac..63a66289d 100644 --- a/servers/pm/time.c +++ b/servers/pm/time.c @@ -27,7 +27,7 @@ PUBLIC int do_time() int s; if ( (s=getuptime2(&uptime, &boottime)) != OK) - panic(__FILE__,"do_time couldn't get uptime", s); + panic("do_time couldn't get uptime: %d", s); mp->mp_reply.reply_time = (time_t) (boottime + (uptime/system_hz)); mp->mp_reply.reply_utime = (uptime%system_hz)*1000000/system_hz; @@ -49,12 +49,12 @@ PUBLIC int do_stime() return(EPERM); } if ( (s=getuptime(&uptime)) != OK) - panic(__FILE__,"do_stime couldn't get uptime", s); + panic("do_stime couldn't get uptime: %d", s); boottime = (long) m_in.stime - (uptime/system_hz); s= sys_stime(boottime); /* Tell kernel about boottime */ if (s != OK) - panic(__FILE__, "pm: sys_stime failed", s); + panic("pm: sys_stime failed: %d", s); return(OK); } @@ -70,7 +70,7 @@ PUBLIC int do_times() int s; if (OK != (s=sys_times(who_e, &user_time, &sys_time, &uptime, NULL))) - panic(__FILE__,"do_times couldn't get times", s); + panic("do_times couldn't get times: %d", s); rmp->mp_reply.reply_t1 = user_time; /* user time */ rmp->mp_reply.reply_t2 = sys_time; /* system time */ rmp->mp_reply.reply_t3 = rmp->mp_child_utime; /* child user time */ diff --git a/servers/pm/timers.c b/servers/pm/timers.c index 7cc20b349..df6d4addb 100644 --- a/servers/pm/timers.c +++ b/servers/pm/timers.c @@ -31,7 +31,7 @@ PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg) clock_t now, prev_time = 0, next_time; if ((r = getuptime(&now)) != OK) - panic(__FILE__, "PM couldn't get uptime", NO_NUM); + panic("PM couldn't get uptime"); /* Set timer argument and add timer to the list. */ tmr_arg(tp)->ta_int = arg; @@ -40,7 +40,7 @@ PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg) /* Reschedule our synchronous alarm if necessary. */ if (pm_expiring == 0 && (! prev_time || prev_time > next_time)) { if (sys_setalarm(next_time, 1) != OK) - panic(__FILE__, "PM set timer couldn't set alarm.", NO_NUM); + panic("PM set timer couldn't set alarm"); } return; @@ -64,7 +64,7 @@ PUBLIC void pm_expire_timers(clock_t now) /* Reschedule an alarm if necessary. */ if (next_time > 0) { if (sys_setalarm(next_time, 1) != OK) - panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM); + panic("PM expire timer couldn't set alarm"); } } @@ -82,6 +82,6 @@ PUBLIC void pm_cancel_timer(timer_t *tp) */ if (pm_expiring == 0 && (prev_time < next_time || ! next_time)) { if (sys_setalarm(next_time, 1) != OK) - panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM); + panic("PM expire timer couldn't set alarm"); } } diff --git a/servers/pm/trace.c b/servers/pm/trace.c index 2d916daff..fd1b91139 100644 --- a/servers/pm/trace.c +++ b/servers/pm/trace.c @@ -255,7 +255,7 @@ int signo; int r; r = sys_trace(T_STOP, rmp->mp_endpoint, 0L, (long *) 0); - if (r != OK) panic("pm", "sys_trace failed", r); + if (r != OK) panic("sys_trace failed: %d", r); rmp->mp_flags |= STOPPED; if (wait_test(rpmp, rmp)) { diff --git a/servers/pm/utility.c b/servers/pm/utility.c index c75bc0fa4..f3058b3f6 100644 --- a/servers/pm/utility.c +++ b/servers/pm/utility.c @@ -130,11 +130,11 @@ message *m_ptr; int r; if (rmp->mp_flags & FS_CALL) - panic(__FILE__, "tell_fs: not idle", m_ptr->m_type); + panic("tell_fs: not idle: %d", m_ptr->m_type); r = asynsend3(FS_PROC_NR, m_ptr, AMF_NOREPLY); if (r != OK) - panic(__FILE__, "unable to send to FS", r); + panic("unable to send to FS: %d", r); rmp->mp_flags |= FS_CALL; } diff --git a/servers/rs/main.c b/servers/rs/main.c index b61a03f20..d300f49b2 100644 --- a/servers/rs/main.c +++ b/servers/rs/main.c @@ -65,7 +65,7 @@ PUBLIC int main(void) who_e = m.m_source; who_p = _ENDPOINT_P(who_e); if(who_p < -NR_TASKS || who_p >= NR_PROCS) - panic("RS","message from bogus source", who_e); + panic("message from bogus source: %d", who_e); call_nr = m.m_type; @@ -176,7 +176,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) rinit.rproctab_gid = cpf_grant_direct(ANY, (vir_bytes) rprocpub, sizeof(rprocpub), CPF_READ); if(!GRANT_VALID(rinit.rproctab_gid)) { - panic("RS", "unable to create rprocpub table grant", rinit.rproctab_gid); + panic("unable to create rprocpub table grant: %d", rinit.rproctab_gid); } /* Initialize the global update descriptor. */ @@ -184,7 +184,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Get a copy of the boot image table. */ if ((s = sys_getimage(image)) != OK) { - panic("RS", "unable to get copy of boot image table", s); + panic("unable to get copy of boot image table: %d", s); } /* Determine the number of system services in the boot image table and @@ -210,7 +210,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) */ if(boot_image_sys->flags & SF_USE_COPY) { if((s = sys_getaoutheader(&header, i)) != OK) { - panic("RS", "unable to get copy of a.out header", s); + panic("unable to get copy of a.out header: %d", s); } boot_image_buffer_size += header.a_hdrlen + header.a_text + header.a_data; @@ -231,15 +231,14 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) nr_image_priv_srvs++; } if(nr_image_srvs != nr_image_priv_srvs) { - panic("RS", "boot image table and boot image priv table mismatch", - NO_NUM); + panic("boot image table and boot image priv table mismatch"); } /* Allocate boot image buffer. */ if(boot_image_buffer_size > 0) { boot_image_buffer = rs_startup_sbrk(boot_image_buffer_size); if(boot_image_buffer == (char *) -1) { - panic("RS", "unable to allocate boot image buffer", NO_NUM); + panic("unable to allocate boot image buffer"); } } @@ -304,13 +303,13 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Set the privilege structure. */ if ((s = sys_privctl(ip->endpoint, SYS_PRIV_SET_SYS, &(rp->r_priv))) != OK) { - panic("RS", "unable to set privilege structure", s); + panic("unable to set privilege structure: %d", s); } } /* Synch the privilege structure with the kernel. */ if ((s = sys_getpriv(&(rp->r_priv), ip->endpoint)) != OK) { - panic("RS", "unable to synch privilege structure", s); + panic("unable to synch privilege structure: %d", s); } /* @@ -379,7 +378,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Allow the service to run. */ if ((s = sys_privctl(rpub->endpoint, SYS_PRIV_ALLOW, NULL)) != OK) { - panic("RS", "unable to initialize privileges", s); + panic("unable to initialize privileges: %d", s); } /* Initialize service. We assume every service will always get @@ -387,7 +386,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) */ if(boot_image_priv->flags & SYS_PROC) { if ((s = init_service(rp, SEF_INIT_FRESH)) != OK) { - panic("RS", "unable to initialize service", s); + panic("unable to initialize service: %d", s); } if(rpub->sys_flags & SF_SYNCH_BOOT) { /* Catch init ready message now to synchronize. */ @@ -413,7 +412,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) * with other system processes. */ if ((s = getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc)) != OK) { - panic("RS", "unable to get copy of PM process table", s); + panic("unable to get copy of PM process table: %d", s); } for (i=0; boot_image_priv_table[i].endpoint != NULL_BOOT_NR; i++) { boot_image_priv = &boot_image_priv_table[i]; @@ -436,7 +435,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) } } if(j == NR_PROCS) { - panic("RS", "unable to get pid", NO_NUM); + panic("unable to get pid"); } } @@ -448,38 +447,38 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) if(boot_image_buffer_size > 0) { boot_image_buffer = rs_startup_sbrk_synch(boot_image_buffer_size); if(boot_image_buffer == (char *) -1) { - panic("RS", "unable to synch boot image buffer", NO_NUM); + panic("unable to synch boot image buffer"); } } /* Set alarm to periodically check service status. */ if (OK != (s=sys_setalarm(RS_DELTA_T, 0))) - panic("RS", "couldn't set alarm", s); + panic("couldn't set alarm: %d", s); /* Install signal handlers. Ask PM to transform signal into message. */ sa.sa_handler = SIG_MESS; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; - if (sigaction(SIGCHLD,&sa,NULL)<0) panic("RS","sigaction failed", errno); - if (sigaction(SIGTERM,&sa,NULL)<0) panic("RS","sigaction failed", errno); + if (sigaction(SIGCHLD,&sa,NULL)<0) panic("sigaction failed: %d", errno); + if (sigaction(SIGTERM,&sa,NULL)<0) panic("sigaction failed: %d", errno); /* Initialize the exec pipe. */ if (pipe(exec_pipe) == -1) - panic("RS", "pipe failed", errno); + panic("pipe failed: %d", errno); if (fcntl(exec_pipe[0], F_SETFD, fcntl(exec_pipe[0], F_GETFD) | FD_CLOEXEC) == -1) { - panic("RS", "fcntl set FD_CLOEXEC on pipe input failed", errno); + panic("fcntl set FD_CLOEXEC on pipe input failed: %d", errno); } if (fcntl(exec_pipe[1], F_SETFD, fcntl(exec_pipe[1], F_GETFD) | FD_CLOEXEC) == -1) { - panic("RS", "fcntl set FD_CLOEXEC on pipe output failed", errno); + panic("fcntl set FD_CLOEXEC on pipe output failed: %d", errno); } if (fcntl(exec_pipe[0], F_SETFL, fcntl(exec_pipe[0], F_GETFL) | O_NONBLOCK) == -1) { - panic("RS", "fcntl set O_NONBLOCK on pipe input failed", errno); + panic("fcntl set O_NONBLOCK on pipe input failed: %d", errno); } /* Map out our own text and data. This is normally done in crtso.o @@ -512,12 +511,11 @@ struct rproc *rp; if(boot_image_ptr == NULL) { boot_image_ptr = boot_image_buffer; } - s = NO_NUM; /* Get a.out header. */ if(boot_image_buffer+boot_image_buffer_size - boot_image_ptr < sizeof(header) || (s = sys_getaoutheader(&header, boot_proc_idx)) != OK) { - panic("RS", "unable to get copy of a.out header", s); + panic("unable to get copy of a.out header: %d", s); } memcpy(boot_image_ptr, &header, header.a_hdrlen); boot_image_ptr += header.a_hdrlen; @@ -526,7 +524,7 @@ struct rproc *rp; if(boot_image_buffer+boot_image_buffer_size - boot_image_ptr < header.a_text || (s = rs_startup_segcopy(ip->endpoint, T, D, (vir_bytes) boot_image_ptr, header.a_text)) != OK) { - panic("RS", "unable to get copy of text segment", s); + panic("unable to get copy of text segment: %d", s); } boot_image_ptr += header.a_text; @@ -534,7 +532,7 @@ struct rproc *rp; if(boot_image_buffer+boot_image_buffer_size - boot_image_ptr < header.a_data || (s = rs_startup_segcopy(ip->endpoint, D, D, (vir_bytes) boot_image_ptr, header.a_data)) != OK) { - panic("RS", "unable to get copy of data segment", s); + panic("unable to get copy of data segment: %d", s); } boot_image_ptr += header.a_data; @@ -568,7 +566,7 @@ struct boot_image_dev **dp; } } if(i == NR_BOOT_PROCS) { - panic("RS", "boot image table lookup failed", NO_NUM); + panic("boot image table lookup failed"); } } @@ -583,7 +581,7 @@ struct boot_image_dev **dp; } } if(i == NULL_BOOT_NR) { - panic("RS", "boot image priv table lookup failed", NO_NUM); + panic("boot image priv table lookup failed"); } } @@ -632,17 +630,17 @@ endpoint_t endpoint; /* Receive init ready message. */ if ((r = receive(endpoint, &m)) != OK) { - panic("RS", "unable to receive init reply", r); + panic("unable to receive init reply: %d", r); } if(m.m_type != RS_INIT) { - panic("RS", "unexpected reply from service", m.m_source); + panic("unexpected reply from service: %d", m.m_source); } result = m.RS_INIT_RESULT; rp = rproc_ptr[_ENDPOINT_P(m.m_source)]; /* Check result. */ if(result != OK) { - panic("RS", "unable to complete init for service", m.m_source); + panic("unable to complete init for service: %d", m.m_source); } /* Mark the slot as no longer initializing. */ @@ -675,7 +673,7 @@ message *m_in; /* pointer to message */ { int s; /* receive status */ if (OK != (s=sef_receive(ANY, m_in))) /* wait for message */ - panic("RS", "sef_receive failed", s); + panic("sef_receive failed: %d", s); } /*===========================================================================* diff --git a/servers/rs/manager.c b/servers/rs/manager.c index 6a318157f..01a4f256c 100644 --- a/servers/rs/manager.c +++ b/servers/rs/manager.c @@ -914,14 +914,12 @@ PUBLIC void do_exit(message *m_ptr) } if (r != sizeof(slot_nr)) { - panic("RS", "do_exit: unaligned read from exec pipe", - r); + panic("do_exit: unaligned read from exec pipe: %d", r); } printf("do_exit: got slot %d\n", slot_nr); if (slot_nr < 0 || slot_nr >= NR_SYS_PROCS) { - panic("RS", "do_exit: bad slot number from exec pipe", - slot_nr); + panic("do_exit: bad slot number from exec pipe: %d", slot_nr); } rp= &rproc[slot_nr]; rp->r_flags |= RS_EXITING; @@ -1112,7 +1110,7 @@ message *m_ptr; /* Reschedule a synchronous alarm for the next period. */ if (OK != (s=sys_setalarm(RS_DELTA_T, 0))) - panic("RS", "couldn't set alarm", s); + panic("couldn't set alarm: %d", s); } @@ -1159,7 +1157,7 @@ endpoint_t *endpoint; switch(child_pid) { /* see fork(2) */ case -1: /* fork failed */ - report("RS", "warning, fork() failed", errno); /* shouldn't happen */ + printf("RS: warning, fork() failed: %d\n", errno); /* shouldn't happen */ return(errno); /* return error */ case 0: /* child process */ @@ -1228,7 +1226,7 @@ endpoint_t *endpoint; s = dev_execve(child_proc_nr_e, rp->r_exec, rp->r_exec_len, rp->r_argv, environ); if (s != OK) { - report("RS", "dev_execve call failed", s); + printf("RS: dev_execve call failed: %d\n", s); kill(child_pid, SIGKILL); rp->r_flags |= RS_EXITING; /* don't try again */ return(s); @@ -1244,7 +1242,7 @@ endpoint_t *endpoint; /* Tell VM about allowed calls. */ vm_mask = &rpub->vm_call_mask[0]; if ((s = vm_set_priv(child_proc_nr_e, vm_mask)) < 0) { - report("RS", "vm_set_priv call failed", s); + printf("RS: vm_set_priv call failed: %d\n", s); kill(child_pid, SIGKILL); rp->r_flags |= RS_EXITING; return (s); @@ -1254,7 +1252,7 @@ endpoint_t *endpoint; /* Set and synch the privilege structure for the new service. */ if ((s = sys_privctl(child_proc_nr_e, SYS_PRIV_SET_SYS, &rp->r_priv)) != OK || (s = sys_getpriv(&rp->r_priv, child_proc_nr_e)) != OK) { - report("RS","unable to set privileges", s); + printf("RS: unable to set privileges: %d\n", s); kill(child_pid, SIGKILL); /* kill the service */ rp->r_flags |= RS_EXITING; /* expect exit */ return(s); /* return error */ @@ -1279,7 +1277,7 @@ endpoint_t *endpoint; * publishing is made fully asynchronous in RS. */ if ((s = sys_privctl(child_proc_nr_e, SYS_PRIV_ALLOW, NULL)) != OK) { - report("RS","unable to allow the service to run", s); + printf("RS: unable to allow the service to run: %d\n", s); kill(child_pid, SIGKILL); /* kill the service */ rp->r_flags |= RS_EXITING; /* expect exit */ return(s); /* return error */ @@ -1288,7 +1286,7 @@ endpoint_t *endpoint; /* Initialize service. */ init_type = rp->r_restarts > 0 ? SEF_INIT_RESTART : SEF_INIT_FRESH; if((s = init_service(rp, init_type)) != OK) { - panic("RS", "unable to initialize service", s); + panic("unable to initialize service: %d", s); } /* The purpose of non-blocking forks is to avoid involving VFS in the forking @@ -1308,7 +1306,7 @@ endpoint_t *endpoint; if (rpub->dev_nr > 0) { /* set driver map */ if ((s=mapdriver(rpub->label, rpub->dev_nr, rpub->dev_style, !!use_copy /* force */)) < 0) { - report("RS", "couldn't map driver (continuing)", errno); + printf("RS: couldn't map driver (continuing): %d\n", errno); } } diff --git a/servers/vfs/device.c b/servers/vfs/device.c index ddf980e96..93ecb27ff 100644 --- a/servers/vfs/device.c +++ b/servers/vfs/device.c @@ -90,7 +90,7 @@ int flags; /* mode bits and flags */ dp = &dmap[major]; if (dp->dmap_driver == NONE) return(ENXIO); r = (*dp->dmap_opcl)(DEV_REOPEN, dev, filp_no, flags); - if (r == OK) panic(__FILE__,"OK on reopen from", dp->dmap_driver); + if (r == OK) panic("OK on reopen from: %d", dp->dmap_driver); if (r == SUSPEND) r = OK; return(r); } @@ -158,7 +158,7 @@ PUBLIC void dev_status(message *m) if ((r = sendrec(m->m_source, &st)) != OK) { printf("DEV_STATUS failed to %d: %d\n", m->m_source, r); if (r == EDEADSRCDST) return; - panic(__FILE__,"couldn't sendrec for DEV_STATUS", r); + panic("couldn't sendrec for DEV_STATUS: %d", r); } switch(st.m_type) { @@ -229,7 +229,7 @@ u32_t *pos_lo; *gid = cpf_grant_magic(driver, *io_ept, (vir_bytes) *buf, bytes, *op == DEV_READ_S ? CPF_WRITE : CPF_READ); if (*gid < 0) - panic(__FILE__, "cpf_grant_magic of buffer failed\n", NO_NUM); + panic("cpf_grant_magic of buffer failed"); break; case VFS_DEV_GATHER: case VFS_DEV_SCATTER: @@ -240,12 +240,12 @@ u32_t *pos_lo; *gid = cpf_grant_direct(driver, (vir_bytes) new_iovec, bytes * sizeof(iovec_t), CPF_READ|CPF_WRITE); if (*gid < 0) - panic(__FILE__, "cpf_grant_direct of vector failed", NO_NUM); + panic("cpf_grant_direct of vector failed"); v = (iovec_t *) *buf; /* Grant access to i/o buffers. */ for(j = 0; j < bytes; j++) { - if(j >= NR_IOREQS) panic(__FILE__, "vec too big", bytes); + if(j >= NR_IOREQS) panic("vec too big: %d", bytes); new_iovec[j].iov_addr = gids[j] = @@ -253,7 +253,7 @@ u32_t *pos_lo; *op == DEV_GATHER_S ? CPF_WRITE : CPF_READ); if(!GRANT_VALID(gids[j])) - panic(__FILE__, "grant to iovec buf failed", NO_NUM); + panic("grant to iovec buf failed"); new_iovec[j].iov_size = v[j].iov_size; (*vec_grants)++; @@ -279,14 +279,14 @@ u32_t *pos_lo; *gid = cpf_grant_magic(driver, *io_ept, (vir_bytes) *buf, size, access); if (*gid < 0) - panic(__FILE__, "cpf_grant_magic failed (ioctl)\n", NO_NUM); + panic("cpf_grant_magic failed (ioctl)"); break; case VFS_DEV_SELECT: *op = DEV_SELECT; break; default: - panic(__FILE__,"safe_io_conversion: unknown operation", *op); + panic("safe_io_conversion: unknown operation: %d", *op); } /* If we have converted to a safe operation, I/O @@ -380,7 +380,7 @@ int suspend_reopen; /* Just suspend the process */ &vec_grants, bytes, &pos_lo); if(buf != buf_used) - panic(__FILE__,"dev_io: safe_io_conversion changed buffer", NO_NUM); + panic("dev_io: safe_io_conversion changed buffer"); /* If the safe conversion was done, set the ADDRESS to * the grant id. @@ -409,10 +409,10 @@ int suspend_reopen; /* Just suspend the process */ /* Task has completed. See if call completed. */ if (dev_mess.REP_STATUS == SUSPEND) { - if(vec_grants > 0) panic(__FILE__,"SUSPEND on vectored i/o", NO_NUM); + if(vec_grants > 0) panic("SUSPEND on vectored i/o"); /* fp is uninitialized at init time. */ - if(!fp) panic(__FILE__,"SUSPEND on NULL fp", NO_NUM); + if(!fp) panic("SUSPEND on NULL fp"); if ((flags & O_NONBLOCK) && !dp->dmap_async_driver) { /* Not supposed to block. */ @@ -626,7 +626,7 @@ message *mess_ptr; /* pointer to message for task */ printf("fs: ELOCKED talking to %d\n", task_nr); return(r); } - panic(__FILE__,"call_task: can't send/receive", r); + panic("call_task: can't send/receive: %d", r); } /* Did the process we did the sendrec() for get a result? */ @@ -655,7 +655,7 @@ message *mess_ptr; /* pointer to message for task */ int r; r = asynsend(task_nr, mess_ptr); - if (r != OK) panic(__FILE__, "asyn_io: asynsend failed", r); + if (r != OK) panic("asyn_io: asynsend failed: %d", r); /* Fake a SUSPEND */ mess_ptr->REP_STATUS = SUSPEND; @@ -868,7 +868,7 @@ PUBLIC void dev_up(int maj) fd_nr = (rfp->fp_fd >> 8); fp = rfp->fp_filp[fd_nr]; vp = fp->filp_vno; - if (!vp) panic(__FILE__, "restart_reopen: no vp", NO_NUM); + if (!vp) panic("restart_reopen: no vp"); if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) continue; if (((vp->v_sdev >> MAJOR) & BYTE) != maj) continue; @@ -971,7 +971,7 @@ int maj; } vp = fp->filp_vno; - if (!vp) panic(__FILE__, "restart_reopen: no vp", NO_NUM); + if (!vp) panic("restart_reopen: no vp"); if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) continue; if (((vp->v_sdev >> MAJOR) & BYTE) != maj) continue; @@ -1089,7 +1089,7 @@ message *mp; /* Tell the kernel to stop processing */ r= senda(NULL, 0); if (r != OK) - panic(__FILE__, "asynsend: senda failed", r); + panic("asynsend: senda failed: %d", r); dst_ind= 0; for (src_ind= first_slot; src_ind= ASYN_NR) - panic(__FILE__, "asynsend: msgtable full", NO_NUM); + panic("asynsend: msgtable full"); } msgtable[next_slot].dst= dst; diff --git a/servers/vfs/dmap.c b/servers/vfs/dmap.c index 645f8197e..120e624c3 100644 --- a/servers/vfs/dmap.c +++ b/servers/vfs/dmap.c @@ -180,7 +180,7 @@ int force; if (label != NULL) { len= strlen(label); if (len+1 > sizeof(dp->dmap_label)) - panic(__FILE__, "map_driver: label too long", len); + panic("map_driver: label too long: %d", len); strcpy(dp->dmap_label, label); } diff --git a/servers/vfs/fs.h b/servers/vfs/fs.h index 9bd2058ac..13695de2d 100644 --- a/servers/vfs/fs.h +++ b/servers/vfs/fs.h @@ -12,7 +12,7 @@ if(!check_vrefs() || !check_pipe()) { \ printf("VFS:%s:%d: call_nr %d who_e %d\n", \ __FILE__, __LINE__, call_nr, who_e); \ - panic(__FILE__, "sanity check failed", NO_NUM); \ + panic("sanity check failed"); \ } \ } while(0) #else diff --git a/servers/vfs/fscall.c b/servers/vfs/fscall.c index 9550585a7..9ba3fe7ec 100644 --- a/servers/vfs/fscall.c +++ b/servers/vfs/fscall.c @@ -76,7 +76,7 @@ PRIVATE void pop_globals() */ if (depth == 0) - panic("VFS", "Popping from empty globals stack!", NO_NUM); + panic("Popping from empty globals stack!"); depth--; diff --git a/servers/vfs/lock.c b/servers/vfs/lock.c index 56da0b004..1ce265863 100644 --- a/servers/vfs/lock.c +++ b/servers/vfs/lock.c @@ -52,7 +52,7 @@ int req; /* either F_SETLK or F_SETLKW */ case SEEK_SET: first = 0; break; case SEEK_CUR: if (ex64hi(f->filp_pos) != 0) - panic(__FILE__, "lock_op: position in file too high", NO_NUM); + panic("lock_op: position in file too high"); first = ex64lo(f->filp_pos); break; case SEEK_END: first = f->filp_vno->v_size; break; diff --git a/servers/vfs/main.c b/servers/vfs/main.c index c984c2c4a..0a47eb88a 100644 --- a/servers/vfs/main.c +++ b/servers/vfs/main.c @@ -141,7 +141,7 @@ PUBLIC int main(void) if(fp_is_blocked(fp)) { printf("VFS: requester %d call %d: suspended\n", who_e, call_nr); - panic(__FILE__, "requester suspended", NO_NUM); + panic("requester suspended"); } #endif @@ -229,10 +229,10 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) */ do { if (OK != (s=sef_receive(PM_PROC_NR, &mess))) - panic(__FILE__,"FS couldn't receive from PM", s); + panic("FS couldn't receive from PM: %d", s); if (mess.m_type != PM_INIT) - panic(__FILE__, "unexpected message from PM", mess.m_type); + panic("unexpected message from PM: %d", mess.m_type); if (NONE == mess.PM_PROC) break; @@ -256,7 +256,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) * Certain relations must hold for the file system to work at all. Some * extra block_size requirements are checked at super-block-read-in time. */ - if (OPEN_MAX > 127) panic(__FILE__,"OPEN_MAX > 127", NO_NUM); + if (OPEN_MAX > 127) panic("OPEN_MAX > 127"); /* The following initializations are needed to let dev_opcl succeed .*/ fp = (struct fproc *) NULL; @@ -269,7 +269,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) vmp = &vmnt[0]; /* Should be the root filesystem */ if (vmp->m_dev == NO_DEV) - panic(__FILE__, "vfs: no root filesystem", NO_NUM); + panic("vfs: no root filesystem"); root_vp= vmp->m_root_node; /* The root device can now be accessed; set process directories. */ @@ -349,14 +349,14 @@ PRIVATE void get_work() return; } if (!found_one) - panic(__FILE__,"get_work couldn't revive anyone", NO_NUM); + panic("get_work couldn't revive anyone"); } for(;;) { int r; /* Normal case. No one to revive. */ if ((r=sef_receive(ANY, &m_in)) != OK) - panic(__FILE__,"fs sef_receive error", r); + panic("fs sef_receive error: %d", r); who_e = m_in.m_source; who_p = _ENDPOINT_P(who_e); @@ -365,7 +365,7 @@ PRIVATE void get_work() * (kernel tasks) are treated in a special way */ if(who_p >= (int)(sizeof(fproc) / sizeof(struct fproc))) - panic(__FILE__,"receive process out of range", who_p); + panic("receive process out of range: %d", who_p); if(who_p >= 0 && fproc[who_p].fp_endpoint == NONE) { printf("FS: ignoring request from %d, endpointless slot %d (%d)\n", m_in.m_source, who_p, m_in.m_type); @@ -378,7 +378,7 @@ PRIVATE void get_work() printf("FS: receive endpoint inconsistent (source %d, who_p %d, stored ep %d, who_e %d).\n", m_in.m_source, who_p, fproc[who_p].fp_endpoint, who_e); #if 0 - panic(__FILE__, "FS: inconsistent endpoint ", NO_NUM); + panic("FS: inconsistent endpoint "); #endif continue; } @@ -432,12 +432,12 @@ PRIVATE void init_root() if (sef_receive(ROOT_FS_E, &m) != OK) { printf("VFS: Error receiving login request from FS_e %d\n", ROOT_FS_E); - panic(__FILE__, "Error receiving login request from root filesystem\n", ROOT_FS_E); + panic("Error receiving login request from root filesystem: %d", ROOT_FS_E); } if (m.m_type != FS_READY) { printf("VFS: Invalid login request from FS_e %d\n", ROOT_FS_E); - panic(__FILE__, "Error receiving login request from root filesystem\n", ROOT_FS_E); + panic("Error receiving login request from root filesystem: %d", ROOT_FS_E); } } last_login_fs_e = NONE; @@ -450,26 +450,26 @@ PRIVATE void init_root() /* We'll need a vnode for the root inode, check whether there is one */ if ((root_node = get_free_vnode()) == NIL_VNODE) - panic(__FILE__,"Cannot get free vnode", r); + panic("Cannot get free vnode: %d", r); /* Get driver process' endpoint */ dp = &dmap[(root_dev >> MAJOR) & BYTE]; if (dp->dmap_driver == NONE) { - panic(__FILE__,"No driver for root device", r); + panic("No driver for root device: %d", r); } label= dp->dmap_label; if (strlen(label) == 0) { - panic(__FILE__, "vfs:init_root: no label for major", root_dev >> MAJOR); + panic("vfs:init_root: no label for major: %d", root_dev >> MAJOR); } /* Issue request */ r = req_readsuper(ROOT_FS_E, label, root_dev, 0 /*!readonly*/, 1 /*isroot*/, &res); if (r != OK) { - panic(__FILE__,"Cannot read superblock from root", r); + panic("Cannot read superblock from root: %d", r); } /* Fill in root node's fields */ @@ -599,7 +599,7 @@ PRIVATE void service_pm() r = send(PM_PROC_NR, &m_out); if (r != OK) - panic(__FILE__, "service_pm: send failed", r); + panic("service_pm: send failed: %d", r); } diff --git a/servers/vfs/misc.c b/servers/vfs/misc.c index 529610ae4..2e33d7baf 100644 --- a/servers/vfs/misc.c +++ b/servers/vfs/misc.c @@ -223,9 +223,7 @@ PUBLIC int do_fcntl() case SEEK_SET: start = 0; break; case SEEK_CUR: if (ex64hi(f->filp_pos) != 0) - panic(__FILE__, "do_fcntl: position in file too high", - NO_NUM); - + panic("do_fcntl: position in file too high"); start = ex64lo(f->filp_pos); break; case SEEK_END: start = f->filp_vno->v_size; break; @@ -366,9 +364,9 @@ int cpid; /* Child process id */ */ childno = _ENDPOINT_P(cproc); if(childno < 0 || childno >= NR_PROCS) - panic(__FILE__, "FS: bogus child for forking", m_in.child_endpt); + panic("FS: bogus child for forking: %d", m_in.child_endpt); if(fproc[childno].fp_pid != PID_FREE) - panic(__FILE__, "FS: forking on top of in-use child", childno); + panic("FS: forking on top of in-use child: %d", childno); /* Copy the parent's fproc struct to the child. */ fproc[childno] = fproc[parentno]; @@ -389,11 +387,11 @@ int cpid; /* Child process id */ */ if(GRANT_VALID(fp->fp_grant)) { printf("vfs: fork: fp (endpoint %d) has grant %d\n", fp->fp_endpoint, fp->fp_grant); - panic(__FILE__, "fp contains valid grant", NO_NUM); + panic("fp contains valid grant"); } if(GRANT_VALID(cp->fp_grant)) { printf("vfs: fork: cp (endpoint %d) has grant %d\n", cp->fp_endpoint, cp->fp_grant); - panic(__FILE__, "cp contains valid grant", NO_NUM); + panic("cp contains valid grant"); } /* A child is not a process leader. */ @@ -423,7 +421,7 @@ PRIVATE void free_proc(struct fproc *exiter, int flags) fp = exiter; /* get_filp() needs 'fp' */ if(fp->fp_endpoint == NONE) { - panic(__FILE__, "free_proc: already free", NO_NUM); + panic("free_proc: already free"); } if (fp_is_blocked(fp)) { @@ -540,12 +538,12 @@ gid_t *groups; okendpt(proc_e, &slot); rfp = &fproc[slot]; if (ngroups * sizeof(gid_t) > sizeof(rfp->fp_sgroups)) - panic(__FILE__, "VFS: pm_setgroups: too much data to copy\n", NO_NUM); + panic("VFS: pm_setgroups: too much data to copy"); if(sys_datacopy(who_e, (vir_bytes) groups, SELF, (vir_bytes) rfp->fp_sgroups, ngroups * sizeof(gid_t)) == OK) { rfp->fp_ngroups = ngroups; } else - panic(__FILE__, "VFS: pm_setgroups: datacopy failed\n", NO_NUM); + panic("VFS: pm_setgroups: datacopy failed"); } diff --git a/servers/vfs/mount.c b/servers/vfs/mount.c index da8627899..eb2434c1b 100644 --- a/servers/vfs/mount.c +++ b/servers/vfs/mount.c @@ -279,8 +279,7 @@ PRIVATE int mount_fs(endpoint_t fs_e) label = dp->dmap_label; if (strlen(label) == 0) - panic(__FILE__, "VFS mount_fs: no label for major", - dev >> MAJOR); + panic("VFS mount_fs: no label for major: 0x%x", dev >> MAJOR); } /* Tell FS which device to mount */ @@ -415,7 +414,7 @@ char *label; /* buffer to retrieve label, or NULL */ /* Find vmnt that is to be unmounted */ for(vmp_i = &vmnt[0]; vmp_i < &vmnt[NR_MNTS]; ++vmp_i) { if (vmp_i->m_dev == dev) { - if(vmp) panic(__FILE__,"device mounted more than once", dev); + if(vmp) panic("device mounted more than once: %d", dev); vmp = vmp_i; } } @@ -441,7 +440,7 @@ char *label; /* buffer to retrieve label, or NULL */ /* Tell FS to unmount */ if(vmp->m_fs_e <= 0 || vmp->m_fs_e == NONE) - panic(__FILE__, "unmount: strange fs endpoint", vmp->m_fs_e); + panic("unmount: strange fs endpoint: %d", vmp->m_fs_e); if ((r = req_unmount(vmp->m_fs_e)) != OK) /* Not recoverable. */ printf("VFS: ignoring failed umount attempt (%d)\n", r); diff --git a/servers/vfs/path.c b/servers/vfs/path.c index 3c36ad1e8..d6a1f5580 100644 --- a/servers/vfs/path.c +++ b/servers/vfs/path.c @@ -69,7 +69,7 @@ int flags; new_vp->v_sdev = res.dev; if( (vmp = find_vmnt(new_vp->v_fs_e)) == NIL_VMNT) - panic(__FILE__, "VFS advance: vmnt not found", NO_NUM); + panic("VFS advance: vmnt not found"); new_vp->v_vmnt = vmp; new_vp->v_dev = vmp->m_dev; @@ -248,17 +248,14 @@ node_details_t *node; } if (!dir_vp) { - panic(__FILE__, - "VFS lookup: can't find mounted partition", - NO_NUM); + panic("VFS lookup: can't find mounted partition"); } } else { /* Climbing up mount */ /* Find the vmnt that represents the partition on * which we "climb up". */ if ((vmp = find_vmnt(res.fs_e)) == NIL_VMNT) { - panic(__FILE__, - "VFS lookup: can't find parent vmnt",NO_NUM); + panic("VFS lookup: can't find parent vmnt"); } /* Make sure that the child FS does not feed a bogus path diff --git a/servers/vfs/pipe.c b/servers/vfs/pipe.c index fc52a90e2..1a1521976 100644 --- a/servers/vfs/pipe.c +++ b/servers/vfs/pipe.c @@ -157,7 +157,7 @@ int notouch; /* check only */ int r = OK; if (ex64hi(position) != 0) - panic(__FILE__, "pipe_check: position too large in pipe", NO_NUM); + panic("pipe_check: position too large in pipe"); pos = ex64lo(position); /* If reading, check for empty pipe. */ @@ -252,13 +252,13 @@ PUBLIC void suspend(int why) #if DO_SANITYCHECKS if (why == FP_BLOCKED_ON_PIPE) - panic(__FILE__, "suspend: called for FP_BLOCKED_ON_PIPE", NO_NUM); + panic("suspend: called for FP_BLOCKED_ON_PIPE"); if(fp_is_blocked(fp)) - panic(__FILE__, "suspend: called for suspended process", NO_NUM); + panic("suspend: called for suspended process"); if(why == FP_BLOCKED_ON_NONE) - panic(__FILE__, "suspend: called for FP_BLOCKED_ON_NONE", NO_NUM); + panic("suspend: called for FP_BLOCKED_ON_NONE"); #endif if (why == FP_BLOCKED_ON_POPEN) @@ -287,7 +287,7 @@ PUBLIC void suspend(int why) PUBLIC void wait_for(endpoint_t who) { if(who == NONE || who == ANY) - panic(__FILE__,"suspend on NONE or ANY",NO_NUM); + panic("suspend on NONE or ANY"); suspend(FP_BLOCKED_ON_OTHER); fp->fp_task = who; } @@ -310,7 +310,7 @@ size_t size; */ #if DO_SANITYCHECKS if(fp_is_blocked(fp)) - panic(__FILE__, "pipe_suspend: called for suspended process", NO_NUM); + panic("pipe_suspend: called for suspended process"); #endif susp_count++; /* #procs susp'ed on pipe*/ @@ -389,7 +389,7 @@ int count; /* max number of processes to release */ revive(rp->fp_endpoint, 0); susp_count--; /* keep track of who is suspended */ if(susp_count < 0) - panic("vfs", "susp_count now negative", susp_count); + panic("susp_count now negative: %d", susp_count); if (--count == 0) return; } } @@ -434,7 +434,7 @@ int returned; /* if hanging on task, how many bytes read */ rfp->fp_filp[fd_nr] = NIL_FILP; FD_CLR(fd_nr, &rfp->fp_filp_inuse); if (fil_ptr->filp_count != 1) { - panic(__FILE__, "revive: bad count in filp", + panic("revive: bad count in filp: %d", fil_ptr->filp_count); } fil_ptr->filp_count = 0; @@ -460,7 +460,7 @@ int returned; /* if hanging on task, how many bytes read */ */ if(GRANT_VALID(rfp->fp_grant)) { if(cpf_revoke(rfp->fp_grant)) { - panic(__FILE__,"FS: revoke failed for grant", + panic("FS: revoke failed for grant: %d", rfp->fp_grant); } rfp->fp_grant = GRANT_INVALID; @@ -533,7 +533,7 @@ int proc_nr_e; fild = (rfp->fp_fd >> 8) & BYTE;/* extract file descriptor */ if (fild < 0 || fild >= OPEN_MAX) - panic(__FILE__,"unpause err 2",NO_NUM); + panic("unpause err 2"); f = rfp->fp_filp[fild]; dev = (dev_t) f->filp_vno->v_sdev; /* device hung on */ mess.TTY_LINE = (dev >> MINOR) & BYTE; @@ -554,14 +554,14 @@ int proc_nr_e; if(status == EAGAIN) status = EINTR; if(GRANT_VALID(rfp->fp_grant)) { if(cpf_revoke(rfp->fp_grant)) { - panic(__FILE__,"FS: revoke failed for grant (cancel)", + panic("FS: revoke failed for grant (cancel): %d", rfp->fp_grant); } rfp->fp_grant = GRANT_INVALID; } break; default : - panic(__FILE__,"FS: unknown value", blocked_on); + panic("FS: unknown value: %d", blocked_on); } rfp->fp_blocked_on = FP_BLOCKED_ON_NONE; diff --git a/servers/vfs/proto.h b/servers/vfs/proto.h index 2145379b0..9983ba149 100644 --- a/servers/vfs/proto.h +++ b/servers/vfs/proto.h @@ -230,7 +230,6 @@ _PROTOTYPE( long conv4, (int norm, long x) ); _PROTOTYPE( int fetch_name, (char *path, int len, int flag) ); _PROTOTYPE( int no_sys, (void) ); _PROTOTYPE( int isokendpt_f, (char *f, int l, int e, int *p, int ft)); -_PROTOTYPE( void panic, (char *who, char *mess, int num) ); #define okendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 1) #define isokendpt(e, p) isokendpt_f(__FILE__, __LINE__, (e), (p), 0) diff --git a/servers/vfs/read.c b/servers/vfs/read.c index 8ced3201c..fb82dcd62 100644 --- a/servers/vfs/read.c +++ b/servers/vfs/read.c @@ -69,8 +69,7 @@ int rw_flag; /* READING or WRITING */ if (vp->v_pipe == I_PIPE) { if (fp->fp_cum_io_partial != 0) { - panic(__FILE__, "read_write: fp_cum_io_partial not clear", - NO_NUM); + panic("read_write: fp_cum_io_partial not clear"); } return rw_pipe(rw_flag, who_e, m_in.fd, f, m_in.buffer, m_in.nbytes); } @@ -81,15 +80,12 @@ int rw_flag; /* READING or WRITING */ if ((char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0))) { if (vp->v_sdev == NO_DEV) - panic(__FILE__, "read_write tries to read from " - "character device NO_DEV", NO_NUM); - + panic("read_write tries to read from character device NO_DEV"); } if ((block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0))) { if (vp->v_sdev == NO_DEV) - panic(__FILE__, "read_write tries to read from " - " block device NO_DEV", NO_NUM); + panic("read_write tries to read from block device NO_DEV"); } if (char_spec) { /* Character special files. */ @@ -123,7 +119,7 @@ int rw_flag; /* READING or WRITING */ if (r >= 0) { if (ex64hi(new_pos)) - panic(__FILE__, "read_write: bad new pos", NO_NUM); + panic("read_write: bad new pos"); position = new_pos; cum_io += cum_io_incr; @@ -135,8 +131,7 @@ int rw_flag; /* READING or WRITING */ if (regular || mode_word == I_DIRECTORY) { if (cmp64ul(position, vp->v_size) > 0) { if (ex64hi(position) != 0) { - panic(__FILE__, - "read_write: file size too big ", NO_NUM); + panic("read_write: file size too big "); } vp->v_size = ex64lo(position); } @@ -172,7 +167,7 @@ PUBLIC int do_getdents() return(EBADF); if (ex64hi(rfilp->filp_pos) != 0) - panic(__FILE__, "do_getdents: should handle large offsets", NO_NUM); + panic("do_getdents: should handle large offsets"); r = req_getdents(rfilp->filp_vno->v_fs_e, rfilp->filp_vno->v_inode_nr, rfilp->filp_pos, m_in.buffer, m_in.nbytes, &new_pos); @@ -229,14 +224,14 @@ size_t req_size; } if (vp->v_mapfs_e == 0) - panic(__FILE__, "unmapped pipe", NO_NUM); + panic("unmapped pipe"); r = req_readwrite(vp->v_mapfs_e, vp->v_mapinode_nr, position, rw_flag, usr_e, buf, size, &new_pos, &cum_io_incr); if (r >= 0) { if (ex64hi(new_pos)) - panic(__FILE__, "rw_pipe: bad new pos", NO_NUM); + panic("rw_pipe: bad new pos"); position = new_pos; cum_io += cum_io_incr; @@ -248,9 +243,7 @@ size_t req_size; if (rw_flag == WRITING) { if (cmp64ul(position, vp->v_size) > 0) { if (ex64hi(position) != 0) { - panic(__FILE__, - "read_write: file size too big for v_size", - NO_NUM); + panic("read_write: file size too big for v_size"); } vp->v_size = ex64lo(position); } diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 88a01954f..ef5f4aeab 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -53,7 +53,7 @@ unsigned int *cum_iop; grant_id = cpf_grant_magic(fs_e, user_e, (vir_bytes) user_addr, num_of_bytes, (rw_flag == READING ? CPF_WRITE : CPF_READ)); if(grant_id == -1) - panic(__FILE__, "req_breadwrite: cpf_grant_magic failed", NO_NUM); + panic("req_breadwrite: cpf_grant_magic failed"); /* Fill in request message */ m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE; @@ -150,12 +150,12 @@ node_details_t *res; message m; if (path[0] == '/') - panic(__FILE__, "req_create: filename starts with '/'", NO_NUM); + panic("req_create: filename starts with '/'"); len = strlen(path) + 1; grant_id = cpf_grant_direct(fs_e, (vir_bytes) path, len, CPF_READ); if (grant_id == -1) - panic(__FILE__, "req_create: cpf_grant_direct failed", NO_NUM); + panic("req_create: cpf_grant_direct failed"); /* Fill in request message */ m.m_type = REQ_CREATE; @@ -217,7 +217,7 @@ char *buf; grant_id = cpf_grant_magic(fs_e, who_e, (vir_bytes) buf, sizeof(struct statfs), CPF_WRITE); if(grant_id == -1) - panic(__FILE__, "req_fstatfs: cpf_grant_magic failed", NO_NUM); + panic("req_fstatfs: cpf_grant_magic failed"); /* Fill in request message */ m.m_type = REQ_FSTATFS; @@ -272,7 +272,7 @@ u64_t *new_pos; grant_id = cpf_grant_magic(fs_e, who_e, (vir_bytes) buf, size, CPF_WRITE); if (grant_id < 0) - panic(__FILE__, "req_getdents: cpf_grant_magic failed", grant_id); + panic("req_getdents: cpf_grant_magic failed: %d", grant_id); m.m_type = REQ_GETDENTS; m.REQ_INODE_NR = inode_nr; @@ -328,7 +328,7 @@ ino_t linked_file; len = strlen(lastc) + 1; grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); if(grant_id == -1) - panic(__FILE__, "req_link: cpf_grant_direct failed", NO_NUM); + panic("req_link: cpf_grant_direct failed"); /* Fill in request message */ m.m_type = REQ_LINK; @@ -366,7 +366,7 @@ lookup_res_t *res; grant_id = cpf_grant_direct(fs_e, (vir_bytes) user_fullpath, sizeof(user_fullpath), CPF_READ | CPF_WRITE); if(grant_id == -1) - panic(__FILE__, "req_lookup: cpf_grant_direct failed", NO_NUM); + panic("req_lookup: cpf_grant_direct failed"); len = strlen(user_fullpath) + 1; @@ -391,7 +391,7 @@ lookup_res_t *res; grant_id2 = cpf_grant_direct(fs_e, (vir_bytes) &credentials, sizeof(credentials), CPF_READ); if(grant_id2 == -1) - panic(__FILE__, "req_lookup: cpf_grant_direct failed", NO_NUM); + panic("req_lookup: cpf_grant_direct failed"); m.REQ_GRANT2 = grant_id2; m.REQ_UCRED_SIZE= sizeof(credentials); @@ -462,7 +462,7 @@ mode_t dmode; len = strlen(lastc) + 1; grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); if(grant_id == -1) - panic(__FILE__, "req_mkdir: cpf_grant_direct failed", NO_NUM); + panic("req_mkdir: cpf_grant_direct failed"); /* Fill in request message */ m.m_type = REQ_MKDIR; @@ -501,7 +501,7 @@ dev_t dev; len = strlen(lastc) + 1; grant_id = cpf_grant_direct(fs_e, (vir_bytes)lastc, len, CPF_READ); if(grant_id == -1) - panic(__FILE__, "req_mknod: cpf_grant_direct failed", NO_NUM); + panic("req_mknod: cpf_grant_direct failed"); /* Fill in request message */ m.m_type = REQ_MKNOD; @@ -646,7 +646,7 @@ size_t len; grant_id = cpf_grant_magic(fs_e, who_e, (vir_bytes) buf, len, CPF_WRITE); if(grant_id == -1) - panic(__FILE__, "req_rdlink: cpf_grant_magic failed", NO_NUM); + panic("req_rdlink: cpf_grant_magic failed"); /* Fill in request message */ m.m_type = REQ_RDLINK; @@ -683,7 +683,7 @@ struct node_details *res_nodep; len = strlen(label)+1; grant_id = cpf_grant_direct(fs_e, (vir_bytes) label, len, CPF_READ); if (grant_id == -1) - panic(__FILE__, "req_readsuper: cpf_grant_direct failed", NO_NUM); + panic("req_readsuper: cpf_grant_direct failed"); /* Fill in request message */ m.m_type = REQ_READSUPER; @@ -732,12 +732,12 @@ unsigned int *cum_iop; message m; if (ex64hi(pos) != 0) - panic(__FILE__, "req_readwrite: pos too large", NO_NUM); + panic("req_readwrite: pos too large"); grant_id = cpf_grant_magic(fs_e, user_e, (vir_bytes) user_addr, num_of_bytes, (rw_flag==READING ? CPF_WRITE:CPF_READ)); if (grant_id == -1) - panic(__FILE__, "req_readwrite: cpf_grant_magic failed", NO_NUM); + panic("req_readwrite: cpf_grant_magic failed"); /* Fill in request message */ m.m_type = rw_flag == READING ? REQ_READ : REQ_WRITE; @@ -779,12 +779,12 @@ char *new_name; len_old = strlen(old_name) + 1; gid_old = cpf_grant_direct(fs_e, (vir_bytes) old_name, len_old, CPF_READ); if(gid_old == -1) - panic(__FILE__, "req_rename: cpf_grant_direct failed", NO_NUM); + panic("req_rename: cpf_grant_direct failed"); len_new = strlen(new_name) + 1; gid_new = cpf_grant_direct(fs_e, (vir_bytes) new_name, len_new, CPF_READ); if(gid_new == -1) - panic(__FILE__, "req_rename: cpf_grant_direct failed", NO_NUM); + panic("req_rename: cpf_grant_direct failed"); /* Fill in request message */ m.m_type = REQ_RENAME; @@ -820,7 +820,7 @@ char *lastc; len = strlen(lastc) + 1; grant_id = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ); if(grant_id == -1) - panic(__FILE__, "req_rmdir: cpf_grant_direct failed", NO_NUM); + panic("req_rmdir: cpf_grant_direct failed"); /* Fill in request message */ m.m_type = REQ_RMDIR; @@ -858,13 +858,13 @@ gid_t gid; len = strlen(lastc) + 1; gid_name = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ); if(gid_name == -1) - panic(__FILE__, "req_slink: cpf_grant_direct failed", NO_NUM); + panic("req_slink: cpf_grant_direct failed"); gid_buf = cpf_grant_magic(fs_e, who_e, (vir_bytes) path_addr, path_length, CPF_READ); if(gid_buf == -1) { cpf_revoke(gid_name); - panic(__FILE__, "req_slink: cpf_grant_magic failed", NO_NUM); + panic("req_slink: cpf_grant_magic failed"); } /* Fill in request message */ @@ -909,7 +909,7 @@ int pos; sizeof(struct stat), CPF_WRITE); if (grant_id < 0) - panic(__FILE__, "req_stat: cpf_grant_* failed", NO_NUM); + panic("req_stat: cpf_grant_* failed"); /* Fill in request message */ m.m_type = REQ_STAT; @@ -962,7 +962,7 @@ char *lastc; len = strlen(lastc) + 1; grant_id = cpf_grant_direct(fs_e, (vir_bytes) lastc, len, CPF_READ); if(grant_id == -1) - panic(__FILE__, "req_unlink: cpf_grant_direct failed", NO_NUM); + panic("req_unlink: cpf_grant_direct failed"); /* Fill in request message */ m.m_type = REQ_UNLINK; @@ -1030,7 +1030,7 @@ PRIVATE int fs_sendrec_f(char *file, int line, endpoint_t fs_e, message *reqm) struct vmnt *vmp; if(fs_e <= 0 || fs_e == NONE) - panic(__FILE__, "talking to bogus endpoint", fs_e); + panic("talking to bogus endpoint: %d", fs_e); /* Make a copy of the request so that we can load it back in * case of a dead driver */ @@ -1094,7 +1094,7 @@ PRIVATE int fs_sendrec_f(char *file, int line, endpoint_t fs_e, message *reqm) /* No FS ?? */ if (old_driver_e == NONE) - panic(__FILE__, "VFSdead_driver: couldn't find FS\n", fs_e); + panic("VFSdead_driver: couldn't find FS: %d", fs_e); /* Wait for a new driver. */ for (;;) { @@ -1102,8 +1102,7 @@ PRIVATE int fs_sendrec_f(char *file, int line, endpoint_t fs_e, message *reqm) printf("VFSdead_driver: waiting for new driver\n"); r = sef_receive(RS_PROC_NR, &m); if (r != OK) { - panic(__FILE__, "VFSdead_driver: unable to receive from RS", - r); + panic("VFSdead_driver: unable to receive from RS: %d", r); } if (m.m_type == DEVCTL) { /* Map new driver */ @@ -1116,13 +1115,11 @@ PRIVATE int fs_sendrec_f(char *file, int line, endpoint_t fs_e, message *reqm) } } else { - panic(__FILE__, "VFSdead_driver: got message from RS, type", - m.m_type); + panic("VFSdead_driver: got message from RS type: %d", m.m_type); } m.m_type = r; if ((r = send(RS_PROC_NR, &m)) != OK) { - panic(__FILE__, "VFSdead_driver: unable to send to RS", - r); + panic("VFSdead_driver: unable to send to RS: %d", r); } /* New driver is ready */ if (new_driver_e) break; @@ -1134,7 +1131,7 @@ PRIVATE int fs_sendrec_f(char *file, int line, endpoint_t fs_e, message *reqm) } printf("fs_sendrec: unhandled error %d sending to %d\n", r, fs_e); - panic(__FILE__, "fs_sendrec: unhandled error", NO_NUM); + panic("fs_sendrec: unhandled error"); } #endif diff --git a/servers/vfs/select.c b/servers/vfs/select.c index 61854f405..550acc40d 100644 --- a/servers/vfs/select.c +++ b/servers/vfs/select.c @@ -311,7 +311,7 @@ PRIVATE int select_request_asynch(struct filp *f, int *ops, int block) return(SEL_ERR); if (r != SUSPEND) - panic(__FILE__, "select_request_asynch: expected SUSPEND got", r); + panic("select_request_asynch: expected SUSPEND got: %d", r); f->filp_count++; dp->dmap_sel_filp = f; @@ -385,7 +385,7 @@ PRIVATE int copy_fdsets(struct selectentry *se, int nfds, int direction) fd_set *src_fds, *dst_fds; if(nfds < 0 || nfds > OPEN_MAX) - panic(__FILE__, "select copy_fdsets: nfds wrong", nfds); + panic("select copy_fdsets: nfds wrong: %d", nfds); /* Only copy back as many bits as the user expects. */ fd_setsize = _FDSETWORDS(nfds) * _FDSETBITSPERWORD/8; @@ -747,16 +747,14 @@ PUBLIC void select_reply1() } if (!(fp->filp_select_flags & FSF_BUSY)) - panic(__FILE__, "select_reply1: strange, not FSF_BUSY", NO_NUM); + panic("select_reply1: strange; not FSF_BUSY"); vp= fp->filp_vno; if (!vp) - panic(__FILE__, "select_reply1: FSF_BUSY but no vp", NO_NUM); + panic("select_reply1: FSF_BUSY but no vp"); - if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) - { - panic(__FILE__, "select_reply1: FSF_BUSY but not char special", - NO_NUM); + if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) { + panic("select_reply1: FSF_BUSY but not char special"); } if (vp->v_sdev != dev) @@ -785,10 +783,8 @@ PUBLIC void select_reply1() fp->filp_count--; else { - if (fp->filp_count != 1) - { - panic(__FILE__, "select_reply1: bad filp_count", - fp->filp_count); + if (fp->filp_count != 1) { + panic("select_reply1: bad filp_count: %d", fp->filp_count); } close_filp(fp); } @@ -893,17 +889,11 @@ PRIVATE void sel_restart_dev() continue; vp= fp->filp_vno; - if (!vp) - { - panic(__FILE__, - "sel_restart_dev: FSF_UPDATE but no vp", - NO_NUM); + if (!vp) { + panic("sel_restart_dev: FSF_UPDATE but no vp"); } - if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) - { - panic(__FILE__, - "sel_restart_dev: FSF_UPDATE but not char special", - NO_NUM); + if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) { + panic("sel_restart_dev: FSF_UPDATE but not char special"); } dp = &dmap[((vp->v_sdev) >> MAJOR) & BYTE]; diff --git a/servers/vfs/stadir.c b/servers/vfs/stadir.c index bb400a272..7beffde92 100644 --- a/servers/vfs/stadir.c +++ b/servers/vfs/stadir.c @@ -146,8 +146,7 @@ PUBLIC int do_fstat() if (rfilp->filp_vno->v_pipe == I_PIPE) { if (rfilp->filp_mode & R_BIT) if (ex64hi(rfilp->filp_pos) != 0) { - panic(__FILE__, "do_fstat: bad position in pipe", - NO_NUM); + panic("do_fstat: bad position in pipe"); } pipe_pos = ex64lo(rfilp->filp_pos); } diff --git a/servers/vfs/timers.c b/servers/vfs/timers.c index d1f94f0c0..c191a790a 100644 --- a/servers/vfs/timers.c +++ b/servers/vfs/timers.c @@ -14,7 +14,7 @@ PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg) clock_t now, old_head = 0, new_head; if ((r = getuptime(&now)) != OK) - panic(__FILE__, "FS couldn't get uptime from system task.", NO_NUM); + panic("FS couldn't get uptime from system task"); tmr_arg(tp)->ta_int = arg; @@ -23,8 +23,7 @@ PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg) /* reschedule our synchronous alarm if necessary */ if (!old_head || old_head > new_head) { if (sys_setalarm(new_head, 1) != OK) - panic(__FILE__, "FS set timer " - "couldn't set synchronous alarm.", NO_NUM); + panic("FS set timer couldn't set synchronous alarm"); } return; @@ -36,8 +35,7 @@ PUBLIC void fs_expire_timers(clock_t now) tmrs_exptimers(&fs_timers, now, &new_head); if (new_head > 0) { if (sys_setalarm(new_head, 1) != OK) - panic(__FILE__, "FS expire timer couldn't set " - "synchronous alarm.", NO_NUM); + panic("FS expire timer couldn't set synchronous alarm"); } } @@ -58,8 +56,6 @@ PUBLIC void fs_cancel_timer(timer_t *tp) */ if (old_head < new_head || !new_head) { if (sys_setalarm(new_head, 1) != OK) - panic(__FILE__, - "FS expire timer couldn't set synchronous alarm.", - NO_NUM); + panic("FS expire timer couldn't set synchronous alarm"); } } diff --git a/servers/vfs/utility.c b/servers/vfs/utility.c index 1e23caf7f..0a97a729f 100644 --- a/servers/vfs/utility.c +++ b/servers/vfs/utility.c @@ -42,7 +42,7 @@ int flag; /* M3 means path may be in message */ } if(len >= sizeof(user_fullpath)) - panic(__FILE__, "fetch_name: len too much for user_fullpath", len); + panic("fetch_name: len too much for user_fullpath: %d", len); /* Check name length for validity. */ if (len <= 0) { @@ -113,7 +113,7 @@ PUBLIC int isokendpt_f(char *file, int line, int endpoint, int *proc, int fatal) } if(failed && fatal) - panic(__FILE__, "isokendpt_f failed", NO_NUM); + panic("isokendpt_f failed"); return(failed ? EDEADSRCDST : OK); } @@ -135,7 +135,7 @@ PUBLIC time_t clock_time() r = getuptime2(&uptime, &boottime); if (r != OK) - panic(__FILE__,"clock_time err", r); + panic("clock_time err: %d", r); return( (time_t) (boottime + (uptime/system_hz))); } diff --git a/servers/vfs/vnode.c b/servers/vfs/vnode.c index 8a8278e42..04b6a2869 100644 --- a/servers/vfs/vnode.c +++ b/servers/vfs/vnode.c @@ -28,7 +28,7 @@ /* vp check that panics */ #define ASSERTVP(v) if(!SANEVP(v)) { \ - BADVP(v, __FILE__, __LINE__); panic("vfs", "bad vp", NO_NUM); } + BADVP(v, __FILE__, __LINE__); panic("bad vp"); } /*===========================================================================* * get_free_vnode * @@ -112,13 +112,13 @@ PUBLIC void put_vnode(struct vnode *vp) /* A vnode that's not in use can't be put. */ if (vp->v_ref_count <= 0) { printf("put_vnode: bad v_ref_count %d\n", vp->v_ref_count); - panic(__FILE__, "put_vnode failed", NO_NUM); + panic("put_vnode failed"); } /* fs_count should indicate that the file is in use. */ if (vp->v_fs_count <= 0) { printf("put_vnode: bad v_fs_count %d\n", vp->v_fs_count); - panic(__FILE__, "put_vnode failed", NO_NUM); + panic("put_vnode failed"); } /* Tell FS we don't need this inode to be open anymore. */ diff --git a/servers/vm/alloc.c b/servers/vm/alloc.c index 5ce525927..9c259a000 100644 --- a/servers/vm/alloc.c +++ b/servers/vm/alloc.c @@ -127,7 +127,7 @@ int line; if(!(c)) { \ printf("holes_sanity_f:%s:%d: %s failed\n", file, line, #c); \ util_stacktrace(); \ - vm_panic("assert failed.", NO_NUM); } \ + panic("assert failed"); } \ } int h, c = 0, n = 0; @@ -227,7 +227,7 @@ CHECKHOLES; if(memflags & PAF_CLEAR) { if ((s= sys_memset(0, CLICK_SIZE*old_base, CLICK_SIZE*clicks)) != OK) { - vm_panic("alloc_mem: sys_memset failed", s); + panic("alloc_mem: sys_memset failed: %d", s); } } @@ -284,7 +284,7 @@ CHECKHOLES; } if ( (new_ptr = free_slots) == NIL_HOLE) - vm_panic("hole table full", NO_NUM); + panic("hole table full"); new_ptr->h_base = base; new_ptr->h_len = clicks; free_slots = new_ptr->h_next; @@ -520,7 +520,7 @@ PRIVATE PUBLIC phys_bytes alloc_pages(int pages, int memflags) printmemstats(); #if SANITYCHECKS if(largest >= pages) { - vm_panic("no memory but largest was enough", NO_NUM); + panic("no memory but largest was enough"); } #endif return NO_MEM; @@ -549,7 +549,7 @@ PRIVATE PUBLIC phys_bytes alloc_pages(int pages, int memflags) int s; if ((s= sys_memset(0, CLICK_SIZE*mem, VM_PAGE_SIZE*pages)) != OK) - vm_panic("alloc_mem: sys_memset failed", s); + panic("alloc_mem: sys_memset failed: %d", s); } #if SANITYCHECKS @@ -589,7 +589,7 @@ PRIVATE void free_pages(phys_bytes pageno, int npages) pr->size += npages;); } else { if(!SLABALLOC(pr)) - vm_panic("alloc_pages: can't alloc", NO_NUM); + panic("alloc_pages: can't alloc"); #if SANITYCHECKS memstats(&firstnodes, &firstpages, &largest); @@ -683,7 +683,7 @@ PUBLIC int do_adddma(message *msg) dmatab[i].dt_base, dmatab[i].dt_size); } - vm_panic("adddma: table full", NO_NUM); + panic("adddma: table full"); return ENOSPC; } @@ -805,7 +805,7 @@ PUBLIC void release_dma(struct vmproc *vmp) { int i, found_one; - vm_panic("release_dma not done", NO_NUM); + panic("release_dma not done"); #if 0 found_one= FALSE; diff --git a/servers/vm/break.c b/servers/vm/break.c index b6022f848..da9e2c7ae 100644 --- a/servers/vm/break.c +++ b/servers/vm/break.c @@ -173,7 +173,7 @@ vir_bytes v; } new_clicks -= vmp->vm_arch.vm_seg[D].mem_vir; if ((r=get_stack_ptr(vmp->vm_endpoint, &new_sp)) != OK) - vm_panic("couldn't get stack pointer", r); + panic("couldn't get stack pointer: %d", r); r = adjust(vmp, new_clicks, new_sp); return r; } diff --git a/servers/vm/exec.c b/servers/vm/exec.c index 3c92acd7c..7b8535742 100644 --- a/servers/vm/exec.c +++ b/servers/vm/exec.c @@ -100,7 +100,7 @@ SANITYCHECK(SCL_DETAIL); r= sys_datacopy(msg->m_source, (vir_bytes)ptr, SELF, (vir_bytes)&args, sizeof(args)); if (r != OK) - vm_panic("exec_newmem: sys_datacopy failed", r); + panic("exec_newmem: sys_datacopy failed: %d", r); /* Minimum stack region (not preallocated) * Stopgap for better rlimit-based stack size system @@ -281,7 +281,7 @@ SANITYCHECK(SCL_DETAIL); /* We secretly know that making a new pagetable * in the same slot if one was there will never fail. */ - vm_panic("new_mem: pt_new failed", ENOMEM); + panic("new_mem: pt_new failed: %d", ENOMEM); } rmp->vm_flags |= VMF_HASPT; SANITYCHECK(SCL_DETAIL); @@ -325,7 +325,7 @@ SANITYCHECK(SCL_DETAIL); */ base = (phys_bytes)(new_base+text_clicks-1) << CLICK_SHIFT; if ((s= sys_memset(0, base, CLICK_SIZE)) != OK) - vm_panic("new_mem: sys_memset failed", s); + panic("new_mem: sys_memset failed: %d", s); } } @@ -351,7 +351,7 @@ SANITYCHECK(SCL_DETAIL); if((r2=sys_newmap(rmp->vm_endpoint, rmp->vm_arch.vm_seg)) != OK) { /* report new map to the kernel */ - vm_panic("sys_newmap failed", r2); + panic("sys_newmap failed: %d", r2); } /* Zero the bss, gap, and stack segment. */ @@ -362,12 +362,12 @@ SANITYCHECK(SCL_DETAIL); bytes -= bss_offset; if ((s=sys_memset(0, base, bytes)) != OK) { - vm_panic("new_mem can't zero", s); + panic("new_mem can't zero: %d", s); } /* Tell kernel this thing has no page table. */ if((s=pt_bind(NULL, rmp)) != OK) - vm_panic("exec_newmem: pt_bind failed", s); + panic("exec_newmem: pt_bind failed: %d", s); *stack_top= ((vir_bytes)rmp->vm_arch.vm_seg[S].mem_vir << CLICK_SHIFT) + ((vir_bytes)rmp->vm_arch.vm_seg[S].mem_len << CLICK_SHIFT); } @@ -474,7 +474,7 @@ PUBLIC int proc_new(struct vmproc *vmp, if(!map_page_region(vmp, vstart + text_bytes + data_bytes + hole_bytes, 0, stack_bytes + gap_bytes, MAP_NONE, VR_ANON | VR_WRITABLE, 0) != OK) { - vm_panic("map_page_region failed for stack", NO_NUM); + panic("map_page_region failed for stack"); } vmp->vm_arch.vm_seg[D].mem_phys = ABS2CLICK(vstart + text_bytes); @@ -506,10 +506,10 @@ PUBLIC int proc_new(struct vmproc *vmp, vmp->vm_flags |= VMF_HASPT; if((s=sys_newmap(vmp->vm_endpoint, vmp->vm_arch.vm_seg)) != OK) - vm_panic("sys_newmap (vm) failed", s); + panic("sys_newmap (vm) failed: %d", s); if((s=pt_bind(&vmp->vm_pt, vmp)) != OK) - vm_panic("exec_newmem: pt_bind failed", s); + panic("exec_newmem: pt_bind failed: %d", s); return OK; } diff --git a/servers/vm/fork.c b/servers/vm/fork.c index 091c5a324..c4db1f7ee 100644 --- a/servers/vm/fork.c +++ b/servers/vm/fork.c @@ -123,7 +123,7 @@ PUBLIC int do_fork(message *msg) child_abs = (phys_bytes) child_base << CLICK_SHIFT; parent_abs = (phys_bytes) vmp->vm_arch.vm_seg[D].mem_phys << CLICK_SHIFT; s = sys_abscopy(parent_abs, child_abs, prog_bytes); - if (s < 0) vm_panic("do_fork can't copy", s); + if (s < 0) panic("do_fork can't copy: %d", s); /* A separate I&D child keeps the parents text segment. The data and stack * segments must refer to the new copy. @@ -150,7 +150,7 @@ PUBLIC int do_fork(message *msg) if((r=sys_fork(vmp->vm_endpoint, childproc, &vmc->vm_endpoint, vmc->vm_arch.vm_seg, PFF_VMINHIBIT, &msgaddr)) != OK) { - vm_panic("do_fork can't sys_fork", r); + panic("do_fork can't sys_fork: %d", r); } NOTRUNNABLE(vmp->vm_endpoint); @@ -168,7 +168,7 @@ PUBLIC int do_fork(message *msg) } if((r=pt_bind(&vmc->vm_pt, vmc)) != OK) - vm_panic("fork can't pt_bind", r); + panic("fork can't pt_bind: %d", r); /* Inform caller of new child endpoint. */ msg->VMF_CHILD_ENDPOINT = vmc->vm_endpoint; diff --git a/servers/vm/i386/pagetable.c b/servers/vm/i386/pagetable.c index c1a4fcc8a..5aeab26b0 100644 --- a/servers/vm/i386/pagetable.c +++ b/servers/vm/i386/pagetable.c @@ -107,7 +107,7 @@ PUBLIC void pt_sanitycheck(pt_t *pt, char *file, int line) } if(slot >= ELEMENTS(vmproc)) { - vm_panic("pt_sanitycheck: passed pt not in any proc", NO_NUM); + panic("pt_sanitycheck: passed pt not in any proc"); } MYASSERT(usedpages_add(pt->pt_dir_phys, I386_PAGE_SIZE) == OK); @@ -137,7 +137,7 @@ PRIVATE void *aalloc(size_t bytes) u32_t b; b = (u32_t) malloc(I386_PAGE_SIZE + bytes); - if(!b) vm_panic("aalloc: out of memory", bytes); + if(!b) panic("aalloc: out of memory: %d", bytes); b += I386_PAGE_SIZE - (b % I386_PAGE_SIZE); return (void *) b; @@ -214,8 +214,7 @@ PRIVATE void vm_freepages(vir_bytes vir, vir_bytes phys, int pages, int reason) FREE_MEM(ABS2CLICK(phys), pages); if(pt_writemap(&vmp->vm_pt, arch_vir2map(vmp, vir), MAP_NONE, pages*I386_PAGE_SIZE, 0, WMF_OVERWRITE) != OK) - vm_panic("vm_freepages: pt_writemap failed", - NO_NUM); + panic("vm_freepages: pt_writemap failed"); } else { printf("VM: vm_freepages not freeing VM heap pages (%d)\n", pages); @@ -334,7 +333,7 @@ PUBLIC void *vm_allocpage(phys_bytes *phys, int reason) } if((r=sys_vmctl(SELF, VMCTL_FLUSHTLB, 0)) != OK) { - vm_panic("VMCTL_FLUSHTLB failed", r); + panic("VMCTL_FLUSHTLB failed: %d", r); } level--; @@ -367,11 +366,11 @@ PUBLIC void vm_pagelock(void *vir, int lockflag) /* Update flags. */ if((r=pt_writemap(pt, m, 0, I386_PAGE_SIZE, flags, WMF_OVERWRITE | WMF_WRITEFLAGSONLY)) != OK) { - vm_panic("vm_lockpage: pt_writemap failed\n", NO_NUM); + panic("vm_lockpage: pt_writemap failed"); } if((r=sys_vmctl(SELF, VMCTL_FLUSHTLB, 0)) != OK) { - vm_panic("VMCTL_FLUSHTLB failed", r); + panic("VMCTL_FLUSHTLB failed: %d", r); } return; @@ -439,10 +438,10 @@ PUBLIC int pt_writemap(pt_t *pt, vir_bytes v, phys_bytes physaddr, */ #if SANITYCHECKS if(physaddr != MAP_NONE && !(flags & I386_VM_PRESENT)) { - vm_panic("pt_writemap: writing dir with !P\n", NO_NUM); + panic("pt_writemap: writing dir with !P"); } if(physaddr == MAP_NONE && flags) { - vm_panic("pt_writemap: writing 0 with flags\n", NO_NUM); + panic("pt_writemap: writing 0 with flags"); } #endif @@ -458,7 +457,7 @@ PUBLIC int pt_writemap(pt_t *pt, vir_bytes v, phys_bytes physaddr, if(pt->pt_dir[pdecheck] & I386_VM_BIGPAGE) { printf("pt_writemap: trying to write 0x%lx into 0x%lx\n", physaddr, v); - vm_panic("pt_writemap: BIGPAGE found", NO_NUM); + panic("pt_writemap: BIGPAGE found"); } if(!(pt->pt_dir[pdecheck] & I386_VM_PRESENT)) { int r; @@ -615,7 +614,7 @@ PUBLIC int pt_new(pt_t *pt) /* Map in kernel. */ if(pt_mapkernel(pt) != OK) - vm_panic("pt_new: pt_mapkernel failed", NO_NUM); + panic("pt_new: pt_mapkernel failed"); return OK; } @@ -680,10 +679,10 @@ PUBLIC void pt_init(phys_bytes usedlimit) /* Get ourselves spare pages. */ if(!(sparepages_mem = (vir_bytes) aalloc(I386_PAGE_SIZE*SPAREPAGES))) - vm_panic("pt_init: aalloc for spare failed", NO_NUM); + panic("pt_init: aalloc for spare failed"); if((r=sys_umap(SELF, VM_D, (vir_bytes) sparepages_mem, I386_PAGE_SIZE*SPAREPAGES, &sparepages_ph)) != OK) - vm_panic("pt_init: sys_umap failed", r); + panic("pt_init: sys_umap failed: %d", r); for(s = 0; s < SPAREPAGES; s++) { sparepages[s].page = (void *) (sparepages_mem + s*I386_PAGE_SIZE); @@ -728,7 +727,7 @@ PUBLIC void pt_init(phys_bytes usedlimit) * from the current one. */ if(pt_new(newpt) != OK) - vm_panic("pt_init: pt_new failed", NO_NUM); + panic("pt_init: pt_new failed"); /* Set up mappings for VM process. */ for(v = lo; v < hi; v += I386_PAGE_SIZE) { @@ -740,7 +739,7 @@ PUBLIC void pt_init(phys_bytes usedlimit) */ if(pt_writemap(newpt, v+moveup, v, I386_PAGE_SIZE, I386_VM_PRESENT|I386_VM_WRITE|I386_VM_USER, 0) != OK) - vm_panic("pt_init: pt_writemap failed", NO_NUM); + panic("pt_init: pt_writemap failed"); } /* Move segments up too. */ @@ -753,7 +752,7 @@ PUBLIC void pt_init(phys_bytes usedlimit) */ if(!(page_directories = vm_allocpage(&page_directories_phys, VMP_PAGETABLE))) - vm_panic("no virt addr for vm mappings", NO_NUM); + panic("no virt addr for vm mappings"); memset(page_directories, 0, I386_PAGE_SIZE); @@ -793,7 +792,7 @@ PUBLIC void pt_init(phys_bytes usedlimit) &flags) == OK) { vir_bytes vir; if(index >= MAX_KERNMAPPINGS) - vm_panic("VM: too many kernel mappings", index); + panic("VM: too many kernel mappings: %d", index); kern_mappings[index].phys_addr = addr; kern_mappings[index].len = len; kern_mappings[index].flags = flags; @@ -805,12 +804,12 @@ PUBLIC void pt_init(phys_bytes usedlimit) kern_mappings[index].flags |= I386_VM_PWT | I386_VM_PCD; if(addr % I386_PAGE_SIZE) - vm_panic("VM: addr unaligned", addr); + panic("VM: addr unaligned: %d", addr); if(len % I386_PAGE_SIZE) - vm_panic("VM: len unaligned", len); + panic("VM: len unaligned: %d", len); vir = arch_map2vir(&vmproc[VMP_SYSTEM], offset); if(sys_vmctl_reply_mapping(index, vir) != OK) - vm_panic("VM: reply failed", NO_NUM); + panic("VM: reply failed"); offset += len; index++; kernmappings++; @@ -827,7 +826,7 @@ PUBLIC void pt_init(phys_bytes usedlimit) /* Tell kernel about free pde's. */ while(free_pde*I386_BIG_PAGE_SIZE < VM_PROCSTART) { if((r=sys_vmctl(SELF, VMCTL_I386_FREEPDE, free_pde++)) != OK) { - vm_panic("VMCTL_I386_FREEPDE failed", r); + panic("VMCTL_I386_FREEPDE failed: %d", r); } } @@ -838,7 +837,7 @@ PUBLIC void pt_init(phys_bytes usedlimit) /* Increase kernel segment to address this memory. */ if((r=sys_vmctl(SELF, VMCTL_I386_KERNELLIMIT, kernlimit)) != OK) { - vm_panic("VMCTL_I386_KERNELLIMIT failed", r); + panic("VMCTL_I386_KERNELLIMIT failed: %d", r); } kpagedir = arch_map2vir(&vmproc[VMP_SYSTEM], @@ -846,7 +845,7 @@ PUBLIC void pt_init(phys_bytes usedlimit) /* Tell kernel how to get at the page directories. */ if((r=sys_vmctl(SELF, VMCTL_I386_PAGEDIRS, kpagedir)) != OK) { - vm_panic("VMCTL_I386_PAGEDIRS failed", r); + panic("VMCTL_I386_PAGEDIRS failed: %d", r); } /* Give our process the new, copied, private page table. */ @@ -855,7 +854,7 @@ PUBLIC void pt_init(phys_bytes usedlimit) /* Now actually enable paging. */ if(sys_vmctl_enable_paging(vmp->vm_arch.vm_seg) != OK) - vm_panic("pt_init: enable paging failed", NO_NUM); + panic("pt_init: enable paging failed"); /* Back to reality - this is where the stack actually is. */ vmp->vm_arch.vm_seg[S].mem_len -= extra_clicks; @@ -934,7 +933,7 @@ PUBLIC int pt_mapkernel(pt_t *pt) I386_VM_WRITE | global_bit; } } else { - vm_panic("VM: pt_mapkernel: no bigpage", NO_NUM); + panic("VM: pt_mapkernel: no bigpage"); } if(pagedir_pde >= 0) { @@ -948,7 +947,7 @@ PUBLIC int pt_mapkernel(pt_t *pt) kern_mappings[i].phys_addr, kern_mappings[i].len, kern_mappings[i].flags, 0) != OK) { - vm_panic("pt_mapkernel: pt_writemap failed", NO_NUM); + panic("pt_mapkernel: pt_writemap failed"); } } diff --git a/servers/vm/main.c b/servers/vm/main.c index c734f6c0e..d0a7f8a5f 100644 --- a/servers/vm/main.c +++ b/servers/vm/main.c @@ -84,7 +84,7 @@ PUBLIC int main(void) SANITYCHECK(SCL_DETAIL); if ((r=sef_receive(ANY, &msg)) != OK) - vm_panic("sef_receive() error", r); + panic("sef_receive() error: %d", r); SANITYCHECK(SCL_DETAIL); @@ -136,7 +136,7 @@ PUBLIC int main(void) if((r=send(who_e, &msg)) != OK) { printf("VM: couldn't send %d to %d (err %d)\n", msg.m_type, who_e, r); - vm_panic("send() error", NO_NUM); + panic("send() error"); } SANITYCHECK(SCL_DETAIL); } @@ -193,7 +193,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) * slots to fill in. */ if (OK != (s=sys_getimage(image))) - vm_panic("couldn't get image table: %d\n", s); + panic("couldn't get image table: %d", s); /* Set table to 0. This invalidates all slots (clear VMF_INUSE). */ memset(vmproc, 0, sizeof(vmproc)); @@ -209,7 +209,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) phys_bytes proclimit; struct vmproc *vmp; - if(ip->proc_nr >= _NR_PROCS) { vm_panic("proc", ip->proc_nr); } + if(ip->proc_nr >= _NR_PROCS) { panic("proc: %d", ip->proc_nr); } if(ip->proc_nr < 0 && ip->proc_nr != SYSTEM) continue; #define GETVMP(v, nr) \ @@ -218,7 +218,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) } else if(nr == SYSTEM) { \ vmp = &vmproc[VMP_SYSTEM]; \ } else { \ - vm_panic("init: crazy proc_nr", nr); \ + panic("init: crazy proc_nr: %d", nr); \ } /* Initialize normal process table slot or special SYSTEM @@ -231,7 +231,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Get memory map for this process from the kernel. */ if ((s=get_mem_map(ip->proc_nr, vmp->vm_arch.vm_seg)) != OK) - vm_panic("couldn't get process mem_map",s); + panic("couldn't get process mem_map: %d", s); /* Remove this memory from the free list. */ reserve_proc_mem(mem_chunks, vmp->vm_arch.vm_seg); @@ -279,13 +279,13 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) vmp->vm_arch.vm_seg[D].mem_len; if(pt_new(&vmp->vm_pt) != OK) - vm_panic("VM: no new pagetable", NO_NUM); + panic("VM: no new pagetable"); #define BASICSTACK VM_PAGE_SIZE old_stacktop = CLICK2ABS(vmp->vm_arch.vm_seg[S].mem_vir + vmp->vm_arch.vm_seg[S].mem_len); if(sys_vmctl(vmp->vm_endpoint, VMCTL_INCSP, VM_STACKTOP - old_stacktop) != OK) { - vm_panic("VM: vmctl for new stack failed", NO_NUM); + panic("VM: vmctl for new stack failed"); } FREE_MEM(vmp->vm_arch.vm_seg[D].mem_phys + @@ -303,14 +303,14 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys), CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys), VM_STACKTOP) != OK) { - vm_panic("failed proc_new for boot process", NO_NUM); + panic("failed proc_new for boot process"); } } /* Set up table of calls. */ #define CALLMAP(code, func) { int i; \ - if((i=CALLNUMBER(code)) < 0) { vm_panic(#code " invalid", (code)); } \ - if(i >= NR_VM_CALLS) { vm_panic(#code " invalid", (code)); } \ + if((i=CALLNUMBER(code)) < 0) { panic(#code " invalid: %d", (code)); } \ + if(i >= NR_VM_CALLS) { panic(#code " invalid: %d", (code)); } \ vm_calls[i].vmc_func = (func); \ vm_calls[i].vmc_name = #code; \ } @@ -352,7 +352,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Sanity checks */ if(find_kernel_top() >= VM_PROCSTART) - vm_panic("kernel loaded too high", NO_NUM); + panic("kernel loaded too high"); /* Initialize the structures for queryexit */ init_query_exit(); @@ -364,12 +364,12 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /* Map all the services in the boot image. */ if((s = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0, (vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) { - panic("VM", "sys_safecopyfrom failed", s); + panic("sys_safecopyfrom failed: %d", s); } for(i=0;i < NR_BOOT_PROCS;i++) { if(rprocpub[i].in_use) { if((s = map_service(&rprocpub[i])) != OK) { - vm_panic("unable to map service", s); + panic("unable to map service: %d", s); } } } @@ -405,7 +405,7 @@ PRIVATE int vm_acl_ok(endpoint_t caller, int call) int n, r; if ((r = vm_isokendpt(caller, &n)) != OK) - vm_panic("VM: from strange source.", caller); + panic("VM: from strange source: %d", caller); /* See if the call is allowed. */ if (!GET_BIT(vmproc[n].vm_call_mask, call)) { diff --git a/servers/vm/map_mem.c b/servers/vm/map_mem.c index f4940fff0..0cbb2dc34 100644 --- a/servers/vm/map_mem.c +++ b/servers/vm/map_mem.c @@ -145,7 +145,7 @@ PRIVATE int do_map_memory(struct vmproc *vms, struct vmproc *vmd, physr_start_iter(vrs->phys, &iter, offset_s, AVL_EQUAL); prs = physr_get_iter(&iter); if(!prs) - vm_panic("map_memory: no aligned phys region.", 0); + panic("map_memory: no aligned phys region: %d", 0); /* flag: 0 -> read-only * 1 -> writable @@ -230,10 +230,10 @@ PUBLIC int map_memory(endpoint_t sour, endpoint_t dest, int r; if(vm_isokendpt(sour, &p) != OK) - vm_panic("handle_memory: endpoint wrong", sour); + panic("handle_memory: endpoint wrong: %d", sour); vms = &vmproc[p]; if(vm_isokendpt(dest, &p) != OK) - vm_panic("handle_memory: endpoint wrong", dest); + panic("handle_memory: endpoint wrong: %d", dest); vmd = &vmproc[p]; vrs = map_lookup(vms, virt_s); @@ -295,7 +295,7 @@ PUBLIC int unmap_memory(endpoint_t sour, endpoint_t dest, /* Use information on the destination process to unmap. */ if(vm_isokendpt(dest, &p) != OK) - vm_panic("handle_memory: endpoint wrong", dest); + panic("handle_memory: endpoint wrong: %d", dest); vmd = &vmproc[p]; vrd = map_lookup(vmd, virt_d); @@ -306,7 +306,7 @@ PUBLIC int unmap_memory(endpoint_t sour, endpoint_t dest, physr_start_iter(vrd->phys, &iter, off, AVL_EQUAL); pr = physr_get_iter(&iter); if(!pr) - vm_panic("map_memory: no aligned phys region.", 0); + panic("map_memory: no aligned phys region: %d", 0); /* Copy the phys block now rather than doing COW. */ end = off + length; diff --git a/servers/vm/mmap.c b/servers/vm/mmap.c index 5447f15fa..975ad1e11 100644 --- a/servers/vm/mmap.c +++ b/servers/vm/mmap.c @@ -41,7 +41,7 @@ PUBLIC int do_mmap(message *m) struct vir_region *vr = NULL; if((r=vm_isokendpt(m->m_source, &n)) != OK) { - vm_panic("do_mmap: message from strange source", m->m_source); + panic("do_mmap: message from strange source: %d", m->m_source); } vmp = &vmproc[n]; @@ -281,7 +281,7 @@ PUBLIC int do_shared_unmap(message *m) } if(map_unmap_region(vmp, vr, vr->length) != OK) - vm_panic("do_shared_unmap: map_unmap_region failed", NO_NUM); + panic("do_shared_unmap: map_unmap_region failed"); return OK; } @@ -349,7 +349,7 @@ PUBLIC int do_munmap(message *m) struct vir_region *vr; if((r=vm_isokendpt(m->m_source, &n)) != OK) { - vm_panic("do_mmap: message from strange source", m->m_source); + panic("do_mmap: message from strange source: %d", m->m_source); } vmp = &vmproc[n]; @@ -362,7 +362,7 @@ PUBLIC int do_munmap(message *m) } else if(m->m_type == VM_MUNMAP_TEXT) { addr = (vir_bytes) arch_vir2map_text(vmp, (vir_bytes) m->VMUM_ADDR); } else { - vm_panic("do_munmap: strange type", NO_NUM); + panic("do_munmap: strange type"); } if(!(vr = map_lookup(vmp, addr))) { @@ -380,7 +380,7 @@ PUBLIC int do_munmap(message *m) } if(map_unmap_region(vmp, vr, len) != OK) - vm_panic("do_munmap: map_unmap_region failed", NO_NUM); + panic("do_munmap: map_unmap_region failed"); return OK; } diff --git a/servers/vm/pagefaults.c b/servers/vm/pagefaults.c index 34c6570d0..cccbed4f7 100644 --- a/servers/vm/pagefaults.c +++ b/servers/vm/pagefaults.c @@ -63,7 +63,7 @@ PUBLIC void do_pagefaults(void) int p, wr = PFERR_WRITE(err); if(vm_isokendpt(ep, &p) != OK) - vm_panic("do_pagefaults: endpoint wrong", ep); + panic("do_pagefaults: endpoint wrong: %d", ep); vmp = &vmproc[p]; vm_assert(vmp->vm_flags & VMF_INUSE); @@ -75,9 +75,9 @@ PUBLIC void do_pagefaults(void) ep, arch_map2vir(vmp, addr), pf_errstr(err)); sys_sysctl_stacktrace(vmp->vm_endpoint); if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK) - vm_panic("sys_kill failed", s); + panic("sys_kill failed: %d", s); if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK) - vm_panic("do_pagefaults: sys_vmctl failed", ep); + panic("do_pagefaults: sys_vmctl failed: %d", ep); continue; } @@ -97,9 +97,9 @@ PUBLIC void do_pagefaults(void) ep, arch_map2vir(vmp, addr), pf_errstr(err)); sys_sysctl_stacktrace(vmp->vm_endpoint); if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK) - vm_panic("sys_kill failed", s); + panic("sys_kill failed: %d", s); if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK) - vm_panic("do_pagefaults: sys_vmctl failed", ep); + panic("do_pagefaults: sys_vmctl failed: %d", ep); continue; } @@ -111,15 +111,15 @@ PUBLIC void do_pagefaults(void) printf("VM: pagefault: SIGSEGV %d pagefault not handled\n", ep); sys_sysctl_stacktrace(vmp->vm_endpoint); if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK) - vm_panic("sys_kill failed", s); + panic("sys_kill failed: %d", s); if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK) - vm_panic("do_pagefaults: sys_vmctl failed", ep); + panic("do_pagefaults: sys_vmctl failed: %d", ep); continue; } /* Pagefault is handled, so now reactivate the process. */ if((s=sys_vmctl(ep, VMCTL_CLEAR_PAGEFAULT, r)) != OK) - vm_panic("do_pagefaults: sys_vmctl failed", ep); + panic("do_pagefaults: sys_vmctl failed: %d", ep); } @@ -146,7 +146,7 @@ PUBLIC void do_memory(void) switch(r) { case VMPTYPE_CHECK: if(vm_isokendpt(who, &p) != OK) - vm_panic("do_memory: bad endpoint", who); + panic("do_memory: bad endpoint: %d", who); vmp = &vmproc[p]; r = handle_memory(vmp, mem, len, wrflag); @@ -165,7 +165,7 @@ PUBLIC void do_memory(void) } if(sys_vmctl(requestor, VMCTL_MEMREQ_REPLY, r) != OK) - vm_panic("do_memory: sys_vmctl failed", r); + panic("do_memory: sys_vmctl failed: %d", r); } } diff --git a/servers/vm/region.c b/servers/vm/region.c index 616c5c51e..1559eb047 100644 --- a/servers/vm/region.c +++ b/servers/vm/region.c @@ -51,7 +51,7 @@ PRIVATE char *map_name(struct vir_region *vr) case VR_DIRECT: return "direct"; default: - vm_panic("unknown mapping type", type); + panic("unknown mapping type: %d", type); } return "NOTREACHED"; @@ -455,7 +455,7 @@ PUBLIC void pb_unreferenced(struct vir_region *region, struct phys_region *pr) } else if(region->flags & VR_DIRECT) { ; /* No action required. */ } else { - vm_panic("strange phys flags", NO_NUM); + panic("strange phys flags"); } SLABFREE(pb); } @@ -588,7 +588,7 @@ vir_bytes offset; SANITYCHECK(SCL_FUNCTIONS); if(!vmp->vm_regions) - vm_panic("process has no regions", vmp->vm_endpoint); + panic("process has no regions: %d", vmp->vm_endpoint); for(r = vmp->vm_regions; r; r = r->next) { if(offset >= r->vaddr && offset < r->vaddr + r->length) @@ -758,7 +758,7 @@ USE(newpb, */ r = map_ph_writept(vmp, region, ph); if(r != OK) - vm_panic("map_copy_ph_block: map_ph_writept failed", r); + panic("map_copy_ph_block: map_ph_writept failed: %d", r); return OK; } @@ -825,7 +825,7 @@ int write; #if SANITYCHECKS if(OK != pt_checkrange(&vmp->vm_pt, region->vaddr+offset, VM_PAGE_SIZE, write)) { - vm_panic("map_pf: pt_checkrange failed", r); + panic("map_pf: pt_checkrange failed: %d", r); } #endif @@ -885,8 +885,8 @@ int write; #define RESET_ITER(it, where, what) { \ physr_start_iter(region->phys, &it, where, AVL_EQUAL); \ what = physr_get_iter(&it); \ - if(!what) vm_panic("thing missing", NO_NUM); \ - if(what->offset != where) vm_panic("thing wrong", NO_NUM); \ + if(!what) panic("thing missing"); \ + if(what->offset != where) panic("thing wrong"); \ } FREE_RANGE_HERE(NULL, physr); @@ -960,7 +960,7 @@ int write; printf("handle mem %s-", arch_map2str(vmp, region->vaddr+offset)); printf("%s failed\n", arch_map2str(vmp, region->vaddr+offset+length)); map_printregion(vmp, region); - vm_panic("checkrange failed", NO_NUM); + panic("checkrange failed"); } #endif @@ -1269,7 +1269,7 @@ PUBLIC int map_unmap_region(struct vmproc *vmp, struct vir_region *region, SANITYCHECK(SCL_DETAIL); if(r == NULL) - vm_panic("map_unmap_region: region not found\n", NO_NUM); + panic("map_unmap_region: region not found"); if(len > r->length || (len % VM_PAGE_SIZE)) { printf("VM: bogus length 0x%lx\n", len); @@ -1388,7 +1388,7 @@ PUBLIC int map_remap(struct vmproc *dvmp, vir_bytes da, size_t size, struct phys_block *pb = ph->ph; USE(pb, pb->refcount++;); if(map_ph_writept(dvmp, vr, ph) != OK) { - vm_panic("map_remap: map_ph_writept failed", NO_NUM); + panic("map_remap: map_ph_writept failed"); } physr_incr_iter(&iter); diff --git a/servers/vm/sanitycheck.h b/servers/vm/sanitycheck.h index a0a67729e..13a4f2327 100644 --- a/servers/vm/sanitycheck.h +++ b/servers/vm/sanitycheck.h @@ -11,7 +11,7 @@ */ #define MYASSERT(c) do { if(!(c)) { \ printf("VM:%s:%d: %s failed\n", file, line, #c); \ - vm_panic("sanity check failed", NO_NUM); } } while(0) + panic("sanity check failed"); } } while(0) #define SLABSANITYCHECK(l) if((l) <= vm_sanitychecklevel) { \ slab_sanitycheck(__FILE__, __LINE__); } @@ -46,17 +46,17 @@ #define SLABSANE(ptr) { \ if(!slabsane_f(__FILE__, __LINE__, ptr, sizeof(*(ptr)))) { \ printf("VM:%s:%d: SLABSANE(%s)\n", __FILE__, __LINE__, #ptr); \ - vm_panic("SLABSANE failed", NO_NUM); \ + panic("SLABSANE failed"); \ } \ } #define NOTRUNNABLE(ep) { \ struct proc pr; \ if(sys_getproc(&pr, ep) != OK) { \ - vm_panic("VM: sys_getproc failed", ep); \ + panic("VM: sys_getproc failed: %d", ep); \ } \ if(!pr.p_rts_flags) { \ - vm_panic("VM: runnable", ep); \ + panic("VM: runnable: %d", ep); \ } \ } diff --git a/servers/vm/signal.c b/servers/vm/signal.c index bc7555bb5..ab4fda3ce 100644 --- a/servers/vm/signal.c +++ b/servers/vm/signal.c @@ -46,7 +46,7 @@ PUBLIC int do_push_sig(message *msg) vmp = &vmproc[n]; if ((r=get_stack_ptr(ep, &sp)) != OK) - vm_panic("couldn't get new stack pointer (for sig)",r); + panic("couldn't get new stack pointer (for sig): %d", r); /* Save old SP for caller */ msg->VMPS_OLD_SP = (char *) sp; diff --git a/servers/vm/slaballoc.c b/servers/vm/slaballoc.c index bf9e4fe00..4ec4c8182 100644 --- a/servers/vm/slaballoc.c +++ b/servers/vm/slaballoc.c @@ -354,7 +354,7 @@ PUBLIC void *slaballoc(int bytes) printf("slaballoc: odd, bytes %d?\n", bytes); } if(!slabsane_f(__FILE__, __LINE__, ret, bytes)) - vm_panic("slaballoc: slabsane failed", NO_NUM); + panic("slaballoc: slabsane failed"); #endif return ret; @@ -365,7 +365,7 @@ PUBLIC void *slaballoc(int bytes) } SLABSANITYCHECK(SCL_FUNCTIONS); - vm_panic("slaballoc: no space in 'used' slabdata", NO_NUM); + panic("slaballoc: no space in 'used' slabdata"); /* Not reached. */ return NULL; @@ -442,7 +442,7 @@ PUBLIC void slabfree(void *mem, int bytes) SLABSANITYCHECK(SCL_FUNCTIONS); if(objstats(mem, bytes, &s, &f, &i) != OK) { - vm_panic("slabfree objstats failed", NO_NUM); + panic("slabfree objstats failed"); } #if SANITYCHECKS @@ -498,7 +498,7 @@ PUBLIC void slablock(void *mem, int bytes) struct slabdata *f; if(objstats(mem, bytes, &s, &f, &i) != OK) - vm_panic("slablock objstats failed", NO_NUM); + panic("slablock objstats failed"); SLABDATAUNWRITABLE(f); @@ -517,7 +517,7 @@ PUBLIC void slabunlock(void *mem, int bytes) struct slabdata *f; if(objstats(mem, bytes, &s, &f, &i) != OK) - vm_panic("slablock objstats failed", NO_NUM); + panic("slablock objstats failed"); SLABDATAWRITABLE(f, i); diff --git a/servers/vm/util.h b/servers/vm/util.h index 2b5bd6374..00b3baf8c 100644 --- a/servers/vm/util.h +++ b/servers/vm/util.h @@ -12,17 +12,12 @@ if(vm_sanitychecklevel > 0 && !(cond)) { \ printf("VM:%s:%d: assert failed: %s\n", \ __FILE__, __LINE__, #cond); \ - panic("VM", "assert failed", NO_NUM); \ + panic("assert failed"); \ } \ } #else #define vm_assert(cond) ; #endif -#define vm_panic(str, n) { char _pline[100]; \ - sprintf(_pline, "%s:%d: %s", __FILE__, __LINE__, (str)); \ - panic("VM", _pline, (n)); \ - } - #endif diff --git a/servers/vm/utility.c b/servers/vm/utility.c index bebf9fb51..844aae720 100644 --- a/servers/vm/utility.c +++ b/servers/vm/utility.c @@ -68,7 +68,7 @@ struct memory *mem_chunks; /* store mem chunks here */ /* Obtain and parse memory from system environment. */ if(env_memory_parse(mem_chunks, NR_MEMS) != OK) - vm_panic("couldn't obtain memory chunks", NO_NUM); + panic("couldn't obtain memory chunks"); /* Round physical memory to clicks. Round start up, round end down. */ for (i = 0; i < NR_MEMS; i++) { @@ -110,8 +110,8 @@ struct mem_map *map_ptr; /* memory to remove */ } if (memp >= &mem_chunks[NR_MEMS]) { - vm_panic("reserve_proc_mem: can't find map in mem_chunks ", - map_ptr[T].mem_phys); + panic("reserve_proc_mem: can't find map in mem_chunks: 0x%lx", + map_ptr[T].mem_phys); } } @@ -160,7 +160,7 @@ char *brk_addr; /* VM wants to call brk() itself. */ if((r=real_brk(vmm, (vir_bytes) brk_addr)) != OK) - vm_panic("VM: brk() on myself failed\n", NO_NUM); + panic("VM: brk() on myself failed"); _brksize = brk_addr; return 0; } diff --git a/test/safecopy/inc.h b/test/safecopy/inc.h index b737c4480..ff1277755 100644 --- a/test/safecopy/inc.h +++ b/test/safecopy/inc.h @@ -33,12 +33,12 @@ #define FIFO_WAIT(fid) { \ int a; \ if(read(fid, &a, sizeof(a)) != sizeof(a)) \ - panic(__FILE__, "FIFO_WAIT failed", NO_NUM); \ + panic("FIFO_WAIT failed"); \ } #define FIFO_NOTIFY(fid) { \ int a = 1; \ if(write(fid, &a, sizeof(a)) != sizeof(a)) \ - panic(__FILE__, "FIFO_NOTIFY failed", NO_NUM); \ + panic("FIFO_NOTIFY failed"); \ } #define DEBUG 0 diff --git a/test/safemap/inc.h b/test/safemap/inc.h index 32ef9c61e..faa460c30 100644 --- a/test/safemap/inc.h +++ b/test/safemap/inc.h @@ -29,12 +29,12 @@ #define FIFO_WAIT(fid) { \ int a; \ if(read(fid, &a, sizeof(a)) != sizeof(a)) \ - panic(__FILE__, "FIFO_WAIT failed", NO_NUM); \ + panic( "FIFO_WAIT failed"); \ } #define FIFO_NOTIFY(fid) { \ int a = 1; \ if(write(fid, &a, sizeof(a)) != sizeof(a)) \ - panic(__FILE__, "FIFO_NOTIFY failed", NO_NUM); \ + panic( "FIFO_NOTIFY failed"); \ } #define CHECK_TEST(who, result, expected, test_name) { \ diff --git a/test/safeperf/inc.h b/test/safeperf/inc.h index 893f29ec9..0a9d2a77e 100644 --- a/test/safeperf/inc.h +++ b/test/safeperf/inc.h @@ -29,12 +29,12 @@ #define FIFO_WAIT(fid) { \ int a; \ if(read(fid, &a, sizeof(a)) != sizeof(a)) \ - panic(__FILE__, "FIFO_WAIT failed", NO_NUM); \ + panic( "FIFO_WAIT failed"); \ } #define FIFO_NOTIFY(fid) { \ int a = 1; \ if(write(fid, &a, sizeof(a)) != sizeof(a)) \ - panic(__FILE__, "FIFO_NOTIFY failed", NO_NUM); \ + panic( "FIFO_NOTIFY failed"); \ } #define REPORT_TEST(who, test_name, diff) { \ diff --git a/test/safeperf/requestor.c b/test/safeperf/requestor.c index f348aae66..c09fc135f 100644 --- a/test/safeperf/requestor.c +++ b/test/safeperf/requestor.c @@ -19,7 +19,7 @@ void read_write_buff(char* buff, int size, int is_write) char c; if(size % CLICK_SIZE != 0) { - panic("REQUESTOR", "buff_size not page aligned", NO_NUM); + panic("buff_size not page aligned"); } if(is_write) { for(i=0;i