use kvm_getproc2, ok maintainer Ben Lovett.

This commit is contained in:
sthen 2010-10-30 21:14:00 +00:00
parent 3d84b3442f
commit 7723377a41
2 changed files with 46 additions and 7 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.18 2010/10/19 07:43:01 espie Exp $
# $OpenBSD: Makefile,v 1.19 2010/10/30 21:14:00 sthen Exp $
COMMENT= monitoring and managing daemons utility
DISTNAME= monit-4.10.1
PKGNAME= ${DISTNAME}p0
REVISION= 1
CATEGORIES= sysutils
@ -16,7 +16,8 @@ PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= c crypto kvm pthread ssl
WANTLIB += c crypto kvm pthread ssl
MASTER_SITES= ${HOMEPAGE}dist/ \
${HOMEPAGE}dist/old/
@ -24,7 +25,7 @@ MASTER_SITES= ${HOMEPAGE}dist/ \
CONFIGURE_STYLE=gnu
USE_GMAKE= Yes
USE_GROFF = Yes
USE_GROFF= Yes
NO_REGRESS= Yes

View File

@ -1,6 +1,6 @@
$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
$OpenBSD: patch-process_sysdep_OPENBSD_c,v 1.4 2010/10/30 21:14:00 sthen Exp $
--- process/sysdep_OPENBSD.c.orig Sun Jul 29 22:23:26 2007
+++ process/sysdep_OPENBSD.c Tue Oct 26 02:06:53 2010
@@ -90,6 +90,7 @@ static long cpu_syst_old = 0;
int init_process_info_sysdep(void) {
int mib[2];
@ -28,3 +28,41 @@ $OpenBSD: patch-process_sysdep_OPENBSD_c,v 1.3 2008/02/28 18:30:08 okan Exp $
mib[1] = HW_PAGESIZE;
len = sizeof(pagesize_kbyte);
@@ -144,7 +145,7 @@ int initprocesstree_sysdep(ProcessTree_T ** reference)
int treesize;
static kvm_t *kvm_handle;
ProcessTree_T *pt;
- struct kinfo_proc *pinfo;
+ struct kinfo_proc2 *pinfo;
if(getuid()!=0) {
LogError("system statistic error -- permission denied\n");
@@ -157,7 +158,7 @@ int initprocesstree_sysdep(ProcessTree_T ** reference)
return FALSE;
}
- pinfo = kvm_getprocs(kvm_handle, KERN_PROC_ALL, 0, &treesize);
+ pinfo = kvm_getproc2(kvm_handle, KERN_PROC_ALL, 0, sizeof(treesize), &treesize);
if(!pinfo || (treesize < 1))
{
LogError("system statistic error -- cannot get process tree\n");
@@ -169,13 +170,13 @@ int initprocesstree_sysdep(ProcessTree_T ** reference)
for(i = 0; i < treesize; i++)
{
- pt[i].pid = pinfo[i].kp_proc.p_pid;
- pt[i].ppid = pinfo[i].kp_eproc.e_ppid;
- pt[i].cputime = (long)((pinfo[i].kp_proc.p_rtime.tv_sec * 10) +
- (pinfo[i].kp_proc.p_rtime.tv_usec / 100000)
+ pt[i].pid = pinfo[i].p_pid;
+ pt[i].ppid = pinfo[i].p_ppid;
+ pt[i].cputime = (long)((pinfo[i].p_rtime_sec * 10) +
+ (pinfo[i].p_rtime_usec / 100000)
);
- pt[i].mem_kbyte = (unsigned long)(pinfo[i].kp_eproc.e_vm.vm_rssize * pagesize_kbyte);
- if(pinfo[i].kp_proc.p_stat == SZOMB)
+ pt[i].mem_kbyte = (unsigned long)(pinfo[i].p_vm_rssize * pagesize_kbyte);
+ if(pinfo[i].p_stat == SZOMB)
{
pt[i].status_flag |= PROCESS_ZOMBIE;
}