csigar 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/NOTICE +117 -0
  4. data/README +8 -0
  5. data/Rakefile +105 -0
  6. data/bindings/SigarBuild.pm +301 -0
  7. data/bindings/SigarWrapper.pm +2978 -0
  8. data/bindings/ruby/examples/arp.rb +24 -0
  9. data/bindings/ruby/examples/cpu_info.rb +35 -0
  10. data/bindings/ruby/examples/df.rb +49 -0
  11. data/bindings/ruby/examples/free.rb +36 -0
  12. data/bindings/ruby/examples/ifconfig.rb +101 -0
  13. data/bindings/ruby/examples/logging.rb +58 -0
  14. data/bindings/ruby/examples/net_info.rb +31 -0
  15. data/bindings/ruby/examples/netstat.rb +71 -0
  16. data/bindings/ruby/examples/pargs.rb +35 -0
  17. data/bindings/ruby/examples/penv.rb +31 -0
  18. data/bindings/ruby/examples/route.rb +48 -0
  19. data/bindings/ruby/examples/version.rb +40 -0
  20. data/bindings/ruby/examples/who.rb +30 -0
  21. data/bindings/ruby/extconf.rb +131 -0
  22. data/bindings/ruby/rbsigar.c +938 -0
  23. data/bindings/ruby/test/cpu_test.rb +40 -0
  24. data/bindings/ruby/test/file_system_test.rb +43 -0
  25. data/bindings/ruby/test/helper.rb +57 -0
  26. data/bindings/ruby/test/loadavg_test.rb +30 -0
  27. data/bindings/ruby/test/mem_test.rb +45 -0
  28. data/bindings/ruby/test/swap_test.rb +36 -0
  29. data/bindings/ruby/test/uptime_test.rb +26 -0
  30. data/include/sigar.h +943 -0
  31. data/include/sigar_fileinfo.h +157 -0
  32. data/include/sigar_format.h +65 -0
  33. data/include/sigar_getline.h +18 -0
  34. data/include/sigar_log.h +80 -0
  35. data/include/sigar_private.h +422 -0
  36. data/include/sigar_ptql.h +53 -0
  37. data/include/sigar_util.h +191 -0
  38. data/src/os/aix/aix_sigar.c +2151 -0
  39. data/src/os/aix/sigar_os.h +73 -0
  40. data/src/os/darwin/Info.plist.in +27 -0
  41. data/src/os/darwin/darwin_sigar.c +3711 -0
  42. data/src/os/darwin/sigar_os.h +80 -0
  43. data/src/os/hpux/hpux_sigar.c +1342 -0
  44. data/src/os/hpux/sigar_os.h +49 -0
  45. data/src/os/linux/linux_sigar.c +2782 -0
  46. data/src/os/linux/sigar_os.h +82 -0
  47. data/src/os/solaris/get_mib2.c +321 -0
  48. data/src/os/solaris/get_mib2.h +127 -0
  49. data/src/os/solaris/kstats.c +181 -0
  50. data/src/os/solaris/procfs.c +97 -0
  51. data/src/os/solaris/sigar_os.h +224 -0
  52. data/src/os/solaris/solaris_sigar.c +2717 -0
  53. data/src/os/win32/peb.c +212 -0
  54. data/src/os/win32/sigar.rc.in +40 -0
  55. data/src/os/win32/sigar_os.h +676 -0
  56. data/src/os/win32/sigar_pdh.h +47 -0
  57. data/src/os/win32/win32_sigar.c +3992 -0
  58. data/src/sigar.c +2428 -0
  59. data/src/sigar_cache.c +179 -0
  60. data/src/sigar_fileinfo.c +815 -0
  61. data/src/sigar_format.c +696 -0
  62. data/src/sigar_getline.c +1849 -0
  63. data/src/sigar_ptql.c +1967 -0
  64. data/src/sigar_signal.c +216 -0
  65. data/src/sigar_util.c +1060 -0
  66. data/src/sigar_version.c.in +22 -0
  67. data/src/sigar_version_autoconf.c.in +22 -0
  68. data/version.properties +11 -0
  69. metadata +112 -0
