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.
6 * The entry points into this file are
7 * map_unmap_fkeys: register or unregister function key maps with TTY
8 * do_fkey_pressed: handle a function key pressed notification
16 void (*function
)(void);
19 { F1
, proctab_dmp
, "Kernel process table" },
20 { F2
, memmap_dmp
, "Process memory maps" },
21 { F3
, image_dmp
, "System image" },
22 { F4
, privileges_dmp
, "Process privileges" },
23 { F5
, monparams_dmp
, "Boot monitor parameters" },
24 { F6
, irqtab_dmp
, "IRQ hooks and policies" },
25 { F7
, kmessages_dmp
, "Kernel messages" },
26 { F8
, vm_dmp
, "VM status and process maps" },
27 { F10
, kenv_dmp
, "Kernel parameters" },
28 { F11
, timing_dmp
, "Timing details (if enabled)" },
29 { SF1
, mproc_dmp
, "Process manager process table" },
30 { SF2
, sigaction_dmp
, "Signals" },
31 { SF3
, fproc_dmp
, "Filesystem process table" },
32 { SF4
, dtab_dmp
, "Device/Driver mapping" },
33 { SF5
, mapping_dmp
, "Print key mappings" },
34 { SF6
, rproc_dmp
, "Reincarnation server process table" },
35 { SF8
, data_store_dmp
, "Data store contents" },
36 { SF9
, procstack_dmp
, "Processes with stack traces" },
39 /* Define hooks for the debugging dumps. This table maps function keys
40 * onto a specific dump and provides a description for it.
42 #define NHOOKS (sizeof(hooks)/sizeof(hooks[0]))
44 /*===========================================================================*
46 *===========================================================================*/
47 PUBLIC
void map_unmap_fkeys(map
)
55 for (h
= 0; h
< NHOOKS
; h
++) {
56 if (hooks
[h
].key
>= F1
&& hooks
[h
].key
<= F12
)
57 bit_set(fkeys
, hooks
[h
].key
- F1
+ 1);
58 else if (hooks
[h
].key
>= SF1
&& hooks
[h
].key
<= SF12
)
59 bit_set(sfkeys
, hooks
[h
].key
- SF1
+ 1);
62 if (map
) s
= fkey_map(&fkeys
, &sfkeys
);
63 else s
= fkey_unmap(&fkeys
, &sfkeys
);
66 printf("IS: warning, fkey_ctl failed: %d\n", s
);
69 /*===========================================================================*
71 *===========================================================================*/
72 #define pressed(k) ((F1<=(k)&&(k)<=F12 && bit_isset(m->FKEY_FKEYS,((k)-F1+1)))\
73 || (SF1<=(k) && (k)<=SF12 && bit_isset(m->FKEY_SFKEYS, ((k)-SF1+1))))
74 PUBLIC
int do_fkey_pressed(m
)
75 message
*m
; /* notification message */
79 /* The notification message does not convey any information, other
80 * than that some function keys have been pressed. Ask TTY for details.
82 m
->m_type
= FKEY_CONTROL
;
83 m
->FKEY_REQUEST
= FKEY_EVENTS
;
84 if (OK
!= (s
=sendrec(TTY_PROC_NR
, m
)))
85 printf("IS: warning, sendrec to TTY failed: %d\n", s
);
87 /* Now check which keys were pressed: F1-F12, SF1-SF12. */
88 for(h
=0; h
< NHOOKS
; h
++)
89 if(pressed(hooks
[h
].key
))
92 /* Don't send a reply message. */
96 /*===========================================================================*
98 *===========================================================================*/
99 PRIVATE
char *key_name(int key
)
101 static char name
[15];
103 if(key
>= F1
&& key
<= F12
)
104 sprintf(name
, " F%d", key
- F1
+ 1);
105 else if(key
>= SF1
&& key
<= SF12
)
106 sprintf(name
, "Shift+F%d", key
- SF1
+ 1);
113 /*===========================================================================*
115 *===========================================================================*/
116 PUBLIC
void mapping_dmp(void)
120 printf("Function key mappings for debug dumps in IS server.\n");
121 printf(" Key Description\n");
122 printf("-------------------------------------");
123 printf("------------------------------------\n");
125 for(h
=0; h
< NHOOKS
; h
++)
126 printf(" %10s. %s\n", key_name(hooks
[h
].key
), hooks
[h
].name
);