Annotation of prex-old/include/prex/sysinfo.h, Revision 1.1.1.1
1.1 nbrk 1: /*
2: * Copyright (c) 2007, Kohsuke Ohtani
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: * 3. Neither the name of the author nor the names of any co-contributors
14: * may be used to endorse or promote products derived from this software
15: * without specific prior written permission.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27: * SUCH DAMAGE.
28: */
29:
30: #ifndef _PREX_SYSINFO_H
31: #define _PREX_SYSINFO_H
32:
33: /*
34: * Data type for sys_info()
35: */
36: #define INFO_KERNEL 1
37: #define INFO_MEMORY 2
38: #define INFO_THREAD 3
39: #define INFO_DEVICE 4
40: #define INFO_TIMER 5
41:
42: #define _KSTRLN 12
43:
44: struct info_kernel {
45: char sysname[_KSTRLN]; /* Kernel name */
46: char version[_KSTRLN]; /* Version level */
47: char blddate[_KSTRLN]; /* Build date */
48: char machine[_KSTRLN]; /* Architecture/platform */
49: char hostname[_KSTRLN]; /* Host name */
50: };
51:
52: /*
53: * Memory information
54: */
55: struct info_memory {
56: size_t total; /* total memory size in bytes */
57: size_t free; /* current free memory size in bytes */
58: size_t kernel; /* memory size used by kernel in bytes */
59: };
60:
61: /*
62: * Thread information
63: */
64: struct info_thread {
65: u_long cookie; /* index cookie - 0 for first thread */
66: int state; /* thread state */
67: int policy; /* scheduling policy */
68: int prio; /* current priority */
69: int base_prio; /* base priority */
70: int suspend_count; /* suspend counter */
71: u_int total_ticks; /* total running ticks */
72: thread_t id; /* thread id */
73: task_t task; /* task id */
74: char task_name[MAXTASKNAME]; /* task name */
75: char sleep_event[MAXEVTNAME]; /* sleep event */
76: };
77:
78: #ifndef KERNEL
79: /* Thread state */
80: #define TH_RUN 0x00 /* running or ready to run */
81: #define TH_SLEEP 0x01 /* sleep for events */
82: #define TH_SUSPEND 0x02 /* suspend count is not 0 */
83: #define TH_EXIT 0x04 /* terminated */
84: #endif
85:
86: /*
87: * Device information
88: */
89: struct info_device {
90: u_long cookie; /* index cookie - 0 for first thread */
91: device_t id; /* device id */
92: int flags; /* device characteristics flags */
93: char name[MAXDEVNAME];
94: };
95:
96: /*
97: * Device flags
98: */
99: #define DF_CHR 0x00000001 /* character device */
100: #define DF_BLK 0x00000002 /* block device */
101: #define DF_RDONLY 0x00000004 /* read only device */
102: #define DF_REM 0x00000008 /* removable device */
103:
104: /*
105: * Timer informations
106: */
107: struct info_timer {
108: int hz; /* clock frequency */
109: };
110:
111: #endif /* !_PREX_SYSINFO_H */
CVSweb