Replace previous change by different test
[minix.git] / servers / is / dmp_ds.c
blob843a4163608cd0db0fa5ca864b1dcd7dc92c816a
1 #include "inc.h"
2 #include "../ds/store.h"
4 #define LINES 22
6 static struct data_store ds_store[NR_DS_KEYS];
8 void data_store_dmp()
10 struct data_store *p;
11 static int prev_i = 0;
12 int i, n = 0;
14 if (getsysinfo(DS_PROC_NR, SI_DATA_STORE, ds_store, sizeof(ds_store)) != OK) {
15 printf("Error obtaining table from DS. Perhaps recompile IS?\n");
16 return;
19 printf("Data store contents:\n");
20 printf("-slot- -----------key----------- -----owner----- ---type--- ----value---\n");
21 for(i = prev_i; i < NR_DS_KEYS && n < LINES; i++) {
22 p = &ds_store[i];
23 if(!(p->flags & DSF_IN_USE))
24 continue;
26 printf("%6d %-25s %-15s ", i, p->key, p->owner);
27 switch(p->flags & DSF_MASK_TYPE) {
28 case DSF_TYPE_U32:
29 printf("%-10s %12u\n", "U32", p->u.u32);
30 break;
31 case DSF_TYPE_STR:
32 printf("%-10s %12s\n", "STR", (char*) p->u.mem.data);
33 break;
34 case DSF_TYPE_MEM:
35 printf("%-10s %12u\n", "MEM", p->u.mem.length);
36 break;
37 case DSF_TYPE_LABEL:
38 printf("%-10s %12u\n", "LABEL", p->u.u32);
39 break;
40 default:
41 return;
44 n++;
47 if (i >= NR_DS_KEYS) i = 0;
48 else printf("--more--\r");
49 prev_i = i;