add macro HAVE_USER_H

pull/10/head
Yu Qing 2016-02-19 14:56:38 +08:00
parent e32e6315b5
commit fa404e98df
3 changed files with 15 additions and 4 deletions

View File

@ -63,6 +63,7 @@ LIBS='-lm'
uname=`uname` uname=`uname`
HAVE_VMMETER_H=0 HAVE_VMMETER_H=0
HAVE_USER_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
@ -77,6 +78,9 @@ elif [ "$uname" = "FreeBSD" ] || [ "$uname" = "Darwin" ]; then
HAVE_VMMETER_H=1 HAVE_VMMETER_H=1
fi fi
if [ -f /usr/include/sys/user.h ]; then
HAVE_USER_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
@ -115,10 +119,12 @@ cat <<EOF > src/_os_define.h
#define HAVE_VMMETER_H $HAVE_VMMETER_H #define HAVE_VMMETER_H $HAVE_VMMETER_H
#endif #endif
#ifndef HAVE_USER_H
#define HAVE_USER_H $HAVE_USER_H
#endif
#endif #endif
EOF EOF
if [ -f /usr/lib/libpthread.so ] || [ -f /usr/local/lib/libpthread.so ] || [ -f /usr/lib64/libpthread.so ] || [ -f /usr/lib/libpthread.a ] || [ -f /usr/local/lib/libpthread.a ] || [ -f /usr/lib64/libpthread.a ]; then if [ -f /usr/lib/libpthread.so ] || [ -f /usr/local/lib/libpthread.so ] || [ -f /usr/lib64/libpthread.so ] || [ -f /usr/lib/libpthread.a ] || [ -f /usr/local/lib/libpthread.a ] || [ -f /usr/lib64/libpthread.a ]; then
LIBS="$LIBS -lpthread" LIBS="$LIBS -lpthread"
elif [ -f /usr/lib/libc_r.so ]; then elif [ -f /usr/lib/libc_r.so ]; then

View File

@ -1994,7 +1994,6 @@ int getifconfigs(FastIFConfig *if_configs, const int max_count, int *count)
freeifaddrs(ifc1); freeifaddrs(ifc1);
printf ("count: %d\n", *count);
for (i=0; i<*count; i++) for (i=0; i<*count; i++)
{ {
getifmac(if_configs + i); getifmac(if_configs + i);

View File

@ -31,7 +31,10 @@
#ifdef OS_FREEBSD #ifdef OS_FREEBSD
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/ucred.h> #include <sys/ucred.h>
#if HAVE_USER_H == 1
#include <sys/user.h> #include <sys/user.h>
#endif
#if HAVE_VMMETER_H == 1 #if HAVE_VMMETER_H == 1
#include <sys/vmmeter.h> #include <sys/vmmeter.h>
@ -765,8 +768,11 @@ int get_sysinfo(struct fast_sysinfo*info)
} }
else else
{ {
info->freeram = vm.t_free; int page_size;
info->sharedram = vm.t_rmshr;
page_size = sysconf(_SC_PAGESIZE);
info->freeram = vm.t_free * page_size;
info->sharedram = vm.t_rmshr * page_size;
//info->bufferram = vm. //TODO: //info->bufferram = vm. //TODO:
} }
#endif #endif