[9] | 1 | /* This file contains information dump procedures. During the initialization
|
---|
| 2 | * of the Information Service 'known' function keys are registered at the TTY
|
---|
| 3 | * server in order to receive a notification if one is pressed. Here, the
|
---|
| 4 | * corresponding dump procedure is called.
|
---|
| 5 | *
|
---|
| 6 | * The entry points into this file are
|
---|
| 7 | * handle_fkey: handle a function key pressed notification
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #include "inc.h"
|
---|
| 11 |
|
---|
| 12 | /* Define hooks for the debugging dumps. This table maps function keys
|
---|
| 13 | * onto a specific dump and provides a description for it.
|
---|
| 14 | */
|
---|
| 15 | #define NHOOKS 18
|
---|
| 16 |
|
---|
| 17 | struct hook_entry {
|
---|
| 18 | int key;
|
---|
| 19 | void (*function)(void);
|
---|
| 20 | char *name;
|
---|
| 21 | } hooks[NHOOKS] = {
|
---|
| 22 | { F1, proctab_dmp, "Kernel process table" },
|
---|
| 23 | { F2, memmap_dmp, "Process memory maps" },
|
---|
| 24 | { F3, image_dmp, "System image" },
|
---|
| 25 | { F4, privileges_dmp, "Process privileges" },
|
---|
| 26 | { F5, monparams_dmp, "Boot monitor parameters" },
|
---|
| 27 | { F6, irqtab_dmp, "IRQ hooks and policies" },
|
---|
| 28 | { F7, kmessages_dmp, "Kernel messages" },
|
---|
| 29 | { F9, sched_dmp, "Scheduling queues" },
|
---|
| 30 | { F10, kenv_dmp, "Kernel parameters" },
|
---|
| 31 | { F11, timing_dmp, "Timing details (if enabled)" },
|
---|
| 32 | { SF1, mproc_dmp, "Process manager process table" },
|
---|
| 33 | { SF2, sigaction_dmp, "Signals" },
|
---|
| 34 | { SF3, fproc_dmp, "Filesystem process table" },
|
---|
| 35 | { SF4, dtab_dmp, "Device/Driver mapping" },
|
---|
| 36 | { SF5, mapping_dmp, "Print key mappings" },
|
---|
| 37 | { SF6, rproc_dmp, "Reincarnation server process table" },
|
---|
| 38 | { SF7, holes_dmp, "Memory free list" },
|
---|
| 39 | { SF8, data_store_dmp, "Data store contents" },
|
---|
| 40 | };
|
---|
| 41 |
|
---|
| 42 | /*===========================================================================*
|
---|
| 43 | * handle_fkey *
|
---|
| 44 | *===========================================================================*/
|
---|
| 45 | #define pressed(k) ((F1<=(k)&&(k)<=F12 && bit_isset(m->FKEY_FKEYS,((k)-F1+1)))\
|
---|
| 46 | || (SF1<=(k) && (k)<=SF12 && bit_isset(m->FKEY_SFKEYS, ((k)-SF1+1))))
|
---|
| 47 | PUBLIC int do_fkey_pressed(m)
|
---|
| 48 | message *m; /* notification message */
|
---|
| 49 | {
|
---|
| 50 | int s, h;
|
---|
| 51 |
|
---|
| 52 | /* The notification message does not convey any information, other
|
---|
| 53 | * than that some function keys have been pressed. Ask TTY for details.
|
---|
| 54 | */
|
---|
| 55 | m->m_type = FKEY_CONTROL;
|
---|
| 56 | m->FKEY_REQUEST = FKEY_EVENTS;
|
---|
| 57 | if (OK != (s=sendrec(TTY_PROC_NR, m)))
|
---|
| 58 | report("IS", "warning, sendrec to TTY failed", s);
|
---|
| 59 |
|
---|
| 60 | /* Now check which keys were pressed: F1-F12, SF1-SF12. */
|
---|
| 61 | for(h=0; h < NHOOKS; h++)
|
---|
| 62 | if(pressed(hooks[h].key))
|
---|
| 63 | hooks[h].function();
|
---|
| 64 |
|
---|
| 65 | /* Don't send a reply message. */
|
---|
| 66 | return(EDONTREPLY);
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | /*===========================================================================*
|
---|
| 70 | * key_name *
|
---|
| 71 | *===========================================================================*/
|
---|
| 72 | PRIVATE char *key_name(int key)
|
---|
| 73 | {
|
---|
| 74 | static char name[15];
|
---|
| 75 |
|
---|
| 76 | if(key >= F1 && key <= F12)
|
---|
| 77 | sprintf(name, " F%d", key - F1 + 1);
|
---|
| 78 | else if(key >= SF1 && key <= SF12)
|
---|
| 79 | sprintf(name, "Shift+F%d", key - SF1 + 1);
|
---|
| 80 | else
|
---|
| 81 | sprintf(name, "?");
|
---|
| 82 | return name;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 |
|
---|
| 86 | /*===========================================================================*
|
---|
| 87 | * mapping_dmp *
|
---|
| 88 | *===========================================================================*/
|
---|
| 89 | PUBLIC void mapping_dmp(void)
|
---|
| 90 | {
|
---|
| 91 | int h;
|
---|
| 92 |
|
---|
| 93 | printf("Function key mappings for debug dumps in IS server.\n");
|
---|
| 94 | printf(" Key Description\n");
|
---|
| 95 | printf("-------------------------------------");
|
---|
| 96 | printf("------------------------------------\n");
|
---|
| 97 |
|
---|
| 98 | for(h=0; h < NHOOKS; h++)
|
---|
| 99 | printf(" %10s. %s\n", key_name(hooks[h].key), hooks[h].name);
|
---|
| 100 | printf("\n");
|
---|
| 101 | }
|
---|
| 102 |
|
---|