kostya-sigar 2.0.4 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 32d0a91e9e5b9496a5cfc40464dcad3bc9938374
4
- data.tar.gz: 7a2100fe26037fc0d5577c1bb76bb93dabeecb24
2
+ SHA256:
3
+ metadata.gz: d4ed0dac36500acd35935a9d6f13a45e7250c733a910b67d722797b00c753720
4
+ data.tar.gz: af50d7946e54ca9fd8435de5f1090ce5118574f856e317227fa61f3fb2c9c7ec
5
5
  SHA512:
6
- metadata.gz: fcbbbf9385352766816a3b0728a4815c145af1e67ff8b7cbd39fe1c0fb78ef157334e9dfba9f8e5284d53f8e92bc38b27514a5491af98ea3ed5328d6439e1082
7
- data.tar.gz: c155a48830d92ef09928f7f41353600c0ea6d42ca37da7062e7db096450420bb59d7cee7e828e0772d4d0bf14b4b4731a7225074b34900f29f6e4646a67b286d
6
+ metadata.gz: 864a0d980320b58574072b5aaed90245483b146eb3e315c45fce29a97d9fec3d93a4832b023c90105e5ecfe8c268c80f8f49f9335012abadc47a7f112f82768e
7
+ data.tar.gz: 32b31ca9c561a6154bb51a51357a472bb62a37c1079ac2053d5b13950b614d5c67fd5fee5a49034e559389b07799c2db9e406df4acfa443befbfdd714f221b33
data/README.md CHANGED
@@ -1,22 +1,31 @@
1
1
  # System Information Gatherer And Reporter.
2
2
 
