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:
@@ -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++)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user