monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

monit CHANGES.txt PLATFORMS configure.ac proces...


From: Martin Pala
Subject: monit CHANGES.txt PLATFORMS configure.ac proces...
Date: Tue, 20 Jun 2006 23:18:40 +0000

CVSROOT:        /sources/monit
Module name:    monit
Changes by:     Martin Pala <martinp>   06/06/20 23:18:40

Modified files:
        .              : CHANGES.txt PLATFORMS configure.ac 
        process        : sysdep_DARWIN.c 

Log message:
        fix the mac os x port build and implement the per-process memory 
monitoring for it

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/monit/CHANGES.txt?cvsroot=monit&r1=1.302&r2=1.303
http://cvs.savannah.gnu.org/viewcvs/monit/PLATFORMS?cvsroot=monit&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/monit/configure.ac?cvsroot=monit&r1=1.138&r2=1.139
http://cvs.savannah.gnu.org/viewcvs/monit/process/sysdep_DARWIN.c?cvsroot=monit&r1=1.26&r2=1.27

Patches:
Index: CHANGES.txt
===================================================================
RCS file: /sources/monit/monit/CHANGES.txt,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -b -r1.302 -r1.303
--- CHANGES.txt 6 Jun 2006 11:05:58 -0000       1.302
+++ CHANGES.txt 20 Jun 2006 23:18:40 -0000      1.303
@@ -8,6 +8,9 @@
 * Fix the sun-sshd socket close warning for ssh protocol
   test.
 
+* Fix the Mac OS X 10.4.x / Darwin 8.x build and implement
+  the process memory usage monitoring for this platform
+
 
 Version 4.8.1
 

Index: PLATFORMS
===================================================================
RCS file: /sources/monit/monit/PLATFORMS,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- PLATFORMS   5 Feb 2006 04:04:20 -0000       1.17
+++ PLATFORMS   20 Jun 2006 23:18:40 -0000      1.18
@@ -95,13 +95,8 @@
 Darwin (Mac OS X)
 =================
 
-Monit currently doesn't show per-process memory usage on Darwin. You
-will see 0 as the value of this property.
+Monit compiles out of the box on Mac OS X.
 
-Monit compiles and was tested on Darwin 7.x. On Darwin 8.x (Tiger), 
-Apple has changed some systems interfaces, until monit is updated
-use './configure --without-resource' to build monit. Resource tests
-are unavailable but otherwise monit works well on Mac OS X 10.4.x
 
 
 Any other not yet mentioned but posix compatible platform

Index: configure.ac
===================================================================
RCS file: /sources/monit/monit/configure.ac,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -b -r1.138 -r1.139
--- configure.ac        6 Jun 2006 11:05:58 -0000       1.138
+++ configure.ac        20 Jun 2006 23:18:40 -0000      1.139
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 # Mark Ferlatte, <address@hidden>
 #
-# $Id: configure.ac,v 1.138 2006/06/06 11:05:58 martinp Exp $
+# $Id: configure.ac,v 1.139 2006/06/20 23:18:40 martinp Exp $
 
 # autoconf requirement
 AC_PREREQ([2.53])
@@ -10,7 +10,7 @@
 AC_INIT([monit], [4.8.2-cvs], address@hidden)
 
 # Package info
-AC_REVISION([$Revision: 1.138 $])
+AC_REVISION([$Revision: 1.139 $])
 AC_CONFIG_SRCDIR([monitor.c])
 
 # ------------------------------------------------------------------------
@@ -81,6 +81,7 @@
        loadavg.h \
        locale.h \
         mach/host_info.h \
+        mach/mach.h \
         mach/mach_host.h \
        memory.h \
        mntent.h \

Index: process/sysdep_DARWIN.c
===================================================================
RCS file: /sources/monit/monit/process/sysdep_DARWIN.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- process/sysdep_DARWIN.c     27 Apr 2006 20:16:03 -0000      1.26
+++ process/sysdep_DARWIN.c     20 Jun 2006 23:18:40 -0000      1.27
@@ -44,6 +44,10 @@
 #include <sys/vmmeter.h>
 #endif
 
+#ifdef HAVE_MACH_MACH_H
+#include <mach/mach.h>
+#endif
+
 #ifdef HAVE_MACH_HOST_INFO_H
 #include <mach/host_info.h>
 #endif
@@ -65,7 +69,7 @@
  *  @author Rory Toma <address@hidden>
  *  @author Martin Pala <address@hidden>
  *
- *  @version \$Id: sysdep_DARWIN.c,v 1.26 2006/04/27 20:16:03 martinp Exp $
+ *  @version \$Id: sysdep_DARWIN.c,v 1.27 2006/06/20 23:18:40 martinp Exp $
  *
  *  @file
  */
@@ -140,8 +144,9 @@
   int                i;
   int                treesize;
   static kvm_t      *kvm_handle;
-  ProcessTree_T     *pt;
   struct kinfo_proc *pinfo;
+  ProcessTree_T     *pt;
+
 
   if(getuid()!=0) {
     LogError("system statistic error -- permission denied\n");
@@ -166,17 +171,27 @@
 
   for(i = 0; i < treesize; i++)
   {
+    mach_port_t task;
+
     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].mem_kbyte = (unsigned long)(pinfo[i].kp_eproc.e_vm.vm_rssize * 
pagesize_kbyte);
     if(pinfo[i].kp_proc.p_stat == SZOMB)
     {
       pt[i].status_flag |= PROCESS_ZOMBIE;
     }
     pt[i].time = get_float_time();
+
+    if(task_for_pid(mach_task_self(), pt[i].pid, &task) == KERN_SUCCESS) {
+      task_basic_info_data_t info;
+      mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT;
+
+      if(task_info(task, TASK_BASIC_INFO, (task_info_t)&info, &count) == 
KERN_SUCCESS) {
+        pt[i].mem_kbyte = (unsigned long)(info.resident_size / 1024);
+      }
+    }
   }
 
   *reference = pt;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]