source: trunk/minix/servers/is/dmp_ds.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.3 KB
Line 
1/* This file contains procedures to dump DS data structures.
2 *
3 * The entry points into this file are
4 * data_store_dmp: display DS data store contents
5 *
6 * Created:
7 * Oct 18, 2005: by Jorrit N. Herder
8 */
9
10#include "inc.h"
11#include "../ds/store.h"
12
13PUBLIC struct data_store store[NR_DS_KEYS];
14
15FORWARD _PROTOTYPE( char *s_flags_str, (int flags) );
16
17/*===========================================================================*
18 * data_store_dmp *
19 *===========================================================================*/
20PUBLIC void data_store_dmp()
21{
22 struct data_store *dsp;
23 int i,j, n=0;
24 static int prev_i=0;
25
26
27 printf("Data Store (DS) contents dump\n");
28
29 getsysinfo(DS_PROC_NR, SI_DATA_STORE, store);
30
31 printf("-slot- -key- -flags- -val_l1- -val_l2-\n");
32
33 for (i=prev_i; i<NR_DS_KEYS; i++) {
34 dsp = &store[i];
35 if (! dsp->ds_flags & DS_IN_USE) continue;
36 if (++n > 22) break;
37 printf("%3d %8d %s [%8d] [%8d] \n",
38 i, dsp->ds_key,
39 s_flags_str(dsp->ds_flags),
40 dsp->ds_val_l1,
41 dsp->ds_val_l2
42 );
43 }
44 if (i >= NR_DS_KEYS) i = 0;
45 else printf("--more--\r");
46 prev_i = i;
47}
48
49
50PRIVATE char *s_flags_str(int flags)
51{
52 static char str[5];
53 str[0] = (flags & DS_IN_USE) ? 'U' : '-';
54 str[1] = (flags & DS_PUBLIC) ? 'P' : '-';
55 str[2] = '-';
56 str[3] = '\0';
57
58 return(str);
59}
60
Note: See TracBrowser for help on using the repository browser.