Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9691f4bbf7 | ||
|
|
b78b558fb7 | ||
|
|
01df5b7739 | ||
|
|
d521805a2d | ||
|
|
7898cebf27 | ||
|
|
68ba944840 | ||
|
|
ad39547629 | ||
|
|
c5f71e36b7 | ||
|
|
ad4ff7f83f | ||
|
|
2bb67fa1bf | ||
|
|
4aeac4dfe8 | ||
|
|
2c5dd8b674 | ||
|
|
d88f2121b8 | ||
|
|
621764c13d | ||
|
|
cd07923dd2 | ||
|
|
0d4fe42927 | ||
|
|
369e5b093e | ||
|
|
9f05d47620 | ||
|
|
9b60875c06 | ||
|
|
163745ad5d |
No files matched your search
@@ -1,23 +1,35 @@
|
|||||||
# System Information Gatherer And Reporter.
|
# System Information Gatherer And Reporter.
|
||||||
|
|
||||||
Fork of hyperic/sigar with some fixes. Support only ruby binding.
|
Fork of hyperic/sigar with some fixes. Support only ruby binding. Part of [Eye gem](https://github.com/kostya/eye).
|
||||||
|
|
||||||
## Fixed:
|
## Fixed:
|
||||||
|
|
||||||
[2.0.0]
|
### [2.0.9] 28-06-2021
|
||||||
|
* Fix compilation on FreeBSD 13 [#8](https://github.com/kostya/sigar/issues/10)([commit](https://github.com/kostya/sigar/commit/b78b558fb756a75dc7d6cbf704423be3c7098ae5))
|
||||||
|
|
||||||
|
### [2.0.8] 02-10-2020
|
||||||
|
* Fix compilation on MacOS [#8](https://github.com/kostya/sigar/issues/8)([commit](https://github.com/kostya/sigar/pull/9/commits/ad39547629fa328e115f7d7bc3c7c358247d1961))
|
||||||
|
|
||||||
|
### [2.0.6] 18-01-2019
|
||||||
|
* Fix compilation on FreeBSD 12 [#6](https://github.com/kostya/sigar/issues/6)([commit](https://github.com/kostya/sigar/commit/2bb67fa1bf6f6f0ddc2626cf028bcc0e4a8cb377))
|
||||||
|
|
||||||
|
### [2.0.5] 02-12-2018
|
||||||
|
* Fix compilation with musl libc [#4](https://github.com/kostya/sigar/pull/4)([commit](https://github.com/kostya/sigar/pull/4/commits/cd07923dd2ed34aca353dfd182f2f85c13853fd9))
|
||||||
|
|
||||||
|
### [2.0.4] 10-06-2018
|
||||||
|
* 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))
|
||||||
|
|
||||||
|
### [2.0.2] 30-05-2018
|
||||||
|
* 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))
|
||||||
|
|
||||||
|
### [2.0.1] 10-04-2018
|
||||||
|
* FreeBSD: don't use v_cache_min/max [#68](https://github.com/hyperic/sigar/pull/68)([commit](https://github.com/kostya/sigar/commit/800076db97bcacb1ba90805d740b4f9a5a1d3cca))
|
||||||
|
|
||||||
|
### [2.0.0] 22-01-2018
|
||||||
* sigfaulted logger, [#28](https://github.com/hyperic/sigar/pull/28)([commit](https://github.com/kostya/sigar/commit/c2a1af))
|
* sigfaulted logger, [#28](https://github.com/hyperic/sigar/pull/28)([commit](https://github.com/kostya/sigar/commit/c2a1af))
|
||||||
* bug undefined symbol: sigar_skip_token, [#60](https://github.com/hyperic/sigar/pull/60)([commit](https://github.com/kostya/sigar/commit/dfe8fe))
|
* bug undefined symbol: sigar_skip_token, [#60](https://github.com/hyperic/sigar/pull/60)([commit](https://github.com/kostya/sigar/commit/dfe8fe))
|
||||||
* 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))
|
* 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))
|
||||||
|
|
||||||
[2.0.1]
|
|
||||||
* FreeBSD: don't use v_cache_min/max [#68](https://github.com/hyperic/sigar/pull/68)([commit](https://github.com/kostya/sigar/commit/800076db97bcacb1ba90805d740b4f9a5a1d3cca))
|
|
||||||
|
|
||||||
[2.0.2]
|
|
||||||
* Remove obsolete rpc usage (fix compilation fail with glibc 2.27) ([commit](https://github.com/kostya/sigar/commit/a971b9e8e1443fdf236c5ffa199c1994c05fcd4b))
|
|
||||||
|
|
||||||
[2.0.4]
|
|
||||||
* fix compilation with glibc 2.26, major/minor functions ([commit](https://github.com/kostya/sigar/commit/a2c67588d0f686e0007dadcaf0e4bbb35c0e1e83))
|
|
||||||
|
|
||||||
|
|
||||||
## Installation:
|
## Installation:
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ spec = Gem::Specification.new do |s|
|
|||||||
s.email = props['project.email']
|
s.email = props['project.email']
|
||||||
s.homepage = props['project.homepage']
|
s.homepage = props['project.homepage']
|
||||||
s.platform = Gem::Platform::RUBY
|
s.platform = Gem::Platform::RUBY
|
||||||
s.has_rdoc = false
|
|
||||||
s.extensions = 'bindings/ruby/extconf.rb'
|
s.extensions = 'bindings/ruby/extconf.rb'
|
||||||
s.files =
|
s.files =
|
||||||
%w(LICENSE NOTICE README.md Rakefile version.properties) +
|
%w(LICENSE NOTICE README.md Rakefile version.properties) +
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include "sigar.h"
|
#include "sigar.h"
|
||||||
#include "sigar_fileinfo.h"
|
#include "sigar_fileinfo.h"
|
||||||
#include "sigar_format.h"
|
#include "sigar_format.h"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "kostya-sigar"
|
s.name = "kostya-sigar"
|
||||||
s.version = "2.0.2"
|
s.version = "2.0.9"
|
||||||
|
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
|||||||
@@ -123,6 +123,69 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SIGAR_FREEBSD5)
|
#if defined(SIGAR_FREEBSD5)
|
||||||
|
#if __FreeBSD_version >= 1200028
|
||||||
|
#define VMMETER_TYPE uint64_t
|
||||||
|
#else
|
||||||
|
#define VMMETER_TYPE u_int
|
||||||
|
#endif
|
||||||
|
struct __vmmeter {
|
||||||
|
VMMETER_TYPE v_vm_faults;
|
||||||
|
VMMETER_TYPE v_io_faults;
|
||||||
|
VMMETER_TYPE v_cow_faults;
|
||||||
|
VMMETER_TYPE v_cow_optim;
|
||||||
|
VMMETER_TYPE v_zfod;
|
||||||
|
VMMETER_TYPE v_ozfod;
|
||||||
|
VMMETER_TYPE v_swapin;
|
||||||
|
VMMETER_TYPE v_swapout;
|
||||||
|
VMMETER_TYPE v_swappgsin;
|
||||||
|
VMMETER_TYPE v_swappgsout;
|
||||||
|
VMMETER_TYPE v_vnodein;
|
||||||
|
VMMETER_TYPE v_vnodeout;
|
||||||
|
VMMETER_TYPE v_vnodepgsin;
|
||||||
|
VMMETER_TYPE v_vnodepgsout;
|
||||||
|
VMMETER_TYPE v_intrans;
|
||||||
|
VMMETER_TYPE v_reactivated;
|
||||||
|
VMMETER_TYPE v_pdwakeups;
|
||||||
|
VMMETER_TYPE v_pdpages;
|
||||||
|
VMMETER_TYPE v_pdshortfalls;
|
||||||
|
VMMETER_TYPE v_dfree;
|
||||||
|
VMMETER_TYPE v_pfree;
|
||||||
|
VMMETER_TYPE v_tfree;
|
||||||
|
VMMETER_TYPE v_forks;
|
||||||
|
VMMETER_TYPE v_vforks;
|
||||||
|
VMMETER_TYPE v_rforks;
|
||||||
|
VMMETER_TYPE v_kthreads;
|
||||||
|
VMMETER_TYPE v_forkpages;
|
||||||
|
VMMETER_TYPE v_vforkpages;
|
||||||
|
VMMETER_TYPE v_rforkpages;
|
||||||
|
VMMETER_TYPE v_kthreadpages;
|
||||||
|
VMMETER_TYPE v_swtch;
|
||||||
|
VMMETER_TYPE v_syscall;
|
||||||
|
VMMETER_TYPE v_trap;
|
||||||
|
VMMETER_TYPE v_intr;
|
||||||
|
VMMETER_TYPE v_soft;
|
||||||
|
u_int v_page_size;
|
||||||
|
u_int v_page_count;
|
||||||
|
u_int v_free_reserved;
|
||||||
|
u_int v_free_target;
|
||||||
|
u_int v_free_min;
|
||||||
|
u_int v_free_count;
|
||||||
|
u_int v_wire_count;
|
||||||
|
u_int v_active_count;
|
||||||
|
u_int v_inactive_target;
|
||||||
|
u_int v_inactive_count;
|
||||||
|
u_int v_laundry_count;
|
||||||
|
u_int v_pageout_free_min;
|
||||||
|
u_int v_interrupt_free_min;
|
||||||
|
u_int v_free_severe;
|
||||||
|
#if (__FreeBSD_version < 1200016)
|
||||||
|
u_int v_cache_count;
|
||||||
|
#endif
|
||||||
|
#if (__FreeBSD_version < 1100079)
|
||||||
|
u_int v_cache_min;
|
||||||
|
u_int v_cache_max;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
#define KI_FD ki_fd
|
#define KI_FD ki_fd
|
||||||
#define KI_PID ki_pid
|
#define KI_PID ki_pid
|
||||||
@@ -342,24 +405,21 @@ static int sigar_vmstat(sigar_t *sigar, vm_statistics_data_t *vmstat)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
static int sigar_vmstat(sigar_t *sigar, struct vmmeter *vmstat)
|
static int sigar_vmstat(sigar_t *sigar, struct __vmmeter *vmstat)
|
||||||
{
|
{
|
||||||
int status;
|
size_t size;
|
||||||
size_t size = sizeof(unsigned int);
|
|
||||||
|
|
||||||
status = kread(sigar, vmstat, sizeof(*vmstat),
|
|
||||||
sigar->koffsets[KOFFSET_VMMETER]);
|
|
||||||
|
|
||||||
if (status == SIGAR_OK) {
|
|
||||||
return SIGAR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
SIGAR_ZERO(vmstat);
|
SIGAR_ZERO(vmstat);
|
||||||
|
|
||||||
/* derived from src/usr.bin/vmstat/vmstat.c */
|
/* derived from src/usr.bin/vmstat/vmstat.c */
|
||||||
/* only collect the ones we actually use */
|
/* only collect the ones we actually use */
|
||||||
#define GET_VM_STATS(cat, name, used) \
|
#define GET_VM_STATS(cat, name, used) do { \
|
||||||
if (used) sysctlbyname("vm.stats." #cat "." #name, &vmstat->name, &size, NULL, 0)
|
if (used) { \
|
||||||
|
size = sizeof(vmstat->name); \
|
||||||
|
sysctlbyname("vm.stats." #cat "." #name, &vmstat->name, \
|
||||||
|
&size, NULL, 0); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* sys */
|
/* sys */
|
||||||
GET_VM_STATS(sys, v_swtch, 0);
|
GET_VM_STATS(sys, v_swtch, 0);
|
||||||
@@ -399,8 +459,10 @@ static int sigar_vmstat(sigar_t *sigar, struct vmmeter *vmstat)
|
|||||||
GET_VM_STATS(vm, v_active_count, 0);
|
GET_VM_STATS(vm, v_active_count, 0);
|
||||||
GET_VM_STATS(vm, v_inactive_target, 0);
|
GET_VM_STATS(vm, v_inactive_target, 0);
|
||||||
GET_VM_STATS(vm, v_inactive_count, 1);
|
GET_VM_STATS(vm, v_inactive_count, 1);
|
||||||
|
#if (__FreeBSD_version < 1200016 )
|
||||||
GET_VM_STATS(vm, v_cache_count, 1);
|
GET_VM_STATS(vm, v_cache_count, 1);
|
||||||
#if (__FreeBSD_version < 1100079)
|
#endif
|
||||||
|
#if (__FreeBSD_version < 1100079 )
|
||||||
GET_VM_STATS(vm, v_cache_min, 0);
|
GET_VM_STATS(vm, v_cache_min, 0);
|
||||||
GET_VM_STATS(vm, v_cache_max, 0);
|
GET_VM_STATS(vm, v_cache_max, 0);
|
||||||
#endif
|
#endif
|
||||||
@@ -442,7 +504,7 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
|||||||
unsigned long mem_total;
|
unsigned long mem_total;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
struct vmmeter vmstat;
|
struct __vmmeter vmstat;
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
struct uvmexp vmstat;
|
struct uvmexp vmstat;
|
||||||
#endif
|
#endif
|
||||||
@@ -481,7 +543,11 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
|||||||
kern *= sigar->pagesize;
|
kern *= sigar->pagesize;
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
if ((status = sigar_vmstat(sigar, &vmstat)) == SIGAR_OK) {
|
if ((status = sigar_vmstat(sigar, &vmstat)) == SIGAR_OK) {
|
||||||
|
#if (__FreeBSD_version < 1200016 )
|
||||||
kern = vmstat.v_cache_count + vmstat.v_inactive_count;
|
kern = vmstat.v_cache_count + vmstat.v_inactive_count;
|
||||||
|
#else
|
||||||
|
kern = vmstat.v_inactive_count;
|
||||||
|
#endif
|
||||||
kern *= sigar->pagesize;
|
kern *= sigar->pagesize;
|
||||||
mem->free = vmstat.v_free_count;
|
mem->free = vmstat.v_free_count;
|
||||||
mem->free *= sigar->pagesize;
|
mem->free *= sigar->pagesize;
|
||||||
@@ -691,7 +757,7 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||||||
swap->page_out = vmstat.pageouts;
|
swap->page_out = vmstat.pageouts;
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
struct kvm_swap kswap[1];
|
struct kvm_swap kswap[1];
|
||||||
struct vmmeter vmstat;
|
struct __vmmeter vmstat;
|
||||||
|
|
||||||
if (getswapinfo_sysctl(kswap, 1) != SIGAR_OK) {
|
if (getswapinfo_sysctl(kswap, 1) != SIGAR_OK) {
|
||||||
if (!sigar->kmem) {
|
if (!sigar->kmem) {
|
||||||
@@ -1899,7 +1965,7 @@ int sigar_proc_fd_get(sigar_t *sigar, sigar_pid_t pid,
|
|||||||
free(ofiles);
|
free(ofiles);
|
||||||
#else
|
#else
|
||||||
/* seems the same as the above */
|
/* seems the same as the above */
|
||||||
procfd->total = filed.fd_lastfile;
|
procfd->total = filed.fd_nfiles;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return SIGAR_OK;
|
return SIGAR_OK;
|
||||||
@@ -3057,8 +3123,13 @@ static int net_connection_get(sigar_net_connection_walker_t *walker, int proto)
|
|||||||
int type, istcp = 0;
|
int type, istcp = 0;
|
||||||
char *buf;
|
char *buf;
|
||||||
const char *mibvar;
|
const char *mibvar;
|
||||||
|
#if defined(__FreeBSD__) && (__FreeBSD_version >= 1200026)
|
||||||
|
struct xtcpcb *tp = NULL;
|
||||||
|
struct xinpcb *inp;
|
||||||
|
#else
|
||||||
struct tcpcb *tp = NULL;
|
struct tcpcb *tp = NULL;
|
||||||
struct inpcb *inp;
|
struct inpcb *inp;
|
||||||
|
#endif
|
||||||
struct xinpgen *xig, *oxig;
|
struct xinpgen *xig, *oxig;
|
||||||
struct xsocket *so;
|
struct xsocket *so;
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -3096,6 +3167,15 @@ static int net_connection_get(sigar_net_connection_walker_t *walker, int proto)
|
|||||||
xig->xig_len > sizeof(struct xinpgen);
|
xig->xig_len > sizeof(struct xinpgen);
|
||||||
xig = (struct xinpgen *)((char *)xig + xig->xig_len))
|
xig = (struct xinpgen *)((char *)xig + xig->xig_len))
|
||||||
{
|
{
|
||||||
|
#if defined(__FreeBSD__) && (__FreeBSD_version >= 1200026)
|
||||||
|
if (istcp) {
|
||||||
|
tp = (struct xtcpcb *)xig;
|
||||||
|
inp = &tp->xt_inp;
|
||||||
|
} else {
|
||||||
|
inp = (struct xinpcb *)xig;
|
||||||
|
}
|
||||||
|
so = &inp->xi_socket;
|
||||||
|
#else
|
||||||
if (istcp) {
|
if (istcp) {
|
||||||
struct xtcpcb *cb = (struct xtcpcb *)xig;
|
struct xtcpcb *cb = (struct xtcpcb *)xig;
|
||||||
tp = &cb->xt_tp;
|
tp = &cb->xt_tp;
|
||||||
@@ -3107,6 +3187,7 @@ static int net_connection_get(sigar_net_connection_walker_t *walker, int proto)
|
|||||||
inp = &cb->xi_inp;
|
inp = &cb->xi_inp;
|
||||||
so = &cb->xi_socket;
|
so = &cb->xi_socket;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (so->xso_protocol != proto) {
|
if (so->xso_protocol != proto) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -50,6 +50,10 @@
|
|||||||
#define PROC_PARTITIONS PROC_FS_ROOT "partitions"
|
#define PROC_PARTITIONS PROC_FS_ROOT "partitions"
|
||||||
#define PROC_DISKSTATS PROC_FS_ROOT "diskstats"
|
#define PROC_DISKSTATS PROC_FS_ROOT "diskstats"
|
||||||
|
|
||||||
|
#ifndef HZ
|
||||||
|
#define HZ 100
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* /proc/self/stat fields:
|
* /proc/self/stat fields:
|
||||||
* 1 - pid
|
* 1 - pid
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ struct sigar_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define HAVE_STRERROR_R
|
#define HAVE_STRERROR_R
|
||||||
#ifndef __USE_XOPEN2K
|
#if !defined(__USE_XOPEN2K) && defined(__GLIBC__)
|
||||||
/* use gnu version of strerror_r */
|
/* use gnu version of strerror_r */
|
||||||
#define HAVE_STRERROR_R_GLIBC
|
#define HAVE_STRERROR_R_GLIBC
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
copyright.year=2004-2011
|
copyright.year=2004-2011
|
||||||
version.major=2
|
version.major=2
|
||||||
version.minor=0
|
version.minor=0
|
||||||
version.maint=4
|
version.maint=9
|
||||||
version.build=0
|
version.build=0
|
||||||
project.name=kostya-sigar
|
project.name=kostya-sigar
|
||||||
project.author=Doug MacEachern
|
project.author=Doug MacEachern
|
||||||
|
|||||||
Reference in new issue
Block a user