add macro HAVE_VMMETER_H
parent
9f8acd52e9
commit
f4313d4669
10
make.sh
10
make.sh
|
|
@ -62,6 +62,7 @@ fi
|
||||||
LIBS='-lm'
|
LIBS='-lm'
|
||||||
uname=`uname`
|
uname=`uname`
|
||||||
|
|
||||||
|
HAVE_VMMETER_H=0
|
||||||
if [ "$uname" = "Linux" ]; then
|
if [ "$uname" = "Linux" ]; then
|
||||||
OS_NAME=OS_LINUX
|
OS_NAME=OS_LINUX
|
||||||
IOEVENT_USE=IOEVENT_USE_EPOLL
|
IOEVENT_USE=IOEVENT_USE_EPOLL
|
||||||
|
|
@ -71,6 +72,11 @@ elif [ "$uname" = "FreeBSD" ] || [ "$uname" = "Darwin" ]; then
|
||||||
if [ "$uname" = "Darwin" ]; then
|
if [ "$uname" = "Darwin" ]; then
|
||||||
CFLAGS="$CFLAGS -DDARWIN"
|
CFLAGS="$CFLAGS -DDARWIN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f /usr/include/sys/vmmeter.h ]; then
|
||||||
|
HAVE_VMMETER_H=1
|
||||||
|
fi
|
||||||
|
|
||||||
elif [ "$uname" = "SunOS" ]; then
|
elif [ "$uname" = "SunOS" ]; then
|
||||||
OS_NAME=OS_SUNOS
|
OS_NAME=OS_SUNOS
|
||||||
IOEVENT_USE=IOEVENT_USE_PORT
|
IOEVENT_USE=IOEVENT_USE_PORT
|
||||||
|
|
@ -105,6 +111,10 @@ cat <<EOF > src/_os_define.h
|
||||||
#define $IOEVENT_USE 1
|
#define $IOEVENT_USE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_VMMETER_H
|
||||||
|
#define HAVE_VMMETER_H $HAVE_VMMETER_H
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,6 @@
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <net/if_dl.h>
|
#include <net/if_dl.h>
|
||||||
#include <netinet/if_ether.h>
|
|
||||||
#include <net/route.h>
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,11 @@
|
||||||
#ifdef OS_FREEBSD
|
#ifdef OS_FREEBSD
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/ucred.h>
|
#include <sys/ucred.h>
|
||||||
|
|
||||||
|
#if HAVE_VMMETER_H == 1
|
||||||
#include <sys/vmmeter.h>
|
#include <sys/vmmeter.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -681,7 +685,9 @@ int get_sysinfo(struct fast_sysinfo*info)
|
||||||
int mib[4];
|
int mib[4];
|
||||||
size_t size;
|
size_t size;
|
||||||
struct loadavg loads;
|
struct loadavg loads;
|
||||||
|
#if HAVE_VMMETER_H == 1
|
||||||
struct vmtotal vm;
|
struct vmtotal vm;
|
||||||
|
#endif
|
||||||
struct xsw_usage sw_usage;
|
struct xsw_usage sw_usage;
|
||||||
|
|
||||||
memset(info, 0, sizeof(struct fast_sysinfo));
|
memset(info, 0, sizeof(struct fast_sysinfo));
|
||||||
|
|
@ -723,6 +729,7 @@ int get_sysinfo(struct fast_sysinfo*info)
|
||||||
|
|
||||||
get_sys_total_mem_size((int64_t *)&info->totalram);
|
get_sys_total_mem_size((int64_t *)&info->totalram);
|
||||||
|
|
||||||
|
#if HAVE_VMMETER_H == 1
|
||||||
mib[0] = CTL_VM;
|
mib[0] = CTL_VM;
|
||||||
mib[1] = VM_METER;
|
mib[1] = VM_METER;
|
||||||
size = sizeof(vm);
|
size = sizeof(vm);
|
||||||
|
|
@ -739,6 +746,7 @@ int get_sysinfo(struct fast_sysinfo*info)
|
||||||
info->sharedram = vm.t_rmshr;
|
info->sharedram = vm.t_rmshr;
|
||||||
//info->bufferram = vm. //TODO:
|
//info->bufferram = vm. //TODO:
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mib[0] = CTL_VM;
|
mib[0] = CTL_VM;
|
||||||
mib[1] = VM_SWAPUSAGE;
|
mib[1] = VM_SWAPUSAGE;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue