On 2010/10/26 01:10, Stuart Henderson wrote:
> Could somebody using monit on OpenBSD please test this diff.
> 
> Without this monit will break when kinfo_proc is removed.
> I do not expect to see any change in behaviour from the current
> port.
> 
> You do not need guenther@'s kinfo_proc removal diff to test,
> a standard kernel and OS installation is perfectly okay.

sorry, please try this one instead.
 
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/monit/Makefile,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile
--- Makefile    19 Oct 2010 07:43:01 -0000      1.18
+++ Makefile    26 Oct 2010 00:25:26 -0000
@@ -3,7 +3,7 @@
 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
 
Index: patches/patch-process_sysdep_OPENBSD_c
===================================================================
RCS file: /cvs/ports/sysutils/monit/patches/patch-process_sysdep_OPENBSD_c,v
retrieving revision 1.3
diff -u -p -r1.3 patch-process_sysdep_OPENBSD_c
--- patches/patch-process_sysdep_OPENBSD_c      28 Feb 2008 18:30:08 -0000      
1.3
+++ patches/patch-process_sysdep_OPENBSD_c      26 Oct 2010 00:25:26 -0000
@@ -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
+--- 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
  
    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(struct 
kinfo_proc2), &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;
+     }

Reply via email to