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.
This commit is contained in:
Ben Gras
2010-03-05 15:05:11 +00:00
parent 851dc95566
commit 35a108b911
171 changed files with 1381 additions and 1649 deletions

View File

@@ -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 */
}

View File

@@ -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);
}
}
}

View File

@@ -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");
}
/*===========================================================================*

View File

@@ -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;

View File

@@ -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(;;);
}

View File

@@ -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++)

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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? */

View File

@@ -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);
}
/*===========================================================================*

View File

@@ -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));

View File

@@ -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,

View File

@@ -5,8 +5,6 @@
#include <minix/callnr.h>
#include <minix/vfsif.h>
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);
}

View File

@@ -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();

View File

@@ -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? */

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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");
}
}

View File

@@ -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 <link>, 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];

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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__); }
/*===========================================================================*

View File

@@ -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 */

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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())));
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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");
}
}

View File

@@ -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)) {

View File

@@ -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;
}

View File

@@ -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);
}
/*===========================================================================*

View File

@@ -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);
}
}

View File

@@ -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<next_slot; src_ind++)
@@ -1120,7 +1120,7 @@ message *mp;
first_slot= 0;
next_slot= dst_ind;
if (next_slot >= ASYN_NR)
panic(__FILE__, "asynsend: msgtable full", NO_NUM);
panic("asynsend: msgtable full");
}
msgtable[next_slot].dst= dst;

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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--;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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");
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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];

View File

@@ -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);
}

View File

@@ -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");
}
}

View File

@@ -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)));
}

View File

@@ -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. */

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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");
}
}

View File

@@ -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)) {

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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); \
} \
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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;
}