#include "is.h"
+#define NHOOKS 15
+
+struct hook_entry {
+ int key;
+ void (*function)(void);
+ char *name;
+} hooks[NHOOKS] = {
+ { F1, proctab_dmp, "Kernel process table" },
+ { F2, memmap_dmp, "Process memory maps" },
+ { F3, image_dmp, "System image" },
+ { F4, privileges_dmp, "Process privileges" },
+ { F5, monparams_dmp, "Boot monitor parameters" },
+ { F6, irqtab_dmp, "IRQ hooks and policies" },
+ { F7, kmessages_dmp, "Kernel messages" },
+ { F10, kenv_dmp, "Kernel parameters" },
+ { F11, timing_dmp, "Timing details (if enabled)" },
+ { F12, sched_dmp, "Scheduling queues" },
+ { SF1, mproc_dmp, "Process manager process table" },
+ { SF2, sigaction_dmp, "Signals" },
+ { SF3, fproc_dmp, "Filesystem process table" },
+ { SF4, dtab_dmp, "Device/Driver mapping" },
+ { SF5, mapping_dmp, "Print key mappings" },
+};
+
/*===========================================================================*
* handle_fkey *
*===========================================================================*/
PUBLIC int do_fkey_pressed(message *m)
{
- int s;
+ int s, h;
/* The notification message does not convey any information, other
* than that some function keys have been pressed. Ask TTY for details.
report("IS", "warning, sendrec to TTY failed", s);
/* Now check which keys were pressed: F1-F12. */
- if (pressed(F1)) proctab_dmp();
- if (pressed(F2)) memmap_dmp();
- if (pressed(F3)) image_dmp();
- if (pressed(F4)) privileges_dmp();
- if (pressed(F5)) monparams_dmp();
- if (pressed(F6)) irqtab_dmp();
- if (pressed(F7)) kmessages_dmp();
+ for(h = 0; h < NHOOKS; h++)
+ if(pressed(hooks[h].key))
+ hooks[h].function();
- if (pressed(F10)) kenv_dmp();
- if (pressed(F11)) timing_dmp();
- if (pressed(F12)) sched_dmp();
+ /* Inhibit sending a reply message. */
+ return(EDONTREPLY);
+}
- /* Also check Shift F1-F6 keys. */
- if (pressed(SF1)) mproc_dmp();
- if (pressed(SF2)) sigaction_dmp();
+PRIVATE char *keyname(int key)
+{
+ static char name[15];
- if (pressed(SF3)) fproc_dmp();
- if (pressed(SF4)) dtab_dmp();
+ if(key >= F1 && key <= F12)
+ sprintf(name, " F%d", key - F1 + 1);
+ else if(key >= SF1 && key <= SF12)
+ sprintf(name, "Shift+F%d", key - SF1 + 1);
+ else
+ sprintf(name, "?");
- /* Inhibit sending a reply message. */
- return(EDONTREPLY);
+ return name;
+}
+
+PUBLIC void mapping_dmp(void)
+{
+ int h;
+
+ printf(
+"Function key mappings for debug dumps in IS server.\n"
+" Key Description\n"
+"-------------------------------------------------------------------------\n");
+ for(h = 0; h < NHOOKS; h++)
+ printf(" %10s. %s\n", keyname(hooks[h].key), hooks[h].name);
+
+ printf("\n");
+
+ return;
}