@@ -0,0 +1,40 @@
1
+ #
2
+ # Copyright (c) 2009 VMware, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ $LOAD_PATH.unshift File.dirname(__FILE__)
18
+ require 'helper'
19
+
20
+ class CpuTest < Test::Unit::TestCase
21
+ def check_cpu(cpu)
22
+ assert_gt_eq_zero cpu.user, "user"
23
+ assert_gt_eq_zero cpu.sys, "sys"
24
+ assert_gt_eq_zero cpu.idle, "idle"
25
+ assert_gt_eq_zero cpu.wait, "wait"
26
+ assert_gt_eq_zero cpu.irq, "irq"
27
+ assert_gt_eq_zero cpu.soft_irq, "soft_irq"
28
+ assert_gt_eq_zero cpu.stolen, "stolen"
29
+ assert_gt_zero cpu.total, "total"
30
+ end
31
+
32
+ def test_cpu
33
+ sigar = Sigar.new
34
+ check_cpu sigar.cpu
35
+
36
+ sigar.cpu_list.each do |cpu|
37
+ check_cpu cpu
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,43 @@
1
+ #
2
+ # Copyright (c) 2009 VMware, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ $LOAD_PATH.unshift File.dirname(__FILE__)
18
+ require 'helper'
19
+
20
+ class FileSystemTest < Test::Unit::TestCase
21
+
22
+ def test_file_system
23
+ sigar = Sigar.new
24
+ sigar.file_system_list.each do |fs|
25
+ assert_length fs.dev_name, "dev_name"
26
+ assert_length fs.dir_name, "dir_name"
27
+ assert_length fs.type_name, "type_name"
28
+ assert_length fs.sys_type_name, "sys_type_name"
29
+ assert fs.options.length >= 0, "options"
30
+
31
+ begin
32
+ usage = sigar.file_system_usage fs.dir_name
33
+ rescue => err
34
+ if fs.type == Sigar::FSTYPE_LOCAL_DISK
35
+ raise err
36
+ end
37
+ # else ok, e.g. floppy drive on windows
38
+ next
39
+ end
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,57 @@
1
+ #
2
+ # Copyright (c) 2009-2010 VMware, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'test/unit'
18
+ require 'sigar'
19
+
20
+ module Test::Unit::Assertions
21
+ def assert_gt_eq_zero(value, message)
22
+ message = build_message message, '<?> is not >= 0.', value
23
+ assert_block message do
24
+ value >= 0
25
+ end
26
+ end
27
+
28
+ def assert_gt_zero(value, message)
29
+ message = build_message message, '<?> is not > 0.', value
30
+ assert_block message do
31
+ value > 0
32
+ end
33
+ end
34
+
35
+ def assert_eq(expected, actual, message)
36
+ message = build_message message, '<?> != <?>.', expected, actual
37
+ assert_block message do
38
+ expected == actual
39
+ end
40
+ end
41
+
42
+ def assert_length(value, message)
43
+ message = build_message message, '<?>.length > 0.', value
44
+ assert_block message do
45
+ value.length > 0
46
+ end
47
+ end
48
+
49
+ def assert_any(value, message)
50
+ message = build_message message, '<?> is anything.', value
51
+ assert_block message do
52
+ true
53
+ end
54
+ end
55
+
56
+ end
57
+
@@ -0,0 +1,30 @@
1
+ #
2
+ # Copyright (c) 2009 VMware, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ $LOAD_PATH.unshift File.dirname(__FILE__)
18
+ require 'helper'
19
+
20
+ class LoadAvgTest < Test::Unit::TestCase
21
+
22
+ def test_loadavg
23
+ begin
24
+ loadavg = Sigar.new.loadavg
25
+ rescue #XXX SigarNotImplemented (win32)
26
+ return
27
+ end
28
+ assert loadavg.length == 3
29
+ end
30
+ end
@@ -0,0 +1,45 @@
1
+ #
2
+ # Copyright (c) 2009 VMware, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ $LOAD_PATH.unshift File.dirname(__FILE__)
18
+ require 'helper'
19
+
20
+ class MemTest < Test::Unit::TestCase
21
+
22
+ def test_mem
23
+ sigar = Sigar.new
24
+ mem = sigar.mem
25
+ assert_gt_zero mem.total, "total"
26
+ assert_gt_zero mem.used, "used"
27
+
28
+ assert_gt_zero mem.used_percent, "used_percent"
29
+ assert mem.used_percent <= 100, "used_percent <= 100"
30
+
31
+ assert_gt_eq_zero mem.free_percent, "free_percent"
32
+ assert mem.free_percent < 100, "free_percent < 100"
33
+
34
+ assert_gt_zero mem.free, "free"
35
+
36
+ assert_gt_zero mem.actual_used, "actual_used"
37
+
38
+ assert_gt_zero mem.actual_free, "actual_free"
39
+
40
+ assert_gt_zero mem.ram, "ram"
41
+
42
+ assert (mem.ram % 8) == 0
43
+ end
44
+
45
+ end
@@ -0,0 +1,36 @@
1
+ #
2
+ # Copyright (c) 2009-2010 VMware, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ $LOAD_PATH.unshift File.dirname(__FILE__)
18
+ require 'helper'
19
+
20
+ class SwapTest < Test::Unit::TestCase
21
+
22
+ def test_swap
23
+ sigar = Sigar.new
24
+ swap = sigar.swap
25
+
26
+ assert_gt_eq_zero swap.total, "total"
27
+ assert_gt_eq_zero swap.used, "used"
28
+ assert_gt_eq_zero swap.free, "free"
29
+
30
+ assert_eq swap.total - swap.used, swap.free, "total-used==free"
31
+
32
+ assert_any swap.page_in, "page_in"
33
+ assert_any swap.page_out, "page_out"
34
+ end
35
+
36
+ end
@@ -0,0 +1,26 @@
1
+ #
2
+ # Copyright (c) 2009 VMware, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ $LOAD_PATH.unshift File.dirname(__FILE__)
18
+ require 'helper'
19
+
20
+ class UptimeTest < Test::Unit::TestCase
21
+
22
+ def test_uptime
23
+ uptime = Sigar.new.uptime
24
+ assert_gt_zero uptime.uptime, "uptime"
25
+ end
26
+ end
data/include/sigar.h ADDED
@@ -0,0 +1,943 @@
1
+ /*
2
+ * Copyright (c) 2004-2008 Hyperic, Inc.
3
+ * Copyright (c) 2009 SpringSource, Inc.
4
+ * Copyright (c) 2009-2010 VMware, Inc.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ #ifndef SIGAR_H
20
+ #define SIGAR_H
21
+
22
+ /* System Information Gatherer And Reporter */
23
+
24
+ #include <limits.h>
25
+
26
+ #ifndef MAX_INTERFACE_NAME_LEN
27
+ #define MAX_INTERFACE_NAME_LEN 256
28
+ #endif
29
+
30
+ #ifdef __cplusplus
31
+ extern "C" {
32
+ #endif
33
+
34
+ #if defined(_LP64) || \
35
+ defined(__LP64__) || \
36
+ defined(__64BIT__) || \
37
+ defined(__powerpc64__) || \
38
+ defined(__osf__)
39
+ #define SIGAR_64BIT
40
+ #endif
41
+
42
+ /* for printf sigar_uint64_t */
43
+ #ifdef SIGAR_64BIT
44
+ # define SIGAR_F_U64 "%lu"
45
+ #else
46
+ # define SIGAR_F_U64 "%Lu"
47
+ #endif
48
+
49
+ #if defined(WIN32)
50
+
51
+ typedef unsigned __int32 sigar_uint32_t;
52
+
53
+ typedef unsigned __int64 sigar_uint64_t;
54
+
55
+ typedef __int32 sigar_int32_t;
56
+
57
+ typedef __int64 sigar_int64_t;
58
+
59
+ #elif ULONG_MAX > 4294967295UL
60
+
61
+ typedef unsigned int sigar_uint32_t;
62
+
63
+ typedef unsigned long sigar_uint64_t;
64
+
65
+ typedef int sigar_int32_t;
66
+
67
+ typedef long sigar_int64_t;
68
+
69
+ #else
70
+
71
+ typedef unsigned int sigar_uint32_t;
72
+
73
+ typedef unsigned long long sigar_uint64_t;
74
+
75
+ typedef int sigar_int32_t;
76
+
77
+ typedef long long sigar_int64_t;
78
+
79
+ #endif
80
+
81
+ #define SIGAR_FIELD_NOTIMPL -1
82
+
83
+ #define SIGAR_OK 0
84
+ #define SIGAR_START_ERROR 20000
85
+ #define SIGAR_ENOTIMPL (SIGAR_START_ERROR + 1)
86
+ #define SIGAR_OS_START_ERROR (SIGAR_START_ERROR*2)
87
+
88
+ #ifdef WIN32
89
+ # define SIGAR_ENOENT ERROR_FILE_NOT_FOUND
90
+ # define SIGAR_EACCES ERROR_ACCESS_DENIED
91
+ # define SIGAR_ENXIO ERROR_BAD_DRIVER_LEVEL
92
+ #else
93
+ # define SIGAR_ENOENT ENOENT
94
+ # define SIGAR_EACCES EACCES
95
+ # define SIGAR_ENXIO ENXIO
96
+ #endif
97
+
98
+ #ifdef WIN32
99
+ # define SIGAR_DECLARE(type) \
100
+ __declspec(dllexport) type __stdcall
101
+ #else
102
+ # define SIGAR_DECLARE(type) type
103
+ #endif
104
+
105
+ #if defined(PATH_MAX)
106
+ # define SIGAR_PATH_MAX PATH_MAX
107
+ #elif defined(MAXPATHLEN)
108
+ # define SIGAR_PATH_MAX MAXPATHLEN
109
+ #else
110
+ # define SIGAR_PATH_MAX 4096
111
+ #endif
112
+
113
+ #ifdef WIN32
114
+ typedef sigar_uint64_t sigar_pid_t;
115
+ typedef unsigned long sigar_uid_t;
116
+ typedef unsigned long sigar_gid_t;
117
+ #else
118
+ #include <sys/types.h>
119
+ typedef pid_t sigar_pid_t;
120
+ typedef uid_t sigar_uid_t;
121
+ typedef gid_t sigar_gid_t;
122
+ #endif
123
+
124
+ typedef struct sigar_t sigar_t;
125
+
126
+ SIGAR_DECLARE(int) sigar_open(sigar_t **sigar);
127
+
128
+ SIGAR_DECLARE(int) sigar_close(sigar_t *sigar);
129
+
130
+ SIGAR_DECLARE(sigar_pid_t) sigar_pid_get(sigar_t *sigar);
131
+
132
+ SIGAR_DECLARE(int) sigar_proc_kill(sigar_pid_t pid, int signum);
133
+
134
+ SIGAR_DECLARE(int) sigar_signum_get(char *name);
135
+
136
+ SIGAR_DECLARE(char *) sigar_strerror(sigar_t *sigar, int err);
137
+
138
+ /* system memory info */
139
+
140
+ typedef struct {
141
+ sigar_uint64_t
142
+ ram,
143
+ total,
144
+ used,
145
+ free,
146
+ actual_used,
147
+ actual_free;
148
+ double used_percent;
149
+ double free_percent;
150
+ } sigar_mem_t;
151
+
152
+ SIGAR_DECLARE(int) sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem);
153
+
154
+ typedef struct {
155
+ sigar_uint64_t
156
+ total,
157
+ used,
158
+ free,
159
+ page_in,
160
+ page_out;
161
+ } sigar_swap_t;
162
+
163
+ SIGAR_DECLARE(int) sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap);
164
+
165
+ typedef struct {
166
+ sigar_uint64_t
167
+ user,
168
+ sys,
169
+ nice,
170
+ idle,
171
+ wait,
172
+ irq,
173
+ soft_irq,
174
+ stolen,
175
+ total;
176
+ } sigar_cpu_t;
177
+
178
+ SIGAR_DECLARE(int) sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu);
179
+
180
+ typedef struct {
181
+ unsigned long number;
182
+ unsigned long size;
183
+ sigar_cpu_t *data;
184
+ } sigar_cpu_list_t;
185
+
186
+ SIGAR_DECLARE(int) sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist);
187
+
188
+ SIGAR_DECLARE(int) sigar_cpu_list_destroy(sigar_t *sigar,
189
+ sigar_cpu_list_t *cpulist);
190
+
191
+ typedef struct {
192
+ char vendor[128];
193
+ char model[128];
194
+ int mhz;
195
+ int mhz_max;
196
+ int mhz_min;
197
+ sigar_uint64_t cache_size;
198
+ int total_sockets;
199
+ int total_cores;
200
+ int cores_per_socket;
201
+ } sigar_cpu_info_t;
202
+
203
+ typedef struct {
204
+ unsigned long number;
205
+ unsigned long size;
206
+ sigar_cpu_info_t *data;
207
+ } sigar_cpu_info_list_t;
208
+
209
+ SIGAR_DECLARE(int)
210
+ sigar_cpu_info_list_get(sigar_t *sigar,
211
+ sigar_cpu_info_list_t *cpu_infos);
212
+
213
+ SIGAR_DECLARE(int)
214
+ sigar_cpu_info_list_destroy(sigar_t *sigar,
215
+ sigar_cpu_info_list_t *cpu_infos);
216
+
217
+ typedef struct {
218
+ double uptime;
219
+ } sigar_uptime_t;
220
+
221
+ SIGAR_DECLARE(int) sigar_uptime_get(sigar_t *sigar,
222
+ sigar_uptime_t *uptime);
223
+
224
+ typedef struct {
225
+ double loadavg[3];
226
+ } sigar_loadavg_t;
227
+
228
+ SIGAR_DECLARE(int) sigar_loadavg_get(sigar_t *sigar,
229
+ sigar_loadavg_t *loadavg);
230
+
231
+ typedef struct {
232
+ unsigned long number;
233
+ unsigned long size;
234
+ sigar_pid_t *data;
235
+ } sigar_proc_list_t;
236
+
237
+ typedef struct {
238
+ /* RLIMIT_CPU */
239
+ sigar_uint64_t cpu_cur, cpu_max;
240
+ /* RLIMIT_FSIZE */
241
+ sigar_uint64_t file_size_cur, file_size_max;
242
+ /* PIPE_BUF */
243
+ sigar_uint64_t pipe_size_cur, pipe_size_max;
244
+ /* RLIMIT_DATA */
245
+ sigar_uint64_t data_cur, data_max;
246
+ /* RLIMIT_STACK */
247
+ sigar_uint64_t stack_cur, stack_max;
248
+ /* RLIMIT_CORE */
249
+ sigar_uint64_t core_cur, core_max;
250
+ /* RLIMIT_RSS */
251
+ sigar_uint64_t memory_cur, memory_max;
252
+ /* RLIMIT_NPROC */
253
+ sigar_uint64_t processes_cur, processes_max;
254
+ /* RLIMIT_NOFILE */
255
+ sigar_uint64_t open_files_cur, open_files_max;
256
+ /* RLIMIT_AS */
257
+ sigar_uint64_t virtual_memory_cur, virtual_memory_max;
258
+ } sigar_resource_limit_t;
259
+
260
+ SIGAR_DECLARE(int) sigar_resource_limit_get(sigar_t *sigar,
261
+ sigar_resource_limit_t *rlimit);
262
+
263
+ SIGAR_DECLARE(int) sigar_proc_list_get(sigar_t *sigar,
264
+ sigar_proc_list_t *proclist);
265
+
266
+ SIGAR_DECLARE(int) sigar_proc_list_destroy(sigar_t *sigar,
267
+ sigar_proc_list_t *proclist);
268
+
269
+ typedef struct {
270
+ sigar_uint64_t total;
271
+ sigar_uint64_t sleeping;
272
+ sigar_uint64_t running;
273
+ sigar_uint64_t zombie;
274
+ sigar_uint64_t stopped;
275
+ sigar_uint64_t idle;
276
+ sigar_uint64_t threads;
277
+ } sigar_proc_stat_t;
278
+
279
+ SIGAR_DECLARE(int) sigar_proc_stat_get(sigar_t *sigar,
280
+ sigar_proc_stat_t *procstat);
281
+
282
+ typedef struct {
283
+ sigar_uint64_t
284
+ size,
285
+ resident,
286
+ share,
287
+ minor_faults,
288
+ major_faults,
289
+ page_faults;
290
+ } sigar_proc_mem_t;
291
+
292
+ SIGAR_DECLARE(int) sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid,
293
+ sigar_proc_mem_t *procmem);
294
+
295
+ typedef struct {
296
+ sigar_uid_t uid;
297
+ sigar_gid_t gid;
298
+ sigar_uid_t euid;
299
+ sigar_gid_t egid;
300
+ } sigar_proc_cred_t;
301
+
302
+ SIGAR_DECLARE(int) sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid,
303
+ sigar_proc_cred_t *proccred);
304
+
305
+ #define SIGAR_CRED_NAME_MAX 512
306
+
307
+ typedef struct {
308
+ char user[SIGAR_CRED_NAME_MAX];
309
+ char group[SIGAR_CRED_NAME_MAX];
310
+ } sigar_proc_cred_name_t;
311
+
312
+ SIGAR_DECLARE(int)
313
+ sigar_proc_cred_name_get(sigar_t *sigar, sigar_pid_t pid,
314
+ sigar_proc_cred_name_t *proccredname);
315
+
316
+ typedef struct {
317
+ sigar_uint64_t
318
+ start_time,
319
+ user,
320
+ sys,
321
+ total;
322
+ } sigar_proc_time_t;
323
+
324
+ SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
325
+ sigar_proc_time_t *proctime);
326
+
327
+ typedef struct {
328
+ /* must match sigar_proc_time_t fields */
329
+ sigar_uint64_t
330
+ start_time,
331
+ user,
332
+ sys,
333
+ total;
334
+ sigar_uint64_t last_time;
335
+ double percent;
336
+ } sigar_proc_cpu_t;
337
+
338
+ SIGAR_DECLARE(int) sigar_proc_cpu_get(sigar_t *sigar, sigar_pid_t pid,
339
+ sigar_proc_cpu_t *proccpu);
340
+
341
+ #define SIGAR_PROC_STATE_SLEEP 'S'
342
+ #define SIGAR_PROC_STATE_RUN 'R'
343
+ #define SIGAR_PROC_STATE_STOP 'T'
344
+ #define SIGAR_PROC_STATE_ZOMBIE 'Z'
345
+ #define SIGAR_PROC_STATE_IDLE 'D'
346
+
347
+ #define SIGAR_PROC_NAME_LEN 128
348
+
349
+ typedef struct {
350
+ char name[SIGAR_PROC_NAME_LEN];
351
+ char state;
352
+ sigar_pid_t ppid;
353
+ int tty;
354
+ int priority;
355
+ int nice;
356
+ int processor;
357
+ sigar_uint64_t threads;
358
+ } sigar_proc_state_t;
359
+
360
+ SIGAR_DECLARE(int) sigar_proc_state_get(sigar_t *sigar, sigar_pid_t pid,
361
+ sigar_proc_state_t *procstate);
362
+
363
+ typedef struct {
364
+ unsigned long number;
365
+ unsigned long size;
366
+ char **data;
367
+ } sigar_proc_args_t;
368
+
369
+ SIGAR_DECLARE(int) sigar_proc_args_get(sigar_t *sigar, sigar_pid_t pid,
370
+ sigar_proc_args_t *procargs);
371
+
372
+ SIGAR_DECLARE(int) sigar_proc_args_destroy(sigar_t *sigar,
373
+ sigar_proc_args_t *procargs);
374
+
375
+ typedef struct {
376
+ void *data; /* user data */
377
+
378
+ enum {
379
+ SIGAR_PROC_ENV_ALL,
380
+ SIGAR_PROC_ENV_KEY
381
+ } type;
382
+
383
+ /* used for SIGAR_PROC_ENV_KEY */
384
+ const char *key;
385
+ int klen;
386
+
387
+ int (*env_getter)(void *, const char *, int, char *, int);
388
+ } sigar_proc_env_t;
389
+
390
+ SIGAR_DECLARE(int) sigar_proc_env_get(sigar_t *sigar, sigar_pid_t pid,
391
+ sigar_proc_env_t *procenv);
392
+
393
+ typedef struct {
394
+ sigar_uint64_t total;
395
+ /* XXX - which are files, sockets, etc. */
396
+ } sigar_proc_fd_t;
397
+
398
+ SIGAR_DECLARE(int) sigar_proc_fd_get(sigar_t *sigar, sigar_pid_t pid,
399
+ sigar_proc_fd_t *procfd);
400
+
401
+ typedef struct {
402
+ char name[SIGAR_PATH_MAX+1];
403
+ char cwd[SIGAR_PATH_MAX+1];
404
+ char root[SIGAR_PATH_MAX+1];
405
+ } sigar_proc_exe_t;
406
+
407
+ SIGAR_DECLARE(int) sigar_proc_exe_get(sigar_t *sigar, sigar_pid_t pid,
408
+ sigar_proc_exe_t *procexe);
409
+
410
+ typedef struct {
411
+ void *data; /* user data */
412
+
413
+ int (*module_getter)(void *, char *, int);
414
+ } sigar_proc_modules_t;
415
+
416
+ SIGAR_DECLARE(int) sigar_proc_modules_get(sigar_t *sigar, sigar_pid_t pid,
417
+ sigar_proc_modules_t *procmods);
418
+
419
+ typedef struct {
420
+ sigar_uint64_t user;
421
+ sigar_uint64_t sys;
422
+ sigar_uint64_t total;
423
+ } sigar_thread_cpu_t;
424
+
425
+ SIGAR_DECLARE(int) sigar_thread_cpu_get(sigar_t *sigar,
426
+ sigar_uint64_t id,
427
+ sigar_thread_cpu_t *cpu);
428
+
429
+ typedef enum {
430
+ SIGAR_FSTYPE_UNKNOWN,
431
+ SIGAR_FSTYPE_NONE,
432
+ SIGAR_FSTYPE_LOCAL_DISK,
433
+ SIGAR_FSTYPE_NETWORK,
434
+ SIGAR_FSTYPE_RAM_DISK,
435
+ SIGAR_FSTYPE_CDROM,
436
+ SIGAR_FSTYPE_SWAP,
437
+ SIGAR_FSTYPE_MAX
438
+ } sigar_file_system_type_e;
439
+
440
+ #define SIGAR_FS_NAME_LEN SIGAR_PATH_MAX
441
+ #define SIGAR_FS_INFO_LEN 256
442
+
443
+ typedef struct {
444
+ char dir_name[SIGAR_FS_NAME_LEN];
445
+ char dev_name[SIGAR_FS_NAME_LEN];
446
+ char type_name[SIGAR_FS_INFO_LEN]; /* e.g. "local" */
447
+ char sys_type_name[SIGAR_FS_INFO_LEN]; /* e.g. "ext3" */
448
+ char options[SIGAR_FS_INFO_LEN];
449
+ sigar_file_system_type_e type;
450
+ unsigned long flags;
451
+ } sigar_file_system_t;
452
+
453
+ typedef struct {
454
+ unsigned long number;
455
+ unsigned long size;
456
+ sigar_file_system_t *data;
457
+ } sigar_file_system_list_t;
458
+
459
+ SIGAR_DECLARE(int)
460
+ sigar_file_system_list_get(sigar_t *sigar,
461
+ sigar_file_system_list_t *fslist);
462
+
463
+ SIGAR_DECLARE(int)
464
+ sigar_file_system_list_destroy(sigar_t *sigar,
465
+ sigar_file_system_list_t *fslist);
466
+
467
+ typedef struct {
468
+ sigar_uint64_t reads;
469
+ sigar_uint64_t writes;
470
+ sigar_uint64_t write_bytes;
471
+ sigar_uint64_t read_bytes;
472
+ sigar_uint64_t rtime;
473
+ sigar_uint64_t wtime;
474
+ sigar_uint64_t qtime;
475
+ sigar_uint64_t time;
476
+ sigar_uint64_t snaptime;
477
+ double service_time;
478
+ double queue;
479
+ } sigar_disk_usage_t;
480
+
481
+ /* XXX for sigar_file_system_usage_t compat */
482
+ #define disk_reads disk.reads
483
+ #define disk_writes disk.writes
484
+ #define disk_write_bytes disk.write_bytes
485
+ #define disk_read_bytes disk.read_bytes
486
+ #define disk_queue disk.queue
487
+ #define disk_service_time disk.service_time
488
+
489
+ typedef struct {
490
+ sigar_disk_usage_t disk;
491
+ double use_percent;
492
+ sigar_uint64_t total;
493
+ sigar_uint64_t free;
494
+ sigar_uint64_t used;
495
+ sigar_uint64_t avail;
496
+ sigar_uint64_t files;
497
+ sigar_uint64_t free_files;
498
+ } sigar_file_system_usage_t;
499
+
500
+ #undef SIGAR_DISK_USAGE_T
501
+
502
+ SIGAR_DECLARE(int)
503
+ sigar_file_system_usage_get(sigar_t *sigar,
504
+ const char *dirname,
505
+ sigar_file_system_usage_t *fsusage);
506
+
507
+ SIGAR_DECLARE(int) sigar_disk_usage_get(sigar_t *sigar,
508
+ const char *name,
509
+ sigar_disk_usage_t *disk);
510
+
511
+ SIGAR_DECLARE(int)
512
+ sigar_file_system_ping(sigar_t *sigar,
513
+ sigar_file_system_t *fs);
514
+
515
+ typedef struct {
516
+ enum {
517
+ SIGAR_AF_UNSPEC,
518
+ SIGAR_AF_INET,
519
+ SIGAR_AF_INET6,
520
+ SIGAR_AF_LINK
521
+ } family;
522
+ union {
523
+ sigar_uint32_t in;
524
+ sigar_uint32_t in6[4];
525
+ unsigned char mac[8];
526
+ } addr;
527
+ } sigar_net_address_t;
528
+
529
+ #define SIGAR_INET6_ADDRSTRLEN 46
530
+
531
+ #define SIGAR_MAXDOMAINNAMELEN 256
532
+ #define SIGAR_MAXHOSTNAMELEN 256
533
+
534
+ typedef struct {
535
+ char default_gateway[SIGAR_INET6_ADDRSTRLEN];
536
+ char default_gateway_interface[MAX_INTERFACE_NAME_LEN];
537
+ char host_name[SIGAR_MAXHOSTNAMELEN];
538
+ char domain_name[SIGAR_MAXDOMAINNAMELEN];
539
+ char primary_dns[SIGAR_INET6_ADDRSTRLEN];
540
+ char secondary_dns[SIGAR_INET6_ADDRSTRLEN];
541
+ } sigar_net_info_t;
542
+
543
+ SIGAR_DECLARE(int)
544
+ sigar_net_info_get(sigar_t *sigar,
545
+ sigar_net_info_t *netinfo);
546
+
547
+ #define SIGAR_RTF_UP 0x1
548
+ #define SIGAR_RTF_GATEWAY 0x2
549
+ #define SIGAR_RTF_HOST 0x4
550
+
551
+ typedef struct {
552
+ sigar_net_address_t destination;
553
+ sigar_net_address_t gateway;
554
+ sigar_net_address_t mask;
555
+ sigar_uint64_t
556
+ flags,
557
+ refcnt,
558
+ use,
559
+ metric,
560
+ mtu,
561
+ window,
562
+ irtt;
563
+ char ifname[MAX_INTERFACE_NAME_LEN];
564
+ } sigar_net_route_t;
565
+
566
+ typedef struct {
567
+ unsigned long number;
568
+ unsigned long size;
569
+ sigar_net_route_t *data;
570
+ } sigar_net_route_list_t;
571
+
572
+ SIGAR_DECLARE(int) sigar_net_route_list_get(sigar_t *sigar,
573
+ sigar_net_route_list_t *routelist);
574
+
575
+ SIGAR_DECLARE(int) sigar_net_route_list_destroy(sigar_t *sigar,
576
+ sigar_net_route_list_t *routelist);
577
+
578
+ /*
579
+ * platforms define most of these "standard" flags,
580
+ * but of course, with different values in some cases.
581
+ */
582
+ #define SIGAR_IFF_UP 0x1
583
+ #define SIGAR_IFF_BROADCAST 0x2
584
+ #define SIGAR_IFF_DEBUG 0x4
585
+ #define SIGAR_IFF_LOOPBACK 0x8
586
+ #define SIGAR_IFF_POINTOPOINT 0x10
587
+ #define SIGAR_IFF_NOTRAILERS 0x20
588
+ #define SIGAR_IFF_RUNNING 0x40
589
+ #define SIGAR_IFF_NOARP 0x80
590
+ #define SIGAR_IFF_PROMISC 0x100
591
+ #define SIGAR_IFF_ALLMULTI 0x200
592
+ #define SIGAR_IFF_MULTICAST 0x800
593
+ #define SIGAR_IFF_SLAVE 0x1000
594
+ #define SIGAR_IFF_MASTER 0x2000
595
+ #define SIGAR_IFF_DYNAMIC 0x4000
596
+
597
+ #define SIGAR_NULL_HWADDR "00:00:00:00:00:00"
598
+
599
+ /* scope values from linux-2.6/include/net/ipv6.h */
600
+ #define SIGAR_IPV6_ADDR_ANY 0x0000
601
+ #define SIGAR_IPV6_ADDR_UNICAST 0x0001
602
+ #define SIGAR_IPV6_ADDR_MULTICAST 0x0002
603
+ #define SIGAR_IPV6_ADDR_LOOPBACK 0x0010
604
+ #define SIGAR_IPV6_ADDR_LINKLOCAL 0x0020
605
+ #define SIGAR_IPV6_ADDR_SITELOCAL 0x0040
606
+ #define SIGAR_IPV6_ADDR_COMPATv4 0x0080
607
+
608
+ typedef struct {
609
+ char name[MAX_INTERFACE_NAME_LEN];
610
+ char type[64];
611
+ char description[256];
612
+ sigar_net_address_t hwaddr;
613
+ sigar_net_address_t address;
614
+ sigar_net_address_t destination;
615
+ sigar_net_address_t broadcast;
616
+ sigar_net_address_t netmask;
617
+ sigar_net_address_t address6;
618
+ int prefix6_length;
619
+ int scope6;
620
+ sigar_uint64_t
621
+ flags,
622
+ mtu,
623
+ metric;
624
+ int tx_queue_len;
625
+ } sigar_net_interface_config_t;
626
+
627
+ SIGAR_DECLARE(int)
628
+ sigar_net_interface_config_get(sigar_t *sigar,
629
+ const char *name,
630
+ sigar_net_interface_config_t *ifconfig);
631
+
632
+ SIGAR_DECLARE(int)
633
+ sigar_net_interface_config_primary_get(sigar_t *sigar,
634
+ sigar_net_interface_config_t *ifconfig);
635
+
636
+ typedef struct {
637
+ sigar_uint64_t
638
+ /* received */
639
+ rx_packets,
640
+ rx_bytes,
641
+ rx_errors,
642
+ rx_dropped,
643
+ rx_overruns,
644
+ rx_frame,
645
+ /* transmitted */
646
+ tx_packets,
647
+ tx_bytes,
648
+ tx_errors,
649
+ tx_dropped,
650
+ tx_overruns,
651
+ tx_collisions,
652
+ tx_carrier,
653
+ speed;
654
+ } sigar_net_interface_stat_t;
655
+
656
+ SIGAR_DECLARE(int)
657
+ sigar_net_interface_stat_get(sigar_t *sigar,
658
+ const char *name,
659
+ sigar_net_interface_stat_t *ifstat);
660
+
661
+ typedef struct {
662
+ unsigned long number;
663
+ unsigned long size;
664
+ char **data;
665
+ } sigar_net_interface_list_t;
666
+
667
+ SIGAR_DECLARE(int)
668
+ sigar_net_interface_list_get(sigar_t *sigar,
669
+ sigar_net_interface_list_t *iflist);
670
+
671
+ SIGAR_DECLARE(int)
672
+ sigar_net_interface_list_destroy(sigar_t *sigar,
673
+ sigar_net_interface_list_t *iflist);
674
+
675
+ #define SIGAR_NETCONN_CLIENT 0x01
676
+ #define SIGAR_NETCONN_SERVER 0x02
677
+
678
+ #define SIGAR_NETCONN_TCP 0x10
679
+ #define SIGAR_NETCONN_UDP 0x20
680
+ #define SIGAR_NETCONN_RAW 0x40
681
+ #define SIGAR_NETCONN_UNIX 0x80
682
+
683
+ enum {
684
+ SIGAR_TCP_ESTABLISHED = 1,
685
+ SIGAR_TCP_SYN_SENT,
686
+ SIGAR_TCP_SYN_RECV,
687
+ SIGAR_TCP_FIN_WAIT1,
688
+ SIGAR_TCP_FIN_WAIT2,
689
+ SIGAR_TCP_TIME_WAIT,
690
+ SIGAR_TCP_CLOSE,
691
+ SIGAR_TCP_CLOSE_WAIT,
692
+ SIGAR_TCP_LAST_ACK,
693
+ SIGAR_TCP_LISTEN,
694
+ SIGAR_TCP_CLOSING,
695
+ SIGAR_TCP_IDLE,
696
+ SIGAR_TCP_BOUND,
697
+ SIGAR_TCP_UNKNOWN
698
+ };
699
+
700
+ typedef struct {
701
+ unsigned long local_port;
702
+ sigar_net_address_t local_address;
703
+ unsigned long remote_port;
704
+ sigar_net_address_t remote_address;
705
+ sigar_uid_t uid;
706
+ unsigned long inode;
707
+ int type;
708
+ int state;
709
+ unsigned long send_queue;
710
+ unsigned long receive_queue;
711
+ } sigar_net_connection_t;
712
+
713
+ typedef struct {
714
+ unsigned long number;
715
+ unsigned long size;
716
+ sigar_net_connection_t *data;
717
+ } sigar_net_connection_list_t;
718
+
719
+ SIGAR_DECLARE(int)
720
+ sigar_net_connection_list_get(sigar_t *sigar,
721
+ sigar_net_connection_list_t *connlist,
722
+ int flags);
723
+
724
+ SIGAR_DECLARE(int)
725
+ sigar_net_connection_list_destroy(sigar_t *sigar,
726
+ sigar_net_connection_list_t *connlist);
727
+
728
+ typedef struct sigar_net_connection_walker_t sigar_net_connection_walker_t;
729
+
730
+ /* alternative to sigar_net_connection_list_get */
731
+ struct sigar_net_connection_walker_t {
732
+ sigar_t *sigar;
733
+ int flags;
734
+ void *data; /* user data */
735
+ int (*add_connection)(sigar_net_connection_walker_t *walker,
736
+ sigar_net_connection_t *connection);
737
+ };
738
+
739
+ SIGAR_DECLARE(int)
740
+ sigar_net_connection_walk(sigar_net_connection_walker_t *walker);
741
+
742
+ typedef struct {
743
+ int tcp_states[SIGAR_TCP_UNKNOWN];
744
+ sigar_uint32_t tcp_inbound_total;
745
+ sigar_uint32_t tcp_outbound_total;
746
+ sigar_uint32_t all_inbound_total;
747
+ sigar_uint32_t all_outbound_total;
748
+ } sigar_net_stat_t;
749
+
750
+ SIGAR_DECLARE(int)
751
+ sigar_net_stat_get(sigar_t *sigar,
752
+ sigar_net_stat_t *netstat,
753
+ int flags);
754
+
755
+ SIGAR_DECLARE(int)
756
+ sigar_net_stat_port_get(sigar_t *sigar,
757
+ sigar_net_stat_t *netstat,
758
+ int flags,
759
+ sigar_net_address_t *address,
760
+ unsigned long port);
761
+
762
+ /* TCP-MIB */
763
+ typedef struct {
764
+ sigar_uint64_t active_opens;
765
+ sigar_uint64_t passive_opens;
766
+ sigar_uint64_t attempt_fails;
767
+ sigar_uint64_t estab_resets;
768
+ sigar_uint64_t curr_estab;
769
+ sigar_uint64_t in_segs;
770
+ sigar_uint64_t out_segs;
771
+ sigar_uint64_t retrans_segs;
772
+ sigar_uint64_t in_errs;
773
+ sigar_uint64_t out_rsts;
774
+ } sigar_tcp_t;
775
+
776
+ SIGAR_DECLARE(int)
777
+ sigar_tcp_get(sigar_t *sigar,
778
+ sigar_tcp_t *tcp);
779
+
780
+ typedef struct {
781
+ sigar_uint64_t null;
782
+ sigar_uint64_t getattr;
783
+ sigar_uint64_t setattr;
784
+ sigar_uint64_t root;
785
+ sigar_uint64_t lookup;
786
+ sigar_uint64_t readlink;
787
+ sigar_uint64_t read;
788
+ sigar_uint64_t writecache;
789
+ sigar_uint64_t write;
790
+ sigar_uint64_t create;
791
+ sigar_uint64_t remove;
792
+ sigar_uint64_t rename;
793
+ sigar_uint64_t link;
794
+ sigar_uint64_t symlink;
795
+ sigar_uint64_t mkdir;
796
+ sigar_uint64_t rmdir;
797
+ sigar_uint64_t readdir;
798
+ sigar_uint64_t fsstat;
799
+ } sigar_nfs_v2_t;
800
+
801
+ typedef sigar_nfs_v2_t sigar_nfs_client_v2_t;
802
+ typedef sigar_nfs_v2_t sigar_nfs_server_v2_t;
803
+
804
+ SIGAR_DECLARE(int)
805
+ sigar_nfs_client_v2_get(sigar_t *sigar,
806
+ sigar_nfs_client_v2_t *nfs);
807
+
808
+ SIGAR_DECLARE(int)
809
+ sigar_nfs_server_v2_get(sigar_t *sigar,
810
+ sigar_nfs_server_v2_t *nfs);
811
+
812
+ typedef struct {
813
+ sigar_uint64_t null;
814
+ sigar_uint64_t getattr;
815
+ sigar_uint64_t setattr;
816
+ sigar_uint64_t lookup;
817
+ sigar_uint64_t access;
818
+ sigar_uint64_t readlink;
819
+ sigar_uint64_t read;
820
+ sigar_uint64_t write;
821
+ sigar_uint64_t create;
822
+ sigar_uint64_t mkdir;
823
+ sigar_uint64_t symlink;
824
+ sigar_uint64_t mknod;
825
+ sigar_uint64_t remove;
826
+ sigar_uint64_t rmdir;
827
+ sigar_uint64_t rename;
828
+ sigar_uint64_t link;
829
+ sigar_uint64_t readdir;
830
+ sigar_uint64_t readdirplus;
831
+ sigar_uint64_t fsstat;
832
+ sigar_uint64_t fsinfo;
833
+ sigar_uint64_t pathconf;
834
+ sigar_uint64_t commit;
835
+ } sigar_nfs_v3_t;
836
+
837
+ typedef sigar_nfs_v3_t sigar_nfs_client_v3_t;
838
+ typedef sigar_nfs_v3_t sigar_nfs_server_v3_t;
839
+
840
+ SIGAR_DECLARE(int)
841
+ sigar_nfs_client_v3_get(sigar_t *sigar,
842
+ sigar_nfs_client_v3_t *nfs);
843
+
844
+ SIGAR_DECLARE(int)
845
+ sigar_nfs_server_v3_get(sigar_t *sigar,
846
+ sigar_nfs_server_v3_t *nfs);
847
+
848
+ SIGAR_DECLARE(int)
849
+ sigar_net_listen_address_get(sigar_t *sigar,
850
+ unsigned long port,
851
+ sigar_net_address_t *address);
852
+
853
+ typedef struct {
854
+ char ifname[MAX_INTERFACE_NAME_LEN];
855
+ char type[64];
856
+ sigar_net_address_t hwaddr;
857
+ sigar_net_address_t address;
858
+ sigar_uint64_t flags;
859
+ } sigar_arp_t;
860
+
861
+ typedef struct {
862
+ unsigned long number;
863
+ unsigned long size;
864
+ sigar_arp_t *data;
865
+ } sigar_arp_list_t;
866
+
867
+ SIGAR_DECLARE(int) sigar_arp_list_get(sigar_t *sigar,
868
+ sigar_arp_list_t *arplist);
869
+
870
+ SIGAR_DECLARE(int) sigar_arp_list_destroy(sigar_t *sigar,
871
+ sigar_arp_list_t *arplist);
872
+
873
+ typedef struct {
874
+ char user[32];
875
+ char device[32];
876
+ char host[256];
877
+ sigar_uint64_t time;
878
+ } sigar_who_t;
879
+
880
+ typedef struct {
881
+ unsigned long number;
882
+ unsigned long size;
883
+ sigar_who_t *data;
884
+ } sigar_who_list_t;
885
+
886
+ SIGAR_DECLARE(int) sigar_who_list_get(sigar_t *sigar,
887
+ sigar_who_list_t *wholist);
888
+
889
+ SIGAR_DECLARE(int) sigar_who_list_destroy(sigar_t *sigar,
890
+ sigar_who_list_t *wholist);
891
+
892
+ SIGAR_DECLARE(int) sigar_proc_port_get(sigar_t *sigar,
893
+ int protocol, unsigned long port,
894
+ sigar_pid_t *pid);
895
+
896
+ typedef struct {
897
+ const char *build_date;
898
+ const char *scm_revision;
899
+ const char *version;
900
+ const char *archname;
901
+ const char *archlib;
902
+ const char *binname;
903
+ const char *description;
904
+ int major, minor, maint, build;
905
+ } sigar_version_t;
906
+
907
+ SIGAR_DECLARE(sigar_version_t *) sigar_version_get(void);
908
+
909
+ #define SIGAR_SYS_INFO_LEN SIGAR_MAXHOSTNAMELEN /* more than enough */
910
+
911
+ typedef struct {
912
+ char name[SIGAR_SYS_INFO_LEN]; /* canonicalized sysname */
913
+ char version[SIGAR_SYS_INFO_LEN]; /* utsname.release */
914
+ char arch[SIGAR_SYS_INFO_LEN];
915
+ char machine[SIGAR_SYS_INFO_LEN];
916
+ char description[SIGAR_SYS_INFO_LEN];
917
+ char patch_level[SIGAR_SYS_INFO_LEN];
918
+ char vendor[SIGAR_SYS_INFO_LEN];
919
+ char vendor_version[SIGAR_SYS_INFO_LEN];
920
+ char vendor_name[SIGAR_SYS_INFO_LEN]; /* utsname.sysname */
921
+ char vendor_code_name[SIGAR_SYS_INFO_LEN];
922
+ } sigar_sys_info_t;
923
+
924
+ SIGAR_DECLARE(int) sigar_sys_info_get(sigar_t *sigar, sigar_sys_info_t *sysinfo);
925
+
926
+ #define SIGAR_FQDN_LEN 512
927
+
928
+ SIGAR_DECLARE(int) sigar_fqdn_get(sigar_t *sigar, char *name, int namelen);
929
+
930
+ SIGAR_DECLARE(int) sigar_rpc_ping(char *hostname,
931
+ int protocol,
932
+ unsigned long program,
933
+ unsigned long version);
934
+
935
+ SIGAR_DECLARE(char *) sigar_rpc_strerror(int err);
936
+
937
+ SIGAR_DECLARE(char *) sigar_password_get(const char *prompt);
938
+
939
+ #ifdef __cplusplus
940
+ }
941
+ #endif
942
+
943
+ #endif