Project

General

Profile

Statistics
| Branch: | Revision:

scoutos / prex-0.9.0 / include / sys / sysinfo.h @ 03e9c04a

History | View | Annotate | Download (4.57 KB)

1
/*
2
 * Copyright (c) 2007-2009, 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 _SYS_SYSINFO_H
31
#define _SYS_SYSINFO_H
32

    
33
#include <sys/param.h>
34
#include <sys/utsname.h>
35
#include <sys/capability.h>
36
#include <sys/device.h>
37

    
38
/*
39
 * Max size of info buffer.
40
 *
41
 * Please make sure MAXINFOSZ is still correct if you change
42
 * the information structure below.
43
 */
44
#define MAXINFOSZ        sizeof(struct kerninfo)
45

    
46
/*
47
 * Data type for sys_info()
48
 */
49
#define INFO_KERNEL        1
50
#define INFO_MEMORY        2
51
#define INFO_TIMER        3
52
#define INFO_THREAD        4
53
#define INFO_TASK        5
54
#define INFO_VM                6
55
#define INFO_DEVICE        7
56
#define INFO_IRQ        8
57

    
58
/*
59
 * Kernel information
60
 * Note: must be same with struct utsname.
61
 */
62
struct kerninfo {
63
        char        sysname[_SYS_NMLN];        /* name of this OS. */
64
        char        nodename[_SYS_NMLN];        /* name of this network node. */
65
        char        release[_SYS_NMLN];        /* release level. */
66
        char        version[_SYS_NMLN];        /* version level. */
67
        char        machine[_SYS_NMLN];        /* hardware type. */
68
};
69

    
70
/*
71
 * Memory information
72
 */
73
struct meminfo {
74
        psize_t                total;                /* total memory size in bytes */
75
        psize_t                free;                /* current free memory in bytes */
76
        psize_t                bootdisk;        /* total size of boot disk */
77
};
78

    
79
/*
80
 * Thread information
81
 */
82
struct threadinfo {
83
        u_long                cookie;                /* index cookie */
84
        thread_t        id;                /* thread id */
85
        int                state;                /* thread state */
86
        int                policy;                /* scheduling policy */
87
        int                priority;        /* current priority */
88
        int                basepri;        /* base priority */
89
        u_int                time;                /* total running time */
90
        int                suscnt;                /* suspend count */
91
        task_t                task;                /* task id */
92
        int                active;                /* true if active thread */
93
        char                taskname[MAXTASKNAME];        /* task name */
94
        char                slpevt[MAXEVTNAME];        /* sleep event */
95
};
96

    
97
/*
98
 * Task information
99
 */
100
struct taskinfo {
101
        u_long                cookie;                /* index cookie */
102
        task_t                id;                /* task id */
103
        int                flags;                /* task flags */
104
        int                suscnt;                /* suspend count */
105
        cap_t                capability;        /* security permission flag */
106
        size_t                vmsize;                /* used memory size */
107
        int                nthreads;        /* number of threads */
108
        int                active;                /* true if active task */
109
        char                taskname[MAXTASKNAME];        /* task name */
110
};
111

    
112
/*
113
 * VM information
114
 */
115
struct vminfo {
116
        u_long                cookie;                /* index cookie */
117
        task_t                task;                /* task id */
118
        vaddr_t                virt;                /* virtual address */
119
        size_t                size;                /* size */
120
        int                flags;                /* region flag */
121
        paddr_t                phys;                /* physical address */
122
};
123

    
124
/* Flags for vm */
125
#define VF_READ                0x00000001
126
#define VF_WRITE        0x00000002
127
#define VF_EXEC                0x00000004
128
#define VF_SHARED        0x00000008
129
#define VF_MAPPED        0x00000010
130
#define VF_FREE                0x00000080
131

    
132
/*
133
 * Device information
134
 */
135
struct devinfo {
136
        u_long                cookie;                /* index cookie */
137
        device_t        id;                /* device id */
138
        int                 flags;                /* device characteristics flags */
139
        char                 name[MAXDEVNAME]; /* device name */
140
};
141

    
142
/*
143
 * Timer informations
144
 */
145
struct timerinfo {
146
        int                hz;                /* clock frequency */
147
        u_long                cputicks;        /* total cpu ticks since boot */
148
        u_long                idleticks;        /* total idle ticks */
149
};
150

    
151
/*
152
 * IRQ information
153
 */
154
struct irqinfo {
155
        int                cookie;                /* index cookie */
156
        int                vector;                /* vector number */
157
        u_int                count;                /* interrupt count */
158
        int                priority;        /* interrupt priority */
159
        int                istreq;                /* pending ist request */
160
        thread_t        thread;                /* thread id of ist */
161
};
162

    
163
#endif /* !_SYS_SYSINFO_H */