make includes fix from trunk
[minix.git] / servers / is / dmp_ds.c
blob38cc18335c1e169c532fac7cac29e0156a10347c
1 #include "inc.h"
2 #include "../ds/store.h"
4 #define LINES 22
6 PRIVATE struct data_store ds_store[NR_DS_KEYS];
8 PUBLIC void data_store_dmp()
10 struct data_store *p;
11 static int prev_i = 0;
12 int r, i, n = 0;
14 if((r=getsysinfo(DS_PROC_NR, SI_DATA_STORE, ds_store)) != OK) {
15 printf("Couldn't talk to DS: %d.\n", r);
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_MAP:
38 printf("%-10s %9u/%3u\n", "MAP", p->u.map.length,
39 p->u.map.sindex);
40 break;
41 case DSF_TYPE_LABEL:
42 printf("%-10s %12u\n", "LABEL", p->u.u32);
43 break;
44 default:
45 return;
48 n++;
51 if (i >= NR_DS_KEYS) i = 0;
52 else printf("--more--\r");
53 prev_i = i;