1 | /* |
2 | KSysGuard, the KDE System Guard |
3 | |
4 | Copyright (c) 2001 Tobias Koenig <tokoe@kde.org> |
5 | |
6 | This program is free software; you can redistribute it and/or |
7 | modify it under the terms of version 2 of the GNU General Public |
8 | License as published by the Free Software Foundation. |
9 | |
10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
18 | |
19 | */ |
20 | |
21 | /* TODO: Port to Win32 */ |
22 | |
23 | #ifndef KSG_MODULES_H |
24 | #define KSG_MODULES_H |
25 | |
26 | #include "config-ksysguardd.h" |
27 | #include "Command.h" |
28 | #include "conf.h" |
29 | #include "ksysguardd.h" |
30 | |
31 | #ifdef OSTYPE_Linux |
32 | #include "acpi.h" |
33 | #include "apm.h" |
34 | #include "cpuinfo.h" |
35 | #include "diskstat.h" |
36 | #include "diskstats.h" |
37 | #include "i8k.h" |
38 | #include "lmsensors.h" |
39 | #include "loadavg.h" |
40 | #include "logfile.h" |
41 | #include "Memory.h" |
42 | #include "netdev.h" |
43 | #include "netstat.h" |
44 | #include "ProcessList.h" |
45 | #include "stat.h" |
46 | #include "softraid.h" |
47 | #include "uptime.h" |
48 | #endif /* OSTYPE_Linux */ |
49 | |
50 | #if defined(OSTYPE_FreeBSD) || defined(OSTYPE_DragonFly) |
51 | #include <grp.h> |
52 | #include "acpi.h" |
53 | #ifdef __i386__ |
54 | #include "apm.h" |
55 | #endif |
56 | #include "cpuinfo.h" |
57 | #include "diskstat.h" |
58 | #include "loadavg.h" |
59 | #include "logfile.h" |
60 | #include "Memory.h" |
61 | #include "netdev.h" |
62 | #include "ProcessList.h" |
63 | #include "stat.h" |
64 | #include "uptime.h" |
65 | #endif /* OSTYPE_FreeBSD */ |
66 | |
67 | #ifdef OSTYPE_Irix |
68 | #include "cpu.h" |
69 | #include "LoadAvg.h" |
70 | #include "Memory.h" |
71 | #include "NetDev.h" |
72 | #include "ProcessList.h" |
73 | #endif /* OSTYPE_Irix */ |
74 | |
75 | #ifdef OSTYPE_NetBSD |
76 | #include <grp.h> |
77 | #ifdef __i386__ |
78 | #include "apm.h" |
79 | #endif |
80 | #include "CPU.h" |
81 | #include "diskstat.h" |
82 | #include "loadavg.h" |
83 | #include "logfile.h" |
84 | #include "Memory.h" |
85 | #include "netdev.h" |
86 | #include "ProcessList.h" |
87 | #endif /* OSTYPE_NetBSD */ |
88 | |
89 | #ifdef OSTYPE_OpenBSD |
90 | #include "cpu.h" |
91 | #include "memory.h" |
92 | #include "ProcessList.h" |
93 | #endif /* OSTYPE_OpenBSD */ |
94 | |
95 | #if defined(OSTYPE_Solaris) || defined(OSTYPE_SunOS) |
96 | #include "LoadAvg.h" |
97 | #include "Memory.h" |
98 | #include "NetDev.h" |
99 | #include "ProcessList.h" |
100 | #endif /* OSTYPE_Solaris */ |
101 | |
102 | #ifdef OSTYPE_Tru64 |
103 | #include "LoadAvg.h" |
104 | #include "Memory.h" |
105 | #include "NetDev.h" |
106 | #endif /* OSTYPE_Tru64 */ |
107 | |
108 | |
109 | typedef void (*VSFunc)( struct SensorModul* ); |
110 | #define NULLVSFUNC ((VSFunc) 0) |
111 | typedef void (*VVFunc)( void ); |
112 | #define NULLVVFUNC ((VVFunc) 0) |
113 | typedef int (*IVFunc)( void ); |
114 | #define NULLIVFUNC ((IVFunc) 0) |
115 | #define NULLTIME ((unsigned long long) 0) |
116 | |
117 | /* Here we state all the available "modules" for a system. |
118 | * 1. configName - Just a name that it associated with it |
119 | * 2. initCommand - The function that will be called once when ksysguardd is started |
120 | * 3. extiCommand - The function that will be called once when ksysguardd is closed, if it's closed nicely |
121 | * 4. updateCommand - The function that will be called when any of the functions for that module are called |
122 | * 5. checkCommand - The function that will be called periodically after 5 seconds, when any next command is issued |
123 | * 6. available - Used internally - set to 0 here |
124 | * 7. timeCentiSeconds - Used internally - set to NULLTIME here */ |
125 | struct SensorModul SensorModulList[] = { |
126 | #ifdef OSTYPE_Linux |
127 | { "Acpi" , initAcpi, exitAcpi, updateAcpi, NULLVVFUNC, 0, NULLTIME }, |
128 | { "Apm" , initApm, exitApm, updateApm, NULLVVFUNC, 0, NULLTIME }, |
129 | { "CpuInfo" , initCpuInfo, exitCpuInfo, updateCpuInfo, NULLVVFUNC, 0, NULLTIME }, |
130 | { "DellLaptop" , initI8k, exitI8k, updateI8k, NULLVVFUNC, 0, NULLTIME }, |
131 | { "DiskStat" , initDiskStat, exitDiskStat, updateDiskStat, checkDiskStat, 0, NULLTIME }, |
132 | { "DiskStats" , initDiskstats, exitDiskstats, updateDiskstats, NULLVVFUNC, 0, NULLTIME }, |
133 | #ifdef HAVE_LMSENSORS |
134 | { "LmSensors" , initLmSensors, exitLmSensors, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME }, |
135 | #endif |
136 | { "LoadAvg" , initLoadAvg, exitLoadAvg, updateLoadAvg, NULLVVFUNC, 0, NULLTIME }, |
137 | { "LogFile" , initLogFile, exitLogFile, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME }, |
138 | { "Memory" , initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME }, |
139 | { "NetDev" , initNetDev, exitNetDev, updateNetDev, checkNetDev, 0, NULLTIME }, |
140 | { "NetStat" , initNetStat, exitNetStat, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME }, |
141 | { "ProcessList" , initProcessList, exitProcessList, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME }, |
142 | { "Stat" , initStat, exitStat, updateStat, NULLVVFUNC, 0, NULLTIME }, |
143 | { "SoftRaid" , initSoftRaid, exitSoftRaid, updateSoftRaid, NULLVVFUNC, 0, NULLTIME }, |
144 | { "Uptime" , initUptime, exitUptime, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME }, |
145 | #endif /* OSTYPE_Linux */ |
146 | |
147 | #if defined OSTYPE_FreeBSD || defined OSTYPE_DragonFly |
148 | { "Acpi" , initACPI, exitACPI, updateACPI, NULLVVFUNC, 0, NULLTIME }, |
149 | #ifdef __i386__ |
150 | { "Apm" , initApm, exitApm, updateApm, NULLVVFUNC, 0, NULLTIME }, |
151 | #endif |
152 | { "CpuInfo" , initCpuInfo, exitCpuInfo, updateCpuInfo, NULLVVFUNC, 0, NULLTIME }, |
153 | { "DiskStat" , initDiskStat, exitDiskStat, updateDiskStat, checkDiskStat, 0, NULLTIME }, |
154 | { "LoadAvg" , initLoadAvg, exitLoadAvg, updateLoadAvg, NULLVVFUNC, 0, NULLTIME }, |
155 | { "LogFile" , initLogFile, exitLogFile, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME }, |
156 | { "Memory" , initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME }, |
157 | { "NetDev" , initNetDev, exitNetDev, updateNetDev, checkNetDev, 0, NULLTIME }, |
158 | { "ProcessList" , initProcessList, exitProcessList, updateProcessList, NULLVVFUNC, 0, NULLTIME }, |
159 | { "Stat" , initStat, exitStat, updateStat, NULLVVFUNC, 0, NULLTIME }, |
160 | { "Uptime" , initUptime, exitUptime, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME }, |
161 | #endif /* OSTYPE_FreeBSD */ |
162 | |
163 | #ifdef OSTYPE_Irix |
164 | { "CpuInfo" , initCpuInfo, exitCpuInfo, updateCpuInfo, NULLVVFUNC, 0, NULLTIME }, |
165 | { "LoadAvg" , initLoadAvg, exitLoadAvg, updateLoadAvg, NULLVVFUNC, 0, NULLTIME }, |
166 | { "Memory" , initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME }, |
167 | { "NetDev" , initNetDev, exitNetDev, updateNetDev, NULLVVFUNC, 0, NULLTIME }, |
168 | { "ProcessList" , initProcessList, exitProcessList, updateProcessList, NULLVVFUNC, 0, NULLTIME }, |
169 | #endif /* OSTYPE_Irix */ |
170 | |
171 | #ifdef OSTYPE_NetBSD |
172 | #ifdef __i386__ |
173 | { "Apm" , initApm, exitApm, updateApm, NULLVVFUNC, 0, NULLTIME }, |
174 | #endif |
175 | { "CpuInfo" , initCpuInfo, exitCpuInfo, updateCpuInfo, NULLVVFUNC, 0, NULLTIME }, |
176 | { "DiskStat" , initDiskStat, exitDiskStat, updateDiskStat, checkDiskStat, 0, NULLTIME }, |
177 | { "LoadAvg" , initLoadAvg, exitLoadAvg, updateLoadAvg, NULLVVFUNC, 0, NULLTIME }, |
178 | { "LogFile" , initLogFile, exitLogFile, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME }, |
179 | { "Memory" , initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME }, |
180 | { "NetDev" , initNetDev, exitNetDev, updateNetDev, checkNetDev, 0, NULLTIME }, |
181 | { "ProcessList" , initProcessList, exitProcessList, updateProcessList, NULLVVFUNC, 0, NULLTIME }, |
182 | #endif /* OSTYPE_NetBSD */ |
183 | |
184 | #ifdef OSTYPE_OpenBSD |
185 | { "CpuInfo" , initCpuInfo, exitCpuInfo, updateCpuInfo, NULLVVFUNC, 0, NULLTIME }, |
186 | { "Memory" , initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME }, |
187 | { "ProcessList" , initProcessList, exitProcessList, updateProcessList, NULLVVFUNC, 0, NULLTIME }, |
188 | #endif /* OSTYPE_OpenBSD */ |
189 | |
190 | #if defined(OSTYPE_Solaris) || defined(OSTYPE_SunOS) |
191 | { "LoadAvg" , initLoadAvg, exitLoadAvg, updateLoadAvg, NULLVVFUNC, 0, NULLTIME }, |
192 | { "Memory" , initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME }, |
193 | { "NetDev" , initNetDev, exitNetDev, updateNetDev, NULLVVFUNC, 0, NULLTIME }, |
194 | { "ProcessList" , initProcessList, exitProcessList, updateProcessList, NULLVVFUNC, 0, NULLTIME }, |
195 | #endif /* OSTYPE_Solaris */ |
196 | |
197 | #ifdef OSTYPE_Tru64 |
198 | { "LoadAvg" , initLoadAvg, exitLoadAvg, updateLoadAvg, NULLVVFUNC, 0, NULLTIME }, |
199 | { "Memory" , initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME }, |
200 | { "NetDev" , initNetDev, exitNetDev, updateNetDev, NULLVVFUNC, 0, NULLTIME }, |
201 | #endif /* OSTYPE_Tru64 */ |
202 | |
203 | |
204 | |
205 | { NULL, NULLVSFUNC, NULLVVFUNC, NULLIVFUNC, NULLVVFUNC, 0, NULLTIME } |
206 | }; |
207 | |
208 | #endif |
209 | |