Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5f71e36b7 | ||
|
|
ad4ff7f83f | ||
|
|
2bb67fa1bf | ||
|
|
4aeac4dfe8 | ||
|
|
2c5dd8b674 | ||
|
|
d88f2121b8 | ||
|
|
621764c13d | ||
|
|
cd07923dd2 | ||
|
|
0d4fe42927 | ||
|
|
369e5b093e | ||
|
|
9f05d47620 | ||
|
|
9b60875c06 | ||
|
|
163745ad5d |
No files matched your search
@@ -1,23 +1,29 @@
|
||||
# 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:
|
||||
|
||||
[2.0.0]
|
||||
### [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))
|
||||
* 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))
|
||||
|
||||
[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:
|
||||
|
||||
|
||||
@@ -123,6 +123,69 @@
|
||||
#endif
|
||||
|
||||
#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_PID ki_pid
|
||||
@@ -342,24 +405,21 @@ static int sigar_vmstat(sigar_t *sigar, vm_statistics_data_t *vmstat)
|
||||
}
|
||||
}
|
||||
#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 = sizeof(unsigned int);
|
||||
|
||||
status = kread(sigar, vmstat, sizeof(*vmstat),
|
||||
sigar->koffsets[KOFFSET_VMMETER]);
|
||||
|
||||
if (status == SIGAR_OK) {
|
||||
return SIGAR_OK;
|
||||
}
|
||||
size_t size;
|
||||
|
||||
SIGAR_ZERO(vmstat);
|
||||
|
||||
/* derived from src/usr.bin/vmstat/vmstat.c */
|
||||
/* only collect the ones we actually use */
|
||||
#define GET_VM_STATS(cat, name, used) \
|
||||
if (used) sysctlbyname("vm.stats." #cat "." #name, &vmstat->name, &size, NULL, 0)
|
||||
#define GET_VM_STATS(cat, name, used) do { \
|
||||
if (used) { \
|
||||
size = sizeof(vmstat->name); \
|
||||
sysctlbyname("vm.stats." #cat "." #name, &vmstat->name, \
|
||||
&size, NULL, 0); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* sys */
|
||||
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_inactive_target, 0);
|
||||
GET_VM_STATS(vm, v_inactive_count, 1);
|
||||
#if (__FreeBSD_version < 1200016 )
|
||||
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_max, 0);
|
||||
#endif
|
||||
@@ -442,7 +504,7 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
||||
unsigned long mem_total;
|
||||
#endif
|
||||
#if defined(__FreeBSD__)
|
||||
struct vmmeter vmstat;
|
||||
struct __vmmeter vmstat;
|
||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
struct uvmexp vmstat;
|
||||
#endif
|
||||
@@ -481,7 +543,11 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
||||
kern *= sigar->pagesize;
|
||||
#elif defined(__FreeBSD__)
|
||||
if ((status = sigar_vmstat(sigar, &vmstat)) == SIGAR_OK) {
|
||||
#if (__FreeBSD_version < 1200016 )
|
||||
kern = vmstat.v_cache_count + vmstat.v_inactive_count;
|
||||
#else
|
||||
kern = vmstat.v_inactive_count;
|
||||
#endif
|
||||
kern *= sigar->pagesize;
|
||||
mem->free = vmstat.v_free_count;
|
||||
mem->free *= sigar->pagesize;
|
||||
@@ -691,7 +757,7 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
||||
swap->page_out = vmstat.pageouts;
|
||||
#elif defined(__FreeBSD__)
|
||||
struct kvm_swap kswap[1];
|
||||
struct vmmeter vmstat;
|
||||
struct __vmmeter vmstat;
|
||||
|
||||
if (getswapinfo_sysctl(kswap, 1) != SIGAR_OK) {
|
||||
if (!sigar->kmem) {
|
||||
@@ -3057,8 +3123,13 @@ static int net_connection_get(sigar_net_connection_walker_t *walker, int proto)
|
||||
int type, istcp = 0;
|
||||
char *buf;
|
||||
const char *mibvar;
|
||||
#if defined(__FreeBSD__) && (__FreeBSD_version >= 1200026)
|
||||
struct xtcpcb *tp = NULL;
|
||||
struct xinpcb *inp;
|
||||
#else
|
||||
struct tcpcb *tp = NULL;
|
||||
struct inpcb *inp;
|
||||
#endif
|
||||
struct xinpgen *xig, *oxig;
|
||||
struct xsocket *so;
|
||||
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 = (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) {
|
||||
struct xtcpcb *cb = (struct xtcpcb *)xig;
|
||||
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;
|
||||
so = &cb->xi_socket;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (so->xso_protocol != proto) {
|
||||
continue;
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
#define PROC_PARTITIONS PROC_FS_ROOT "partitions"
|
||||
#define PROC_DISKSTATS PROC_FS_ROOT "diskstats"
|
||||
|
||||
#ifndef HZ
|
||||
#define HZ 100
|
||||
#endif
|
||||
|
||||
/*
|
||||
* /proc/self/stat fields:
|
||||
* 1 - pid
|
||||
|
||||
@@ -70,7 +70,7 @@ struct sigar_t {
|
||||
};
|
||||
|
||||
#define HAVE_STRERROR_R
|
||||
#ifndef __USE_XOPEN2K
|
||||
#if !defined(__USE_XOPEN2K) && defined(__GLIBC__)
|
||||
/* use gnu version of strerror_r */
|
||||
#define HAVE_STRERROR_R_GLIBC
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
copyright.year=2004-2011
|
||||
version.major=2
|
||||
version.minor=0
|
||||
version.maint=4
|
||||
version.maint=6
|
||||
version.build=0
|
||||
project.name=kostya-sigar
|
||||
project.author=Doug MacEachern
|
||||
|
||||
Reference in new issue
Block a user