kostya-sigar 2.0.5 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjNiOTg4ZjVhOTc5OGVlZDhkZTIzMzVhNGI5OGM5ZTg4OGRlYTc3MQ==
5
- data.tar.gz: !binary |-
6
- NWEwOTJhMzY1N2U5NDA0Nzk3OTUxMjdjMTM1MWNjYjUyN2NhNDMwMg==
2
+ SHA256:
3
+ metadata.gz: 9ef7ca80217383686bcd1d5647d584ac7d646f61635376696d9ead1811a0aaf1
4
+ data.tar.gz: 3e4be357add9d7176c496b19111cf2ec6cba3bea5245aeb305d2f7f77f0c9b38
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YTIzZjZjNmE0ZjQ0M2M0YTkyNDZlMGIyNTEwYmVmMmFiMjUwYjViZDcwZDFh
10
- NTI4ZGNiNTQ0MTNkYjc4ZWUyMzVmNWI3MWZkNzk0Zjg1NGQxY2VhY2E5ZjNh
11
- ZWIyOGIwZGNlZTQ4OWUyZmNlNzZiZThhNDE0YjBkOTYxMWU1MmM=
12
- data.tar.gz: !binary |-
13
- YmNkYTFlMjMwOGFjZWZmOGY0YmRlODRiYzM5YWFiMWFhNzU0NDBhODllZWJi
14
- YmIxMWQ0YzE5ZDU5YThiMGE3YTQwYjhmYzdiYThkZThiOWZmNmNmY2UyNTZh
15
- NjU2MGE2MGFmZjMwOTJhNTRlNGUwOTc5MDgxYmJiN2RmYjViN2U=
6
+ metadata.gz: f4ae8271aef842ef43e974d51def01f98e274cb46687f4139dadc519f7cf81be8576ddbff7e170f53700db503c68d811c12c463dc7a0b05fede7fa0e63540a4f
7
+ data.tar.gz: b94efc3f50db5bb060ecb0c297d3edeb298af7715408a019d3754be0b038529bdb9eb2b1452bbf5232ee0165a9d6fc27dbaf46d95ce60f6d2147d166aab85e84
data/README.md CHANGED
@@ -4,22 +4,31 @@ Fork of hyperic/sigar with some fixes. Support only ruby binding. Part of [Eye g
4
4
 
5
5
  ## Fixed:
6
6
 
7
- ### [2.0.0] 22-01-2018
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.9] 28-06-2021
8
+ * Fix compilation on FreeBSD 13 [#10](https://github.com/kostya/sigar/issues/10)([commit](https://github.com/kostya/sigar/commit/b78b558fb756a75dc7d6cbf704423be3c7098ae5))
11
9
 
12
- ### [2.0.1] 10-04-2018
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.8] 02-10-2020
11
+ * Fix compilation on MacOS [#8](https://github.com/kostya/sigar/issues/8)([commit](https://github.com/kostya/sigar/pull/9/commits/ad39547629fa328e115f7d7bc3c7c358247d1961))
14
12
 
15
- ### [2.0.2] 30-05-2018
16
- * 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))
13
+ ### [2.0.6] 18-01-2019
14
+ * Fix compilation on FreeBSD 12 [#6](https://github.com/kostya/sigar/issues/6)([commit](https://github.com/kostya/sigar/commit/2bb67fa1bf6f6f0ddc2626cf028bcc0e4a8cb377))
15
+
16
+ ### [2.0.5] 02-12-2018
17
+ * Fix compilation with musl libc [#4](https://github.com/kostya/sigar/pull/4)([commit](https://github.com/kostya/sigar/pull/4/commits/cd07923dd2ed34aca353dfd182f2f85c13853fd9))
17
18
 
18
19
  ### [2.0.4] 10-06-2018
19
20
  * 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))
20
21
 
21
- ### [2.0.5] 02-12-2018
22
- * Fix compilation with musl libc [#4](https://github.com/kostya/sigar/pull/4)([commit](https://github.com/kostya/sigar/pull/4/commits/cd07923dd2ed34aca353dfd182f2f85c13853fd9))
22
+ ### [2.0.2] 30-05-2018
23
+ * 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))
24
+
25
+ ### [2.0.1] 10-04-2018
26
+ * FreeBSD: don't use v_cache_min/max [#68](https://github.com/hyperic/sigar/pull/68)([commit](https://github.com/kostya/sigar/commit/800076db97bcacb1ba90805d740b4f9a5a1d3cca))
27
+
28
+ ### [2.0.0] 22-01-2018
29
+ * sigfaulted logger, [#28](https://github.com/hyperic/sigar/pull/28)([commit](https://github.com/kostya/sigar/commit/c2a1af))
30
+ * bug undefined symbol: sigar_skip_token, [#60](https://github.com/hyperic/sigar/pull/60)([commit](https://github.com/kostya/sigar/commit/dfe8fe))
31
+ * 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))
23
32
 
24
33
 
25
34
  ## Installation:
data/Rakefile CHANGED
@@ -27,7 +27,6 @@ spec = Gem::Specification.new do |s|
27
27
  s.email = props['project.email']
28
28
  s.homepage = props['project.homepage']
29
29
  s.platform = Gem::Platform::RUBY
30
- s.has_rdoc = false
31
30
  s.extensions = 'bindings/ruby/extconf.rb'
32
31
  s.files =
33
32
  %w(LICENSE NOTICE README.md Rakefile version.properties) +
@@ -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) {
@@ -1899,7 +1965,7 @@ int sigar_proc_fd_get(sigar_t *sigar, sigar_pid_t pid,
1899
1965
  free(ofiles);
1900
1966
  #else
1901
1967
  /* seems the same as the above */
1902
- procfd->total = filed.fd_lastfile;
1968
+ procfd->total = filed.fd_nfiles;
1903
1969
  #endif
1904
1970
 
1905
1971
  return SIGAR_OK;
@@ -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;
data/version.properties CHANGED
@@ -1,7 +1,7 @@
1
1
  copyright.year=2004-2011
2
2
  version.major=2
3
3
  version.minor=0
4
- version.maint=5
4
+ version.maint=9
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.5
4
+ version: 2.0.9
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-12-02 00:00:00.000000000 Z
11
+ date: 2021-06-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: System Information Gatherer And Reporter
14
14
  email: sigar-users@hyperic.org
@@ -73,17 +73,16 @@ require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ! '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ! '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.6.6
85
+ rubygems_version: 3.1.2
87
86
  signing_key:
88
87
  specification_version: 4
89
88
  summary: System Information Gatherer And Reporter