3
- Fork of hyperic/sigar with some fixes. Support only ruby binding.
3
+ Fork of hyperic/sigar with some fixes. Support only ruby binding. Part of [Eye gem](https://github.com/kostya/eye).
4
4
 
5
5
  ## Fixed:
6
6
 
7
- [2.0.0]
8
- * sigfaulted logger, [#28](https://github.com/hyperic/sigar/pull/28)([commit](https://github.com/kostya/sigar/commit/c2a1af))
9
- * bug undefined symbol: sigar_skip_token, [#60](https://github.com/hyperic/sigar/pull/60)([commit](https://github.com/kostya/sigar/commit/dfe8fe))
10
- * bug detection boot_time on linux (now it works like gnu ps, and fix some issues with process start_time) ([commit](https://github.com/kostya/sigar/commit/660259))
7
+ ### [2.0.7] 02-10-2020
8
+ * Fix compilation on MacOS [#6](https://github.com/kostya/sigar/issues/8)([commit](https://github.com/kostya/sigar/pull/9/commits/ad39547629fa328e115f7d7bc3c7c358247d1961))
11
9
 
12
- [2.0.1]
13
- * FreeBSD: don't use v_cache_min/max [#68](https://github.com/hyperic/sigar/pull/68)([commit](https://github.com/kostya/sigar/commit/800076db97bcacb1ba90805d740b4f9a5a1d3cca))
10
+ ### [2.0.6] 18-01-2019
11
+ * Fix compilation on FreeBSD 12 [#6](https://github.com/kostya/sigar/issues/6)([commit](https://github.com/kostya/sigar/commit/2bb67fa1bf6f6f0ddc2626cf028bcc0e4a8cb377))
12
+
13
+ ### [2.0.5] 02-12-2018
14
+ * Fix compilation with musl libc [#4](https://github.com/kostya/sigar/pull/4)([commit](https://github.com/kostya/sigar/pull/4/commits/cd07923dd2ed34aca353dfd182f2f85c13853fd9))
15
+
16
+ ### [2.0.4] 10-06-2018
17
+ * fix compilation with glibc 2.26, major/minor functions [#2](https://github.com/kostya/sigar/issues/2)([commit](https://github.com/kostya/sigar/commit/a2c67588d0f686e0007dadcaf0e4bbb35c0e1e83))
14
18
 
15
- [2.0.2]
16
- * Remove obsolete rpc usage (fix compilation fail with glibc 2.27) ([commit](https://github.com/kostya/sigar/commit/a971b9e8e1443fdf236c5ffa199c1994c05fcd4b))
19
+ ### [2.0.2] 30-05-2018
20
+ * Remove obsolete rpc usage (fix compilation fail with glibc 2.27) [#213](https://github.com/kostya/eye/issues/213)([commit](https://github.com/kostya/sigar/commit/a971b9e8e1443fdf236c5ffa199c1994c05fcd4b))
17
21
 
18
- [2.0.4]
19
- * fix compilation with glibc 2.26, major/minor functions ([commit](https://github.com/kostya/sigar/commit/a2c67588d0f686e0007dadcaf0e4bbb35c0e1e83))
22
+ ### [2.0.1] 10-04-2018
23
+ * FreeBSD: don't use v_cache_min/max [#68](https://github.com/hyperic/sigar/pull/68)([commit](https://github.com/kostya/sigar/commit/800076db97bcacb1ba90805d740b4f9a5a1d3cca))
24
+
25
+ ### [2.0.0] 22-01-2018
26
+ * sigfaulted logger, [#28](https://github.com/hyperic/sigar/pull/28)([commit](https://github.com/kostya/sigar/commit/c2a1af))
27
+ * bug undefined symbol: sigar_skip_token, [#60](https://github.com/hyperic/sigar/pull/60)([commit](https://github.com/kostya/sigar/commit/dfe8fe))
28
+ * bug detection boot_time on linux (now it works like gnu ps, and fix some issues with process start_time) ([commit](https://github.com/kostya/sigar/commit/660259))
20
29
 
21
30
 
22
31
  ## Installation:
@@ -24,6 +24,7 @@
24
24
  #endif
25
25
 
26
26
  #include <errno.h>
27
+ #include <ctype.h>
27
28
  #include "sigar.h"
28
29
  #include "sigar_fileinfo.h"
29
30
  #include "sigar_format.h"
@@ -123,6 +123,69 @@
123
123
  #endif
124
124
 
125
125
  #if defined(SIGAR_FREEBSD5)
126
+ #if __FreeBSD_version >= 1200028
127
+ #define VMMETER_TYPE uint64_t
128
+ #else
129
+ #define VMMETER_TYPE u_int
130
+ #endif
131
+ struct __vmmeter {
132
+ VMMETER_TYPE v_vm_faults;
133
+ VMMETER_TYPE v_io_faults;
134
+ VMMETER_TYPE v_cow_faults;
135
+ VMMETER_TYPE v_cow_optim;
136
+ VMMETER_TYPE v_zfod;
137
+ VMMETER_TYPE v_ozfod;
138
+ VMMETER_TYPE v_swapin;
139
+ VMMETER_TYPE v_swapout;
140
+ VMMETER_TYPE v_swappgsin;
141
+ VMMETER_TYPE v_swappgsout;
142
+ VMMETER_TYPE v_vnodein;
143
+ VMMETER_TYPE v_vnodeout;
144
+ VMMETER_TYPE v_vnodepgsin;
145
+ VMMETER_TYPE v_vnodepgsout;
146
+ VMMETER_TYPE v_intrans;
147
+ VMMETER_TYPE v_reactivated;
148
+ VMMETER_TYPE v_pdwakeups;
149
+ VMMETER_TYPE v_pdpages;
150
+ VMMETER_TYPE v_pdshortfalls;
151
+ VMMETER_TYPE v_dfree;
152
+ VMMETER_TYPE v_pfree;
153
+ VMMETER_TYPE v_tfree;
154
+ VMMETER_TYPE v_forks;
155
+ VMMETER_TYPE v_vforks;
156
+ VMMETER_TYPE v_rforks;
157
+ VMMETER_TYPE v_kthreads;
158
+ VMMETER_TYPE v_forkpages;
159
+ VMMETER_TYPE v_vforkpages;
160
+ VMMETER_TYPE v_rforkpages;
161
+ VMMETER_TYPE v_kthreadpages;
162
+ VMMETER_TYPE v_swtch;
163
+ VMMETER_TYPE v_syscall;
164
+ VMMETER_TYPE v_trap;
165
+ VMMETER_TYPE v_intr;
166
+ VMMETER_TYPE v_soft;
167
+ u_int v_page_size;
168
+ u_int v_page_count;
169
+ u_int v_free_reserved;
170
+ u_int v_free_target;
171
+ u_int v_free_min;
172
+ u_int v_free_count;
173
+ u_int v_wire_count;
174
+ u_int v_active_count;
175
+ u_int v_inactive_target;
176
+ u_int v_inactive_count;
177
+ u_int v_laundry_count;
178
+ u_int v_pageout_free_min;
179
+ u_int v_interrupt_free_min;
180
+ u_int v_free_severe;
181
+ #if (__FreeBSD_version < 1200016)
182
+ u_int v_cache_count;
183
+ #endif
184
+ #if (__FreeBSD_version < 1100079)
185
+ u_int v_cache_min;
186
+ u_int v_cache_max;
187
+ #endif
188
+ };
126
189
 
127
190
  #define KI_FD ki_fd
128
191
  #define KI_PID ki_pid
@@ -342,24 +405,21 @@ static int sigar_vmstat(sigar_t *sigar, vm_statistics_data_t *vmstat)
342
405
  }
343
406
  }
344
407
  #elif defined(__FreeBSD__)
345
- static int sigar_vmstat(sigar_t *sigar, struct vmmeter *vmstat)
408
+ static int sigar_vmstat(sigar_t *sigar, struct __vmmeter *vmstat)
346
409
  {
347
- int status;
348
- size_t size = sizeof(unsigned int);
349
-
350
- status = kread(sigar, vmstat, sizeof(*vmstat),
351
- sigar->koffsets[KOFFSET_VMMETER]);
352
-
353
- if (status == SIGAR_OK) {
354
- return SIGAR_OK;
355
- }
410
+ size_t size;
356
411
 
357
412
  SIGAR_ZERO(vmstat);
358
413
 
359
414
  /* derived from src/usr.bin/vmstat/vmstat.c */
360
415
  /* only collect the ones we actually use */
361
- #define GET_VM_STATS(cat, name, used) \
362
- if (used) sysctlbyname("vm.stats." #cat "." #name, &vmstat->name, &size, NULL, 0)
416
+ #define GET_VM_STATS(cat, name, used) do { \
417
+ if (used) { \
418
+ size = sizeof(vmstat->name); \
419
+ sysctlbyname("vm.stats." #cat "." #name, &vmstat->name, \
420
+ &size, NULL, 0); \
421
+ } \
422
+ } while (0)
363
423
 
364
424
  /* sys */
365
425
  GET_VM_STATS(sys, v_swtch, 0);
@@ -399,10 +459,12 @@ static int sigar_vmstat(sigar_t *sigar, struct vmmeter *vmstat)
399
459
  GET_VM_STATS(vm, v_active_count, 0);
400
460
  GET_VM_STATS(vm, v_inactive_target, 0);
401
461
  GET_VM_STATS(vm, v_inactive_count, 1);
462
+ #if (__FreeBSD_version < 1200016 )
402
463
  GET_VM_STATS(vm, v_cache_count, 1);
403
- #if (__FreeBSD_version < 1100079)
404
- GET_VM_STATS(vm, v_cache_min, 0);
405
- GET_VM_STATS(vm, v_cache_max, 0);
464
+ #endif
465
+ #if (__FreeBSD_version < 1100079 )
466
+ GET_VM_STATS(vm, v_cache_min, 0);
467
+ GET_VM_STATS(vm, v_cache_max, 0);
406
468
  #endif
407
469
  GET_VM_STATS(vm, v_pageout_free_min, 0);
408
470
  GET_VM_STATS(vm, v_interrupt_free_min, 0);
@@ -442,7 +504,7 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
442
504
  unsigned long mem_total;
443
505
  #endif
444
506
  #if defined(__FreeBSD__)
445
- struct vmmeter vmstat;
507
+ struct __vmmeter vmstat;
446
508
  #elif defined(__OpenBSD__) || defined(__NetBSD__)
447
509
  struct uvmexp vmstat;
448
510
  #endif
@@ -481,7 +543,11 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
481
543
  kern *= sigar->pagesize;
482
544
  #elif defined(__FreeBSD__)
483
545
  if ((status = sigar_vmstat(sigar, &vmstat)) == SIGAR_OK) {
546
+ #if (__FreeBSD_version < 1200016 )
484
547
  kern = vmstat.v_cache_count + vmstat.v_inactive_count;
548
+ #else
549
+ kern = vmstat.v_inactive_count;
550
+ #endif
485
551
  kern *= sigar->pagesize;
486
552
  mem->free = vmstat.v_free_count;
487
553
  mem->free *= sigar->pagesize;
@@ -691,7 +757,7 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
691
757
  swap->page_out = vmstat.pageouts;
692
758
  #elif defined(__FreeBSD__)
693
759
  struct kvm_swap kswap[1];
694
- struct vmmeter vmstat;
760
+ struct __vmmeter vmstat;
695
761
 
696
762
  if (getswapinfo_sysctl(kswap, 1) != SIGAR_OK) {
697
763
  if (!sigar->kmem) {
@@ -3057,8 +3123,13 @@ static int net_connection_get(sigar_net_connection_walker_t *walker, int proto)
3057
3123
  int type, istcp = 0;
3058
3124
  char *buf;
3059
3125
  const char *mibvar;
3126
+ #if defined(__FreeBSD__) && (__FreeBSD_version >= 1200026)
3127
+ struct xtcpcb *tp = NULL;
3128
+ struct xinpcb *inp;
3129
+ #else
3060
3130
  struct tcpcb *tp = NULL;
3061
3131
  struct inpcb *inp;
3132
+ #endif
3062
3133
  struct xinpgen *xig, *oxig;
3063
3134
  struct xsocket *so;
3064
3135
  size_t len;
@@ -3096,6 +3167,15 @@ static int net_connection_get(sigar_net_connection_walker_t *walker, int proto)
3096
3167
  xig->xig_len > sizeof(struct xinpgen);
3097
3168
  xig = (struct xinpgen *)((char *)xig + xig->xig_len))
3098
3169
  {
3170
+ #if defined(__FreeBSD__) && (__FreeBSD_version >= 1200026)
3171
+ if (istcp) {
3172
+ tp = (struct xtcpcb *)xig;
3173
+ inp = &tp->xt_inp;
3174
+ } else {
3175
+ inp = (struct xinpcb *)xig;
3176
+ }
3177
+ so = &inp->xi_socket;
3178
+ #else
3099
3179
  if (istcp) {
3100
3180
  struct xtcpcb *cb = (struct xtcpcb *)xig;
3101
3181
  tp = &cb->xt_tp;
@@ -3107,6 +3187,7 @@ static int net_connection_get(sigar_net_connection_walker_t *walker, int proto)
3107
3187
  inp = &cb->xi_inp;
3108
3188
  so = &cb->xi_socket;
3109
3189
  }
3190
+ #endif
3110
3191
 
3111
3192
  if (so->xso_protocol != proto) {
3112
3193
  continue;
@@ -50,6 +50,10 @@
50
50
  #define PROC_PARTITIONS PROC_FS_ROOT "partitions"
51
51
  #define PROC_DISKSTATS PROC_FS_ROOT "diskstats"
52
52
 
53
+ #ifndef HZ
54
+ #define HZ 100
55
+ #endif
56
+
53
57
  /*
54
58
  * /proc/self/stat fields:
55
59
  * 1 - pid
@@ -70,7 +70,7 @@ struct sigar_t {
70
70
  };
71
71
 
72
72
  #define HAVE_STRERROR_R
73
- #ifndef __USE_XOPEN2K
73
+ #if !defined(__USE_XOPEN2K) && defined(__GLIBC__)
74
74
  /* use gnu version of strerror_r */
75
75
  #define HAVE_STRERROR_R_GLIBC
76
76
  #endif
@@ -1,7 +1,7 @@
1
1
  copyright.year=2004-2011
2
2
  version.major=2
3
3
  version.minor=0
4
- version.maint=4
4
+ version.maint=8
5
5
  version.build=0
6
6
  project.name=kostya-sigar
7
7
  project.author=Doug MacEachern
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kostya-sigar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug MacEachern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-10 00:00:00.000000000 Z
11
+ date: 2020-10-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: System Information Gatherer And Reporter
14
14
  email: sigar-users@hyperic.org
@@ -82,8 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.4.5
85
+ rubygems_version: 3.1.2
87
86
  signing_key:
88
87
  specification_version: 4
89
88
  summary: System Information Gatherer And Reporter