explicitly mask byte i/o values to bytes.
[minix3.git] / servers / is / dmp_ds.c
blob27b337eb3db72b9c45a538a5c8e13b6881ae6cb2
1 /* This file contains procedures to dump DS data structures.
3 * The entry points into this file are
4 * data_store_dmp: display DS data store contents
6 * Created:
7 * Oct 18, 2005: by Jorrit N. Herder
8 */
10 #include "inc.h"
11 #include "../ds/store.h"
13 PUBLIC struct data_store store[NR_DS_KEYS];
15 FORWARD _PROTOTYPE( char *s_flags_str, (int flags) );
17 /*===========================================================================*
18 * data_store_dmp *
19 *===========================================================================*/
20 PUBLIC void data_store_dmp()
22 struct data_store *dsp;
23 int i,j, n=0, s;
24 static int prev_i=0;
27 printf("Data Store (DS) contents dump\n");
29 if((s=getsysinfo(DS_PROC_NR, SI_DATA_STORE, store)) != OK) {
30 printf("Couldn't talk to DS: %d.\n", s);
31 return;
34 printf("slot key type value\n");
36 for (i=prev_i; i<NR_DS_KEYS; i++) {
37 dsp = &store[i];
38 if (! dsp->ds_flags & DS_IN_USE) continue;
39 if (++n > 22) break;
40 printf("%3d %-20s ",
41 i, dsp->ds_key);
42 if(dsp->ds_flags & DS_TYPE_U32) {
43 printf("u32 %lu\n", dsp->ds_val.ds_val_u32);
44 } else if(dsp->ds_flags & DS_TYPE_STR) {
45 printf("str \"%s\"\n", dsp->ds_val.ds_val_str);
46 } else {
47 printf("Bogus type\n");
50 if (i >= NR_DS_KEYS) i = 0;
51 else printf("--more--\r");
52 prev_i = i;
56 PRIVATE char *s_flags_str(int flags)
58 static char str[5];
59 str[0] = (flags & DS_IN_USE) ? 'U' : '-';
60 str[1] = (flags & DS_PUBLIC) ? 'P' : '-';
61 str[2] = '-';
62 str[3] = '\0';
64 return(str);