From: Jorrit Herder Date: Thu, 20 Oct 2005 20:28:54 +0000 (+0000) Subject: New dumps for RS and DS server. X-Git-Tag: v3.1.2a~595 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/rndc-confgen.html?a=commitdiff_plain;h=288860f6e6fd9a833730dcb60a127469f3ab7c03;p=minix.git New dumps for RS and DS server. --- diff --git a/servers/is/Makefile b/servers/is/Makefile index dc519f0f0..56f81bfb9 100644 --- a/servers/is/Makefile +++ b/servers/is/Makefile @@ -17,7 +17,7 @@ CFLAGS = -I$i LDFLAGS = -i LIBS = -lsys -lsysutil -OBJ = is.o dmp.o dmp_kernel.o dmp_pm.o dmp_fs.o dmp_rs.o +OBJ = main.o dmp.o dmp_kernel.o dmp_pm.o dmp_fs.o dmp_rs.o dmp_ds.o # build local binary all build: $(SERVER) diff --git a/servers/is/dmp.c b/servers/is/dmp.c index 5fe7cdd7c..bd2a256d9 100644 --- a/servers/is/dmp.c +++ b/servers/is/dmp.c @@ -7,9 +7,12 @@ * handle_fkey: handle a function key pressed notification */ -#include "is.h" +#include "inc.h" -#define NHOOKS 18 +/* Define hooks for the debugging dumps. This table maps function keys + * onto a specific dump and provides a description for it. + */ +#define NHOOKS 19 struct hook_entry { int key; @@ -34,15 +37,16 @@ struct hook_entry { { SF5, mapping_dmp, "Print key mappings" }, { SF6, rproc_dmp, "Reincarnation server process table" }, { SF7, holes_dmp, "Memory free list" }, + { SF8, data_store_dmp, "Data store contents" }, }; /*===========================================================================* * handle_fkey * *===========================================================================*/ -#define pressed(k) ((F1<=(k) && (k)<=F12 && bit_isset(m->FKEY_FKEYS, ((k)-F1+1))) \ +#define pressed(k) ((F1<=(k)&&(k)<=F12 && bit_isset(m->FKEY_FKEYS,((k)-F1+1)))\ || (SF1<=(k) && (k)<=SF12 && bit_isset(m->FKEY_SFKEYS, ((k)-SF1+1)))) - -PUBLIC int do_fkey_pressed(message *m) +PUBLIC int do_fkey_pressed(m) +message *m; /* notification message */ { int s, h; @@ -55,15 +59,18 @@ PUBLIC int do_fkey_pressed(message *m) report("IS", "warning, sendrec to TTY failed", s); /* Now check which keys were pressed: F1-F12, SF1-SF12. */ - for(h = 0; h < NHOOKS; h++) - if(pressed(hooks[h].key)) - hooks[h].function(); + for(h=0; h < NHOOKS; h++) + if(pressed(hooks[h].key)) + hooks[h].function(); - /* Inhibit sending a reply message. */ + /* Don't send a reply message. */ return(EDONTREPLY); } -PRIVATE char *keyname(int key) +/*===========================================================================* + * key_name * + *===========================================================================*/ +PRIVATE char *key_name(int key) { static char name[15]; @@ -73,30 +80,32 @@ PRIVATE char *keyname(int key) sprintf(name, "Shift+F%d", key - SF1 + 1); else sprintf(name, "?"); - return name; } - +/*===========================================================================* + * reboot_dmp * + *===========================================================================*/ PUBLIC void reboot_dmp(void) { if (sys_panic) sys_abort(RBT_HALT); } +/*===========================================================================* + * mapping_dmp * + *===========================================================================*/ 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); + int h; - printf("\n"); + printf("Function key mappings for debug dumps in IS server.\n"); + printf(" Key Description\n"); + printf("-------------------------------------"); + printf("------------------------------------\n"); - return; + for(h=0; h < NHOOKS; h++) + printf(" %10s. %s\n", key_name(hooks[h].key), hooks[h].name); + printf("\n"); } diff --git a/servers/is/dmp_ds.c b/servers/is/dmp_ds.c new file mode 100644 index 000000000..4de838537 --- /dev/null +++ b/servers/is/dmp_ds.c @@ -0,0 +1,60 @@ +/* This file contains procedures to dump DS data structures. + * + * The entry points into this file are + * data_store_dmp: display DS data store contents + * + * Created: + * Oct 18, 2005: by Jorrit N. Herder + */ + +#include "inc.h" +#include "../ds/store.h" + +PUBLIC struct data_store store[NR_DS_KEYS]; + +FORWARD _PROTOTYPE( char *s_flags_str, (int flags) ); + +/*===========================================================================* + * data_store_dmp * + *===========================================================================*/ +PUBLIC void data_store_dmp() +{ + struct data_store *dsp; + int i,j, n=0; + static int prev_i=0; + + + printf("Data Store (DS) contents dump\n"); + + getsysinfo(DS_PROC_NR, SI_DATA_STORE, store); + + printf("-slot- -key- -flags- -val_l1- -val_l2-\n"); + + for (i=prev_i; ids_flags & DS_IN_USE) continue; + if (++n > 22) break; + printf("%3d %8d %s [%8d] [%8d] \n", + i, dsp->ds_key, + s_flags_str(dsp->ds_flags), + dsp->ds_val_l1, + dsp->ds_val_l2 + ); + } + if (i >= NR_DS_KEYS) i = 0; + else printf("--more--\r"); + prev_i = i; +} + + +PRIVATE char *s_flags_str(int flags) +{ + static char str[5]; + str[0] = (flags & DS_IN_USE) ? 'U' : '-'; + str[1] = (flags & DS_PUBLIC) ? 'P' : '-'; + str[2] = '-'; + str[3] = '\0'; + + return(str); +} + diff --git a/servers/is/dmp_fs.c b/servers/is/dmp_fs.c index 01946537d..d4452ac2e 100644 --- a/servers/is/dmp_fs.c +++ b/servers/is/dmp_fs.c @@ -8,7 +8,7 @@ * Oct 01, 2004: by Jorrit N. Herder */ -#include "is.h" +#include "inc.h" #include "../fs/const.h" #include "../fs/fproc.h" #include diff --git a/servers/is/dmp_kernel.c b/servers/is/dmp_kernel.c index 861034a42..6b564d686 100644 --- a/servers/is/dmp_kernel.c +++ b/servers/is/dmp_kernel.c @@ -1,6 +1,6 @@ /* Debugging dump procedures for the kernel. */ -#include "is.h" +#include "inc.h" #include #include #include "../../kernel/const.h" @@ -289,7 +289,8 @@ PUBLIC void kenv_dmp() printf("- kmem_size: %5u\n", kinfo.kmem_size); printf("- bootdev_base: %5u\n", kinfo.bootdev_base); printf("- bootdev_size: %5u\n", kinfo.bootdev_size); - printf("- bootdev_mem: %5u\n", kinfo.bootdev_mem); + printf("- ramdev_base: %5u\n", kinfo.ramdev_base); + printf("- ramdev_size: %5u\n", kinfo.ramdev_size); printf("- params_base: %5u\n", kinfo.params_base); printf("- params_size: %5u\n", kinfo.params_size); printf("- nr_procs: %3u\n", kinfo.nr_procs); diff --git a/servers/is/dmp_pm.c b/servers/is/dmp_pm.c index 9fd3b7f2f..c6441c788 100644 --- a/servers/is/dmp_pm.c +++ b/servers/is/dmp_pm.c @@ -7,7 +7,7 @@ * May 11, 2005: by Jorrit N. Herder */ -#include "is.h" +#include "inc.h" #include "../pm/mproc.h" #include #include diff --git a/servers/is/dmp_rs.c b/servers/is/dmp_rs.c index c9726440b..4fd82ef08 100644 --- a/servers/is/dmp_rs.c +++ b/servers/is/dmp_rs.c @@ -7,8 +7,8 @@ * Oct 03, 2005: by Jorrit N. Herder */ -#include "is.h" -#include "../rs/rproc.h" +#include "inc.h" +#include "../rs/manager.h" PUBLIC struct rproc rproc[NR_SYS_PROCS]; @@ -26,18 +26,18 @@ PUBLIC void rproc_dmp() getsysinfo(RS_PROC_NR, SI_PROC_TAB, rproc); printf("Reincarnation Server (RS) system process table dump\n"); - printf("-proc nr-pid- -dev nr/ style- -ticks-checked-alive-- --flags-- -command (argc)-\n"); + printf("-proc-pid-flag--dev- -T--checked--alive- -starts-backoff- -command (argc)-\n"); for (i=prev_i; ir_flags & IN_USE) continue; + if (! rp->r_flags & RS_IN_USE) continue; if (++n > 22) break; - printf("%3d %5d %3d/%2d %3u %8u %8u %s %s (%d)", + printf("%3d %5d %s %3d/%2d %3u %8u %8u %3dx %3d %s (%d)", rp->r_proc_nr, rp->r_pid, + s_flags_str(rp->r_flags), rp->r_dev_nr, rp->r_dev_style, rp->r_period, - rp->r_check_tm, - rp->r_alive_tm, - s_flags_str(rp->r_flags), + rp->r_check_tm, rp->r_alive_tm, + rp->r_restarts, rp->r_backoff, rp->r_cmd, rp->r_argc ); @@ -52,8 +52,8 @@ PUBLIC void rproc_dmp() PRIVATE char *s_flags_str(int flags) { static char str[5]; - str[0] = (flags & IN_USE) ? 'U' : '-'; - str[1] = (flags & EXIT_PENDING) ? 'E' : '-'; + str[0] = (flags & RS_IN_USE) ? 'U' : '-'; + str[1] = (flags & RS_EXITING) ? 'E' : '-'; str[2] = '-'; str[3] = '\0'; diff --git a/servers/is/is.c b/servers/is/main.c similarity index 97% rename from servers/is/is.c rename to servers/is/main.c index e65d54c00..813355532 100644 --- a/servers/is/is.c +++ b/servers/is/main.c @@ -7,7 +7,7 @@ * Apr 29, 2004 by Jorrit N. Herder */ -#include "is.h" +#include "inc.h" /* Set debugging level to 0, 1, or 2 to see no, some, all debug output. */ #define DEBUG_LEVEL 1 @@ -64,6 +64,9 @@ PUBLIC int main(int argc, char **argv) case FKEY_PRESSED: result = do_fkey_pressed(&m_in); break; + case DEV_PING: + notify(m_in.m_source); + continue; default: report("IS","warning, got illegal request from:", m_in.m_source); result = EINVAL; @@ -97,7 +100,7 @@ PRIVATE void init_server(int argc, char **argv) /* Set key mappings. IS takes all of F1-F12 and Shift+F1-F6. */ fkeys = sfkeys = 0; for (i=1; i<=12; i++) bit_set(fkeys, i); - for (i=1; i<= 7; i++) bit_set(sfkeys, i); + for (i=1; i<= 8; i++) bit_set(sfkeys, i); if ((s=fkey_map(&fkeys, &sfkeys)) != OK) report("IS", "warning, fkey_map failed:", s); } diff --git a/servers/is/proto.h b/servers/is/proto.h index a464a4b68..42767821f 100644 --- a/servers/is/proto.h +++ b/servers/is/proto.h @@ -32,3 +32,6 @@ _PROTOTYPE( void fproc_dmp, (void) ); /* dmp_rs.c */ _PROTOTYPE( void rproc_dmp, (void) ); + +/* dmp_ds.c */ +_PROTOTYPE( void data_store_dmp, (void) );