HW_PHYSMEM64 fix (patch from naddy@)

ok naddy@
This commit is contained in:
okan 2008-02-28 18:30:08 +00:00
parent 201140b5e3
commit 473cd14287
2 changed files with 33 additions and 1 deletions

View File

@ -1,8 +1,10 @@
# $OpenBSD: Makefile,v 1.16 2008/02/01 23:29:42 okan Exp $
# $OpenBSD: Makefile,v 1.17 2008/02/28 18:30:08 okan Exp $
COMMENT= monitoring and managing daemons utility
DISTNAME= monit-4.10.1
PKGNAME= ${DISTNAME}p0
CATEGORIES= sysutils
HOMEPAGE= http://www.tildeslash.com/monit/

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-process_sysdep_OPENBSD_c,v 1.3 2008/02/28 18:30:08 okan Exp $
--- process/sysdep_OPENBSD.c.orig Sun Jul 29 16:23:26 2007
+++ process/sysdep_OPENBSD.c Wed Feb 27 13:26:37 2008
@@ -90,6 +90,7 @@ static long cpu_syst_old = 0;
int init_process_info_sysdep(void) {
int mib[2];
size_t len;
+ int64_t physmem;
struct clockinfo clock;
mib[0] = CTL_KERN;
@@ -112,14 +113,14 @@ int init_process_info_sysdep(void) {
return FALSE;
}
- mib[1] = HW_PHYSMEM;
- len = sizeof(systeminfo.mem_kbyte_max);
- if(sysctl(mib, 2, &systeminfo.mem_kbyte_max, &len, NULL, 0) == -1)
+ mib[1] = HW_PHYSMEM64;
+ len = sizeof(physmem);
+ if(sysctl(mib, 2, &physmem, &len, NULL, 0) == -1)
{
DEBUG("system statistic error -- cannot get real memory amount: %s\n", STRERROR);
return FALSE;
}
- systeminfo.mem_kbyte_max /= 1024;
+ systeminfo.mem_kbyte_max = physmem / 1024;
mib[1] = HW_PAGESIZE;
len = sizeof(pagesize_kbyte);