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