monit-dev
[Top][All Lists]
Advanced

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

[monit-dev] [monit] r317 committed - lower memory usage (with 120 monito


From: monit
Subject: [monit-dev] [monit] r317 committed - lower memory usage (with 120 monitored services mem. usage goes from 5...
Date: Tue, 28 Dec 2010 21:01:28 +0000

Revision: 317
Author: address@hidden
Date: Tue Dec 28 13:00:51 2010
Log: lower memory usage (with 120 monitored services mem. usage goes from 548KB to 468KB => ca. 15% saving):

- don't use static buffer for mntpath (it is used only by filesystem checks, so it wastes memory for other check types) - don't use static buffer for token (it is used only when command was sent and only for one service, so it doesn't need to be allocated most of the time) - reduce memory footprint of Info_T by using union for service type specific variables


http://code.google.com/p/monit/source/detail?r=317

Modified:
 /trunk/device/device_common.c
 /trunk/device/sysdep_AIX.c
 /trunk/device/sysdep_DARWIN.c
 /trunk/device/sysdep_FREEBSD.c
 /trunk/device/sysdep_HPUX.c
 /trunk/device/sysdep_LINUX.c
 /trunk/device/sysdep_NETBSD.c
 /trunk/device/sysdep_OPENBSD.c
 /trunk/device/sysdep_SOLARIS.c
 /trunk/device/sysdep_UNKNOWN.c
 /trunk/gc.c
 /trunk/http/cervlet.c
 /trunk/monitor.h
 /trunk/p.y
 /trunk/process.c
 /trunk/spawn.c
 /trunk/util.c
 /trunk/validate.c
 /trunk/xml.c

=======================================
--- /trunk/device/device_common.c       Sat Dec 18 07:17:09 2010
+++ /trunk/device/device_common.c       Tue Dec 28 13:00:51 2010
@@ -99,8 +99,9 @@
   }

   if(S_ISREG(buf.st_mode) || S_ISDIR(buf.st_mode)) {
-    snprintf(inf->mntpath, sizeof(inf->mntpath), "%s", object);
-    return inf->mntpath;
+    FREE(inf->priv.filesystem.mntpath);
+    inf->priv.filesystem.mntpath = xstrdup(object);
+    return inf->priv.filesystem.mntpath;
   } else if(S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) {
     return device_mountpoint_sysdep(inf, object);
   }
@@ -128,7 +129,7 @@
     return FALSE;

   /* save the previous filesystem flags */
-  inf->_flags= inf->flags;
+  inf->priv.filesystem._flags= inf->priv.filesystem.flags;

   return filesystem_usage_sysdep(inf);
 }
=======================================
--- /trunk/device/sysdep_AIX.c  Fri Jan  8 03:20:43 2010
+++ /trunk/device/sysdep_AIX.c  Tue Dec 28 13:00:51 2010
@@ -75,36 +75,26 @@
  * @return         NULL
  */
 char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
-
   struct mntent *mnt;
   FILE          *mntfd;

   ASSERT(inf);
   ASSERT(blockdev);

-
-  if((mntfd= setmntent("/etc/mtab", "r")) == NULL) {
+  if ((mntfd = setmntent("/etc/mtab", "r")) == NULL) {
     LogError("%s: Cannot open /etc/mtab file\n", prog);
     return NULL;
   }
-
-  /* Finf->mntpathirst match is significant */
-  while((mnt= getmntent(mntfd)) != NULL) {
-
-    if(IS(blockdev, mnt->mnt_fsname)) {
-
+  while ((mnt = getmntent(mntfd)) != NULL) {
+    if (IS(blockdev, mnt->mnt_fsname)) {
       endmntent(mntfd);
-      inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
-      return strncpy(inf->mntpath, mnt->mnt_dir, sizeof(inf->mntpath) - 1);
-
-    }
-
-  }
-
+      FREE(inf->priv.filesystem.mntpath);
+      inf->priv.filesystem.mntpath = xstrdup(mnt->mnt_dir);
+      return inf->priv.filesystem.mntpath;
+    }
+  }
   endmntent(mntfd);
-
   return NULL;
-
 }


@@ -116,25 +106,20 @@
  * @return    FALSE
  */
 int filesystem_usage_sysdep(Info_T inf) {
-
   struct statfs usage;

   ASSERT(inf);

-  if(statfs(inf->mntpath, &usage) != 0) {
- LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n",
-        prog, inf->mntpath, STRERROR);
+  if (statfs(inf->priv.filesystem.mntpath, &usage) != 0) {
+ LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->priv.filesystem.mntpath, STRERROR);
     return FALSE;
   }
-
-  inf->f_bsize=           usage.f_bsize;
-  inf->f_blocks=          usage.f_blocks;
-  inf->f_blocksfree=      usage.f_bavail;
-  inf->f_blocksfreetotal= usage.f_bfree;
-  inf->f_files=           usage.f_files;
-  inf->f_filesfree=       usage.f_ffree;
-
+  inf->priv.filesystem.f_bsize =           usage.f_bsize;
+  inf->priv.filesystem.f_blocks =          usage.f_blocks;
+  inf->priv.filesystem.f_blocksfree =      usage.f_bavail;
+  inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree;
+  inf->priv.filesystem.f_files =           usage.f_files;
+  inf->priv.filesystem.f_filesfree =       usage.f_ffree;
   return TRUE;
-
 }

=======================================
--- /trunk/device/sysdep_DARWIN.c       Sun Dec 19 14:13:05 2010
+++ /trunk/device/sysdep_DARWIN.c       Tue Dec 28 13:00:51 2010
@@ -87,9 +87,10 @@
       for (i = 0; i < countfs; i++) {
         struct statfs *sfs = statfs + i;
         if (IS(sfs->f_mntfromname, blockdev)) {
- snprintf(inf->mntpath, sizeof(inf->mntpath), "%s", sfs->f_mntonname);
+          FREE(inf->priv.filesystem.mntpath);
+          inf->priv.filesystem.mntpath = xstrdup(sfs->f_mntonname);
           FREE(statfs);
-          return inf->mntpath;
+          return inf->priv.filesystem.mntpath;
         }
       }
     }
@@ -112,18 +113,17 @@

   ASSERT(inf);

-  if (statfs(inf->mntpath, &usage) != 0) {
- LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->mntpath, STRERROR);
+  if (statfs(inf->priv.filesystem.mntpath, &usage) != 0) {
+ LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->priv.filesystem.mntpath, STRERROR);
     return FALSE;
   }
-  inf->f_bsize =           usage.f_bsize;
-  inf->f_blocks =          usage.f_blocks;
-  inf->f_blocksfree =      usage.f_bavail;
-  inf->f_blocksfreetotal = usage.f_bfree;
-  inf->f_files =           usage.f_files;
-  inf->f_filesfree =       usage.f_ffree;
-  inf->flags =             usage.f_flags;
-
+  inf->priv.filesystem.f_bsize =           usage.f_bsize;
+  inf->priv.filesystem.f_blocks =          usage.f_blocks;
+  inf->priv.filesystem.f_blocksfree =      usage.f_bavail;
+  inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree;
+  inf->priv.filesystem.f_files =           usage.f_files;
+  inf->priv.filesystem.f_filesfree =       usage.f_ffree;
+  inf->priv.filesystem.flags =             usage.f_flags;
   return TRUE;
 }

=======================================
--- /trunk/device/sysdep_FREEBSD.c      Fri Dec 17 16:35:24 2010
+++ /trunk/device/sysdep_FREEBSD.c      Tue Dec 28 13:00:51 2010
@@ -87,9 +87,10 @@
       for (i = 0; i < countfs; i++) {
         struct statfs *sfs = statfs + i;
         if (IS(sfs->f_mntfromname, blockdev)) {
- snprintf(inf->mntpath, sizeof(inf->mntpath), "%s", sfs->f_mntonname);
+          FREE(inf->priv.filesystem.mntpath);
+          inf->priv.filesystem.mntpath = xstrdup(sfs->f_mntonname);
           FREE(statfs);
-          return inf->mntpath;
+          return inf->priv.filesystem.mntpath;
         }
       }
     }
@@ -108,25 +109,22 @@
* @return TRUE if informations were succesfully read otherwise FALSE
  */
 int filesystem_usage_sysdep(Info_T inf) {
-
   struct statfs usage;

   ASSERT(inf);

-  if(statfs(inf->mntpath, &usage) != 0) {
+  if(statfs(inf->priv.filesystem.mntpath, &usage) != 0) {
LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n",
-        prog, inf->mntpath, STRERROR);
+        prog, inf->priv.filesystem.mntpath, STRERROR);
     return FALSE;
   }
-
-  inf->f_bsize=           usage.f_bsize;
-  inf->f_blocks=          usage.f_blocks;
-  inf->f_blocksfree=      usage.f_bavail;
-  inf->f_blocksfreetotal= usage.f_bfree;
-  inf->f_files=           usage.f_files;
-  inf->f_filesfree=       usage.f_ffree;
-  inf->flags=             usage.f_flags;
-
+  inf->priv.filesystem.f_bsize =           usage.f_bsize;
+  inf->priv.filesystem.f_blocks =          usage.f_blocks;
+  inf->priv.filesystem.f_blocksfree =      usage.f_bavail;
+  inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree;
+  inf->priv.filesystem.f_files =           usage.f_files;
+  inf->priv.filesystem.f_filesfree =       usage.f_ffree;
+  inf->priv.filesystem.flags =             usage.f_flags;
   return TRUE;

 }
=======================================
--- /trunk/device/sysdep_HPUX.c Fri Jan  8 03:20:43 2010
+++ /trunk/device/sysdep_HPUX.c Tue Dec 28 13:00:51 2010
@@ -76,36 +76,26 @@
  * @return         NULL in the case of failure otherwise mountpoint
  */
 char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
-
   struct mntent *mnt;
   FILE          *mntfd;

   ASSERT(inf);
   ASSERT(blockdev);

-
-  if((mntfd= setmntent("/etc/mnttab", "r")) == NULL) {
+  if ((mntfd = setmntent("/etc/mnttab", "r")) == NULL) {
     LogError("%s: Cannot open /etc/mnttab file\n", prog);
     return NULL;
   }
-
-  /* First match is significant */
-  while((mnt= getmntent(mntfd)) != NULL) {
-
-    if(IS(blockdev, mnt->mnt_fsname)) {
-
+  while ((mnt = getmntent(mntfd)) != NULL) {
+    if (IS(blockdev, mnt->mnt_fsname)) {
       endmntent(mntfd);
-      inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
-      return strncpy(inf->mntpath, mnt->mnt_dir, sizeof(inf->mntpath) - 1);
-
-    }
-
-  }
-
+      FREE(inf->priv.filesystem.mntpath);
+      inf->priv.filesystem.mntpath = xstrdup(mnt->mnt_dir);
+      return inf->priv.filesystem.mntpath;
+    }
+  }
   endmntent(mntfd);
-
   return NULL;
-
 }


@@ -117,25 +107,20 @@
* @return TRUE if informations were succesfully read otherwise FALSE
  */
 int filesystem_usage_sysdep(Info_T inf) {
-
   struct statfs usage;

   ASSERT(inf);

-  if(statfs(inf->mntpath, &usage) != 0) {
- LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n",
-        prog, inf->mntpath, STRERROR);
+  if (statfs(inf->priv.filesystem.mntpath, &usage) != 0) {
+ LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->priv.filesystem.mntpath, STRERROR);
     return FALSE;
   }
-
-  inf->f_bsize=           usage.f_bsize;
-  inf->f_blocks=          usage.f_blocks;
-  inf->f_blocksfree=      usage.f_bavail;
-  inf->f_blocksfreetotal= usage.f_bfree;
-  inf->f_files=           usage.f_files;
-  inf->f_filesfree=       usage.f_ffree;
-
+  inf->priv.filesystem.f_bsize =           usage.f_bsize;
+  inf->priv.filesystem.f_blocks =          usage.f_blocks;
+  inf->priv.filesystem.f_blocksfree =      usage.f_bavail;
+  inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree;
+  inf->priv.filesystem.f_files =           usage.f_files;
+  inf->priv.filesystem.f_filesfree =       usage.f_ffree;
   return TRUE;
-
 }

=======================================
--- /trunk/device/sysdep_LINUX.c        Sat Dec 18 04:39:45 2010
+++ /trunk/device/sysdep_LINUX.c        Tue Dec 28 13:00:51 2010
@@ -82,21 +82,19 @@
   ASSERT(inf);
   ASSERT(blockdev);

-  if((mntfd= setmntent("/etc/mtab", "r")) == NULL) {
+  if ((mntfd = setmntent("/etc/mtab", "r")) == NULL) {
     LogError("%s: Cannot open /etc/mtab file\n", prog);
     return NULL;
   }
-
-  /* First match is significant */
-  while((mnt= getmntent(mntfd)) != NULL) {
-    if(IS(blockdev, mnt->mnt_fsname)) {
+  while ((mnt = getmntent(mntfd)) != NULL) {
+    if (IS(blockdev, mnt->mnt_fsname)) {
       endmntent(mntfd);
-      inf->mntpath[sizeof(inf->mntpath) - 1] = 0;
-      return strncpy(inf->mntpath, mnt->mnt_dir, sizeof(inf->mntpath) - 1);
+      FREE(inf->priv.filesystem.mntpath);
+      inf->priv.filesystem.mntpath = xstrdup(mnt->mnt_dir);
+      return inf->priv.filesystem.mntpath;
     }
   }
   endmntent(mntfd);
-
   LogError("Device %s not found in /etc/mtab\n", blockdev);
   return NULL;
 }
@@ -110,26 +108,21 @@
* @return TRUE if informations were succesfully read otherwise FALSE
  */
 int filesystem_usage_sysdep(Info_T inf) {
-
   struct statvfs usage;

   ASSERT(inf);

-  if(statvfs(inf->mntpath, &usage) != 0) {
- LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n",
-        prog, inf->mntpath, STRERROR);
+  if (statvfs(inf->priv.filesystem.mntpath, &usage) != 0) {
+ LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->priv.filesystem.mntpath, STRERROR);
     return FALSE;
   }
-
-  inf->f_bsize=           usage.f_bsize;
-  inf->f_blocks=          usage.f_blocks;
-  inf->f_blocksfree=      usage.f_bavail;
-  inf->f_blocksfreetotal= usage.f_bfree;
-  inf->f_files=           usage.f_files;
-  inf->f_filesfree=       usage.f_ffree;
-  inf->flags=             usage.f_flag;
-
+  inf->priv.filesystem.f_bsize =           usage.f_bsize;
+  inf->priv.filesystem.f_blocks =          usage.f_blocks;
+  inf->priv.filesystem.f_blocksfree =      usage.f_bavail;
+  inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree;
+  inf->priv.filesystem.f_files =           usage.f_files;
+  inf->priv.filesystem.f_filesfree =       usage.f_ffree;
+  inf->priv.filesystem.flags =             usage.f_flag;
   return TRUE;
-
 }

=======================================
--- /trunk/device/sysdep_NETBSD.c       Fri Dec 17 16:35:24 2010
+++ /trunk/device/sysdep_NETBSD.c       Tue Dec 28 13:00:51 2010
@@ -90,9 +90,10 @@
       for (i = 0; i < countfs; i++) {
         struct statvfs *sfs = statvfs + i;
         if (IS(sfs->f_mntfromname, blockdev)) {
- snprintf(inf->mntpath, sizeof(inf->mntpath), "%s", sfs->f_mntonname);
+          FREE(inf->priv.filesystem.mntpath);
+          inf->priv.filesystem.mntpath = xstrdup(sfs->f_mntonname);
           FREE(statvfs);
-          return inf->mntpath;
+          return inf->priv.filesystem.mntpath;
         }
       }
     }
@@ -100,7 +101,6 @@
   }
LogError("%s: Error getting mountpoint for filesystem '%s' -- %s\n", prog, blockdev, STRERROR);
   return NULL;
-
 }


@@ -116,19 +116,17 @@

   ASSERT(inf);

-  if(statvfs(inf->mntpath, &usage) != 0) {
- LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->mntpath, STRERROR);
+  if (statvfs(inf->priv.filesystem.mntpath, &usage) != 0) {
+ LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->priv.filesystem.mntpath, STRERROR);
     return FALSE;
   }
-
-  inf->f_bsize=           usage.f_frsize;
-  inf->f_blocks=          usage.f_blocks;
-  inf->f_blocksfree=      usage.f_bavail;
-  inf->f_blocksfreetotal= usage.f_bfree;
-  inf->f_files=           usage.f_files;
-  inf->f_filesfree=       usage.f_ffree;
-  inf->flags=             usage.f_flag;
-
+  inf->priv.filesystem.f_bsize =           usage.f_frsize;
+  inf->priv.filesystem.f_blocks =          usage.f_blocks;
+  inf->priv.filesystem.f_blocksfree =      usage.f_bavail;
+  inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree;
+  inf->priv.filesystem.f_files =           usage.f_files;
+  inf->priv.filesystem.f_filesfree =       usage.f_ffree;
+  inf->priv.filesystem.flags =             usage.f_flag;
   return TRUE;
 }

=======================================
--- /trunk/device/sysdep_OPENBSD.c      Fri Dec 17 16:35:24 2010
+++ /trunk/device/sysdep_OPENBSD.c      Tue Dec 28 13:00:51 2010
@@ -83,9 +83,10 @@
       for (i = 0; i < countfs; i++) {
         struct statfs *sfs = statfs + i;
         if (IS(sfs->f_mntfromname, blockdev)) {
- snprintf(inf->mntpath, sizeof(inf->mntpath), "%s", sfs->f_mntonname);
+          FREE(inf->priv.filesystem.mntpath);
+          inf->priv.filesystem.mntpath = xstrdup(sfs->f_mntonname);
           FREE(statfs);
-          return inf->mntpath;
+          return inf->priv.filesystem.mntpath;
         }
       }
     }
@@ -104,26 +105,21 @@
* @return TRUE if informations were succesfully read otherwise FALSE
  */
 int filesystem_usage_sysdep(Info_T inf) {
-
   struct statfs usage;

   ASSERT(inf);

-  if(statfs(inf->mntpath, &usage) != 0) {
- LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n",
-        prog, inf->mntpath, STRERROR);
+  if (statfs(inf->priv.filesystem.mntpath, &usage) != 0) {
+ LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->priv.filesystem.mntpath, STRERROR);
     return FALSE;
   }
-
-  inf->f_bsize=           usage.f_bsize;
-  inf->f_blocks=          usage.f_blocks;
-  inf->f_blocksfree=      usage.f_bavail;
-  inf->f_blocksfreetotal= usage.f_bfree;
-  inf->f_files=           usage.f_files;
-  inf->f_filesfree=       usage.f_ffree;
-  inf->flags=             usage.f_flags;
-
+  inf->priv.filesystem.f_bsize =           usage.f_bsize;
+  inf->priv.filesystem.f_blocks =          usage.f_blocks;
+  inf->priv.filesystem.f_blocksfree =      usage.f_bavail;
+  inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree;
+  inf->priv.filesystem.f_files =           usage.f_files;
+  inf->priv.filesystem.f_filesfree =       usage.f_ffree;
+  inf->priv.filesystem.flags =             usage.f_flags;
   return TRUE;
-
 }

=======================================
--- /trunk/device/sysdep_SOLARIS.c      Sat Dec 18 07:17:09 2010
+++ /trunk/device/sysdep_SOLARIS.c      Tue Dec 28 13:00:51 2010
@@ -82,20 +82,19 @@
   ASSERT(inf);
   ASSERT(blockdev);

-  if ((mntfd= fopen("/etc/mnttab", "r")) == NULL) {
+  if ((mntfd = fopen("/etc/mnttab", "r")) == NULL) {
     LogError("%s: Cannot open /etc/mnttab file\n", prog);
     return NULL;
   }
-
   while (getmntent(mntfd, &mnt) == 0) {
     char real_mnt_special[PATH_MAX+1];
if (realpath(mnt.mnt_special, real_mnt_special) && IS(real_mnt_special, blockdev)) {
         fclose(mntfd);
-        snprintf(inf->mntpath, sizeof(inf->mntpath), "%s", mnt.mnt_mountp);
-        return inf->mntpath;
+        FREE(inf->priv.filesystem.mntpath);
+        inf->priv.filesystem.mntpath = xstrdup(mnt.mnt_mountp);
+        return inf->priv.filesystem.mntpath;
     }
   }
-
   fclose(mntfd);
   return NULL;
 }
@@ -109,23 +108,23 @@
  * @return TRUE if informations were succesfully read otherwise FALSE
  */
 int filesystem_usage_sysdep(Info_T inf) {
+  int size;
   struct statvfs usage;

   ASSERT(inf);

-  if (statvfs(inf->mntpath, &usage) != 0) {
- LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->mntpath, STRERROR);
+  if (statvfs(inf->priv.filesystem.mntpath, &usage) != 0) {
+ LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->priv.filesystem.mntpath, STRERROR);
     return FALSE;
   }
-
-  inf->f_bsize=           usage.f_bsize;
- inf->f_blocks= usage.f_blocks/(usage.f_frsize?(usage.f_bsize/usage.f_frsize):1); - inf->f_blocksfree= usage.f_bavail/(usage.f_frsize?(usage.f_bsize/usage.f_frsize):1); - inf->f_blocksfreetotal= usage.f_bfree/(usage.f_frsize?(usage.f_bsize/usage.f_frsize):1);
-  inf->f_files=           usage.f_files;
-  inf->f_filesfree=       usage.f_ffree;
-  inf->flags=             usage.f_flag;
-
+ size = usage.f_frsize ? (usage.f_bsize / usage.f_frsize) : 1;
+  inf->priv.filesystem.f_bsize =           usage.f_bsize;
+  inf->priv.filesystem.f_blocks =          usage.f_blocks / size;
+  inf->priv.filesystem.f_blocksfree =      usage.f_bavail / size;
+  inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree  / size;
+  inf->priv.filesystem.f_files =           usage.f_files;
+  inf->priv.filesystem.f_filesfree =       usage.f_ffree;
+  inf->priv.filesystem.flags =             usage.f_flag;
   return TRUE;
 }

=======================================
--- /trunk/device/sysdep_UNKNOWN.c      Fri Jan  8 03:20:43 2010
+++ /trunk/device/sysdep_UNKNOWN.c      Tue Dec 28 13:00:51 2010
@@ -49,11 +49,8 @@
  * @return         NULL
  */
 char *device_mountpoint_sysdep(Info_T inf, char *blockdev) {
-
LogError("%s: Unsupported mounted filesystem information method\n", prog);
-
   return NULL;
-
 }


@@ -64,11 +61,7 @@
  * @return        FALSE
  */
 int filesystem_usage_sysdep(Info_T inf) {
-
-  LogError("%s: Unsupported filesystem informations gathering method\n",
-    prog);
-
+ LogError("%s: Unsupported filesystem informations gathering method\n", prog);
   return FALSE;
-
 }

=======================================
--- /trunk/gc.c Mon Sep 20 14:15:39 2010
+++ /trunk/gc.c Tue Dec 28 13:00:51 2010
@@ -460,6 +460,7 @@

 static void _gc_inf(Info_T *i) {
   ASSERT(i);
+  FREE((*i)->priv.filesystem.mntpath);
   FREE(*i);
 }

=======================================
--- /trunk/http/cervlet.c       Fri Sep 24 11:47:07 2010
+++ /trunk/http/cervlet.c       Tue Dec 28 13:00:51 2010
@@ -607,10 +607,10 @@
     }
     s->doaction = doaction;
     token = get_parameter(req, "token");
-    if (token)
-      snprintf(s->token, sizeof(s->token), "%s", token);
-    else
-      *s->token = 0;
+    if (token) {
+      FREE(s->token);
+      s->token = xstrdup(token);
+    }
     LogInfo("%s service '%s' on user request\n", action, s->name);
     Run.doaction = TRUE; /* set the global flag */
     do_wakeupcall();
@@ -623,10 +623,10 @@
   Service_T s;
   int doaction = ACTION_IGNORE;
   const char *action = get_parameter(req, "action");
+  const char *token = get_parameter(req, "token");

   if(action) {
     HttpParameter p;
-    char *token = NULL;

     if(is_readonly(req)) {
send_error(res, SC_FORBIDDEN, "You do not have sufficent privileges to access this page");
@@ -636,8 +636,6 @@
       send_error(res, SC_BAD_REQUEST, "Invalid action");
       return;
     }
-
-    token = (char *)get_parameter(req, "token");

     for(p= req->params; p; p= p->next) {

@@ -652,26 +650,21 @@
send_error(res, SC_SERVICE_UNAVAILABLE, "Other action already in progress -- please try again later");
           return;
         }
-
         s->doaction = doaction;
-        if (token)
-          snprintf(s->token, sizeof(s->token), "%s", token);
-
         LogInfo("%s service '%s' on user request\n", action, s->name);
       }
     }

+ /* Set token for last service only so we'll get it back after all services were handled */
     if (token) {
       Service_T q = NULL;
-      /* Make sure only the last service gets the service token */
-      for (s = servicelist; s; s = s->next) {
-        if (*s->token) {
-          *s->token = 0;
+      for (s = servicelist; s; s = s->next)
+        if (s->doaction == doaction)
           q = s;
-        }
-      }
-      if (q)
-        snprintf(q->token, sizeof(q->token), "%s", token);
+      if (q) {
+        FREE(q->token);
+        q->token = xstrdup(token);
+      }
     }

     Run.doaction = TRUE;
@@ -985,7 +978,7 @@

     } else {

-      char *uptime= Util_getUptime(s->inf->uptime, "&nbsp;");
+      char *uptime= Util_getUptime(s->inf->priv.process.uptime, "&nbsp;");
       out_print(res,
         "<td align=\"right\">%s</td>", uptime);
       FREE(uptime);
@@ -994,11 +987,11 @@
         out_print(res,
           "<td align=\"right\"><font%s>%.1f%%</font></td>",
           (s->error & Event_Resource)?" color='#ff0000'":"",
-          s->inf->cpu_percent/10.0);
+          s->inf->priv.process.cpu_percent/10.0);
         out_print(res,
"<td align=\"right\"><font%s>%.1f%% [%ld&nbsp;kB]</font></td></tr>",
           (s->error & Event_Resource)?" color='#ff0000'":"",
-          s->inf->mem_percent/10.0, s->inf->mem_kbyte);
+ s->inf->priv.process.mem_percent/10.0, s->inf->priv.process.mem_kbyte);
       }

     }
@@ -1060,15 +1053,15 @@

       out_print(res,
         "<td align=\"right\">%.1f%% [%.1f&nbsp;MB]</td>",
-        s->inf->space_percent/10.,
- s->inf->f_bsize > 0 ? ((float)s->inf->space_total / (float)1048576 * (float)s->inf->f_bsize) : 0);
-
-      if(s->inf->f_files > 0) {
+        s->inf->priv.filesystem.space_percent/10.,
+ s->inf->priv.filesystem.f_bsize > 0 ? ((float)s->inf->priv.filesystem.space_total / (float)1048576 * (float)s->inf->priv.filesystem.f_bsize) : 0);
+
+      if(s->inf->priv.filesystem.f_files > 0) {

         out_print(res,
           "<td align=\"right\">%.1f%% [%ld&nbsp;objects]</td>",
-          s->inf->inode_percent/10.,
-          s->inf->inode_total);
+          s->inf->priv.filesystem.inode_percent/10.,
+          s->inf->priv.filesystem.inode_total);

       } else {

@@ -1144,7 +1137,7 @@
         "<td align=\"right\">%04o</td>"
         "<td align=\"right\">%d</td>"
         "<td align=\"right\">%d</td>",
-        (unsigned long long)s->inf->st_size,
+        (unsigned long long)s->inf->priv.file.st_size,
         s->inf->st_mode & 07777,
         s->inf->st_uid,
         s->inf->st_gid);
@@ -2038,36 +2031,36 @@

       out_print(res,
         "<tr><td>Filesystem flags</td><td>%#lx</td></tr>",
-        s->inf->flags);
+        s->inf->priv.filesystem.flags);
       out_print(res,
         "<tr><td>Blocks total</td><td>%ld [%.1f MB]</td></tr>",
-        s->inf->f_blocks,
- s->inf->f_bsize > 0 ? ((float) s->inf->f_blocks/1048576*s->inf->f_bsize) : 0);
+        s->inf->priv.filesystem.f_blocks,
+ s->inf->priv.filesystem.f_bsize > 0 ? ((float) s->inf->priv.filesystem.f_blocks/1048576*s->inf->priv.filesystem.f_bsize) : 0);
       out_print(res,
         "<tr><td>Blocks free for non superuser</td>"
         "<td>%ld [%.1f MB] [%.1f%%]</td></tr>",
-        s->inf->f_blocksfree,
- s->inf->f_bsize > 0 ? ((float)s->inf->f_blocksfree / (float)1048576 * (float)s->inf->f_bsize) : 0, - s->inf->f_blocks > 0 ? ((float)100 * (float)s->inf->f_blocksfree / (float)s->inf->f_blocks) : 0);
+        s->inf->priv.filesystem.f_blocksfree,
+ s->inf->priv.filesystem.f_bsize > 0 ? ((float)s->inf->priv.filesystem.f_blocksfree / (float)1048576 * (float)s->inf->priv.filesystem.f_bsize) : 0, + s->inf->priv.filesystem.f_blocks > 0 ? ((float)100 * (float)s->inf->priv.filesystem.f_blocksfree / (float)s->inf->priv.filesystem.f_blocks) : 0);
       out_print(res,
         "<tr><td>Blocks free total</td>"
         "<td><font%s>%ld [%.1f MB] [%.1f%%]</font></td></tr>",
         (s->error & Event_Resource)?" color='#ff0000'":"",
-        s->inf->f_blocksfreetotal,
- s->inf->f_bsize > 0 ? ((float)s->inf->f_blocksfreetotal / (float)1048576 * (float)s->inf->f_bsize) : 0, - s->inf->f_blocks > 0 ? ((float)100 * (float)s->inf->f_blocksfreetotal / (float)s->inf->f_blocks) : 0);
+        s->inf->priv.filesystem.f_blocksfreetotal,
+ s->inf->priv.filesystem.f_bsize > 0 ? ((float)s->inf->priv.filesystem.f_blocksfreetotal / (float)1048576 * (float)s->inf->priv.filesystem.f_bsize) : 0, + s->inf->priv.filesystem.f_blocks > 0 ? ((float)100 * (float)s->inf->priv.filesystem.f_blocksfreetotal / (float)s->inf->priv.filesystem.f_blocks) : 0);
       out_print(res,
-        "<tr><td>Block size</td><td>%ld B</td></tr>", s->inf->f_bsize);
-
-      if(s->inf->f_files > 0) {
+ "<tr><td>Block size</td><td>%ld B</td></tr>", s->inf->priv.filesystem.f_bsize);
+
+      if(s->inf->priv.filesystem.f_files > 0) {

         out_print(res,
-          "<tr><td>Inodes total</td><td>%ld</td></tr>", s->inf->f_files);
+ "<tr><td>Inodes total</td><td>%ld</td></tr>", s->inf->priv.filesystem.f_files);
         out_print(res,
"<tr><td>Inodes free</td><td><font%s>%ld [%.1f%%]</font></td></tr>",
           (s->error & Event_Resource)?" color='#ff0000'":"",
-          s->inf->f_filesfree,
- (float)100 * (float)s->inf->f_filesfree / (float)s->inf->f_files);
+          s->inf->priv.filesystem.f_filesfree,
+ (float)100 * (float)s->inf->priv.filesystem.f_filesfree / (float)s->inf->priv.filesystem.f_files);

       }
     }
@@ -2089,7 +2082,7 @@
       out_print(res,
         "<tr><td>Size</td><td><font%s>%llu B</td></tr>",
         (s->error & Event_Size)?" color='#ff0000'":"",
-        (unsigned long long) s->inf->st_size);
+        (unsigned long long) s->inf->priv.file.st_size);

     }
   }
@@ -2127,7 +2120,7 @@

       out_print(res,
         "<tr><td>Checksum</td><td><font%s>%s(%s)</font></td></tr>",
-        (s->error & Event_Checksum)?" color='#ff0000'":"", s->inf->cs_sum,
+ (s->error & Event_Checksum)?" color='#ff0000'":"", s->inf->priv.file.cs_sum,
         checksumnames[s->checksum->type]);

     }
@@ -2152,12 +2145,12 @@

       out_print(res,
         "<tr><td>Process id </td><td>%d</td></tr>",
-        s->inf->pid > 0 ? s->inf->pid : 0);
+        s->inf->priv.process.pid > 0 ? s->inf->priv.process.pid : 0);
       out_print(res,
         "<tr><td>Parent process id </td><td>%d</td></tr>",
-        s->inf->ppid > 0 ? s->inf->ppid : 0);
-
-      uptime= Util_getUptime(s->inf->uptime, "&nbsp;");
+        s->inf->priv.process.ppid > 0 ? s->inf->priv.process.ppid : 0);
+
+      uptime= Util_getUptime(s->inf->priv.process.uptime, "&nbsp;");
       out_print(res,
         "<tr><td>Process uptime</td><td>%s</td></tr>",
         uptime);
@@ -2191,25 +2184,25 @@
         out_print(res,
           "<tr><td>CPU usage</td><td><font%s>%.1f%%</font></td></tr>",
           (s->error & Event_Resource)?" color='#ff0000'":"",
-          s->inf->cpu_percent/10.0);
+          s->inf->priv.process.cpu_percent/10.0);
         out_print(res,
"<tr><td>Memory usage</td><td><font%s>%.1f%% [%ldkB]</font></td></tr>",
           (s->error & Event_Resource)?" color='#ff0000'":"",
-          s->inf->mem_percent/10.0, s->inf->mem_kbyte);
+ s->inf->priv.process.mem_percent/10.0, s->inf->priv.process.mem_kbyte);
         out_print(res,
           "<tr><td>Children</td><td><font%s>%d</font></td></tr>",
           (s->error & Event_Resource)?" color='#ff0000'":"",
-          s->inf->children);
+          s->inf->priv.process.children);
         out_print(res,
           "<tr><td>Total CPU usage (incl. children)</td><td><font%s>%.1f%%"
           "</font></td></tr>",
           (s->error & Event_Resource)?" color='#ff0000'":"",
-          s->inf->total_cpu_percent/10.0);
+          s->inf->priv.process.total_cpu_percent/10.0);
         out_print(res,
           "<tr><td>Total memory usage (incl. children)</td>"
           "<td><font%s>%.1f%% [%ldkB]</font></td></tr>",
           (s->error & Event_Resource)?" color='#ff0000'":"",
-          s->inf->total_mem_percent/10.0, s->inf->total_mem_kbyte);
+ s->inf->priv.process.total_mem_percent/10.0, s->inf->priv.process.total_mem_kbyte);
       } else if(s->type == TYPE_SYSTEM) {
         out_print(res,
"<tr><td>Load average</td><td><font%s>[%.2f] [%.2f] [%.2f]</font></td></tr>",
@@ -2342,11 +2335,11 @@
       if(s->type == TYPE_FILE) {
         out_print(res,
                   "  %-33s %llu B\n",
-                  "size", (unsigned long long) s->inf->st_size);
+                  "size", (unsigned long long) s->inf->priv.file.st_size);
         if(s->checksum) {
           out_print(res,
                     "  %-33s %s(%s)\n",
-                    "checksum", s->inf->cs_sum,
+                    "checksum", s->inf->priv.file.cs_sum,
                     checksumnames[s->checksum->type]);
         }
       }
@@ -2358,39 +2351,39 @@
                   "  %-33s %ld [%.1f MB] [%.1f%%]\n"
                   "  %-33s %ld [%.1f MB] [%.1f%%]\n",
                   "filesystem flags",
-                  s->inf->flags,
+                  s->inf->priv.filesystem.flags,
                   "block size",
-                  s->inf->f_bsize,
+                  s->inf->priv.filesystem.f_bsize,
                   "blocks total",
-                  s->inf->f_blocks,
- s->inf->f_bsize > 0 ? ((float)s->inf->f_blocks / (float)1048576* (float)s->inf->f_bsize) : 0,
+                  s->inf->priv.filesystem.f_blocks,
+ s->inf->priv.filesystem.f_bsize > 0 ? ((float)s->inf->priv.filesystem.f_blocks / (float)1048576* (float)s->inf->priv.filesystem.f_bsize) : 0,
                   "blocks free for non superuser",
-                  s->inf->f_blocksfree,
- s->inf->f_bsize > 0 ? ((float)s->inf->f_blocksfree / (float)1048576* (float)s->inf->f_bsize) : 0, - s->inf->f_blocks > 0 ? ((float)100 * (float)s->inf->f_blocksfree / (float)s->inf->f_blocks) : 0,
+                  s->inf->priv.filesystem.f_blocksfree,
+ s->inf->priv.filesystem.f_bsize > 0 ? ((float)s->inf->priv.filesystem.f_blocksfree / (float)1048576* (float)s->inf->priv.filesystem.f_bsize) : 0, + s->inf->priv.filesystem.f_blocks > 0 ? ((float)100 * (float)s->inf->priv.filesystem.f_blocksfree / (float)s->inf->priv.filesystem.f_blocks) : 0,
                   "blocks free total",
-                  s->inf->f_blocksfreetotal,
- s->inf->f_bsize > 0 ? ((float)s->inf->f_blocksfreetotal/(float)1048576* (float)s->inf->f_bsize) : 0, - s->inf->f_blocks > 0 ? ((float)100 * (float)s->inf->f_blocksfreetotal / (float)s->inf->f_blocks) : 0);
-        if(s->inf->f_files > 0) {
+                  s->inf->priv.filesystem.f_blocksfreetotal,
+ s->inf->priv.filesystem.f_bsize > 0 ? ((float)s->inf->priv.filesystem.f_blocksfreetotal/(float)1048576* (float)s->inf->priv.filesystem.f_bsize) : 0, + s->inf->priv.filesystem.f_blocks > 0 ? ((float)100 * (float)s->inf->priv.filesystem.f_blocksfreetotal / (float)s->inf->priv.filesystem.f_blocks) : 0);
+        if(s->inf->priv.filesystem.f_files > 0) {
           out_print(res,
                     "  %-33s %ld\n"
                     "  %-33s %ld [%.1f%%]\n",
                     "inodes total",
-                    s->inf->f_files,
+                    s->inf->priv.filesystem.f_files,
                     "inodes free",
-                    s->inf->f_filesfree,
- ((float)100*(float)s->inf->f_filesfree/ (float)s->inf->f_files));
+                    s->inf->priv.filesystem.f_filesfree,
+ ((float)100*(float)s->inf->priv.filesystem.f_filesfree/ (float)s->inf->priv.filesystem.f_files));
         }
       }
       if(s->type == TYPE_PROCESS) {
-        char *uptime= Util_getUptime(s->inf->uptime, " ");
+        char *uptime= Util_getUptime(s->inf->priv.process.uptime, " ");
         out_print(res,
                   "  %-33s %d\n"
                   "  %-33s %d\n"
                   "  %-33s %s\n",
-                    "pid", s->inf->pid > 0 ? s->inf->pid : 0,
-                  "parent pid", s->inf->ppid > 0 ? s->inf->ppid : 0,
+ "pid", s->inf->priv.process.pid > 0 ? s->inf->priv.process.pid : 0, + "parent pid", s->inf->priv.process.ppid > 0 ? s->inf->priv.process.ppid : 0,
                   "uptime", uptime);
         FREE(uptime);
         if(Run.doprocess)        {
@@ -2402,13 +2395,13 @@
                   "  %-33s %.1f%%\n"
                   "  %-33s %.1f%%\n"
                   "  %-33s %.1f%%\n",
-                  "children", s->inf->children,
-                  "memory kilobytes", s->inf->mem_kbyte,
-                  "memory kilobytes total", s->inf->total_mem_kbyte,
-                  "memory percent", s->inf->mem_percent/10.0,
-                  "memory percent total", s->inf->total_mem_percent/10.0,
-                  "cpu percent", s->inf->cpu_percent/10.0,
-                    "cpu percent total", s->inf->total_cpu_percent/10.0);
+                  "children", s->inf->priv.process.children,
+                  "memory kilobytes", s->inf->priv.process.mem_kbyte,
+ "memory kilobytes total", s->inf->priv.process.total_mem_kbyte,
+                  "memory percent", s->inf->priv.process.mem_percent/10.0,
+ "memory percent total", s->inf->priv.process.total_mem_percent/10.0,
+                  "cpu percent", s->inf->priv.process.cpu_percent/10.0,
+ "cpu percent total", s->inf->priv.process.total_cpu_percent/10.0);
         }
       }
       if(s->type == TYPE_HOST && s->icmplist) {
=======================================
--- /trunk/monitor.h    Mon Sep 20 14:15:39 2010
+++ /trunk/monitor.h    Tue Dec 28 13:00:51 2010
@@ -656,49 +656,53 @@

 /** Defines service data */
 typedef struct myinfo {
-
   /* Shared */
mode_t st_mode; /**< Permission */ uid_t st_uid; /**< Owner's uid */ gid_t st_gid; /**< Owner's gid */ - ino_t st_ino; /**< Inode */ time_t timestamp; /**< Timestamp */

-  /* Filesystem specific */
- long f_bsize; /**< Transfer block size */ - long f_blocks; /**< Total data blocks in filesystem */ - long f_blocksfree; /**< Free blocks available to non-superuser */ - long f_blocksfreetotal; /**< Free blocks in filesystem */ - long f_files; /**< Total file nodes in filesystem */ - long f_filesfree; /**< Free file nodes in filesystem */ - char mntpath[STRLEN]; /**< Filesystem file, directory or mountpoint */ - int inode_percent; /**< Used inode percentage * 10 */ - long inode_total; /**< Used inode total objects */ - int space_percent; /**< Used space percentage * 10 */ - long space_total; /**< Used space total blocks */ - int _flags; /**< Filesystem flags from last cycle */ - int flags; /**< Filesystem flags from actual cycle */
-
-  /* File specific */
- off_t st_size; /**< Size */ - off_t readpos; /**< Position for regex matching */ - ino_t st_ino_prev; /**< Previous inode for regex matching */ - MD_T cs_sum; /**< Checksum */
-
-  /* Process specific */
- int _pid; /**< Process PID from last cycle */ - int _ppid; /**< Process parent PID from last cycle */ - int pid; /**< Process PID from actual cycle */ - int ppid; /**< Process parent PID from actual cycle */
-  int    status_flag;
-  int    children;
-  long   mem_kbyte;
-  long   total_mem_kbyte;
- int mem_percent; /**< percentage * 10 */ - int total_mem_percent; /**< percentage * 10 */ - int cpu_percent; /**< percentage * 10 */ - int total_cpu_percent; /**< percentage * 10 */ - time_t uptime; /**< Process uptime */
+  union {
+    struct {
+ long f_bsize; /**< Transfer block size */ + long f_blocks; /**< Total data blocks in filesystem */ + long f_blocksfree; /**< Free blocks available to non-superuser */ + long f_blocksfreetotal; /**< Free blocks in filesystem */ + long f_files; /**< Total file nodes in filesystem */ + long f_filesfree; /**< Free file nodes in filesystem */ + char *mntpath; /**< Filesystem file, directory or mountpoint */ + int inode_percent; /**< Used inode percentage * 10 */ + long inode_total; /**< Used inode total objects */ + int space_percent; /**< Used space percentage * 10 */ + long space_total; /**< Used space total blocks */ + int _flags; /**< Filesystem flags from last cycle */ + int flags; /**< Filesystem flags from actual cycle */
+    } filesystem;
+
+    struct {
+ off_t st_size; /**< Size */ + off_t readpos; /**< Position for regex matching */ + ino_t st_ino; /**< Inode */ + ino_t st_ino_prev; /**< Previous inode for regex matching */ + MD_T cs_sum; /**< Checksum */
+    } file;
+
+    struct {
+ int _pid; /**< Process PID from last cycle */ + int _ppid; /**< Process parent PID from last cycle */ + int pid; /**< Process PID from actual cycle */ + int ppid; /**< Process parent PID from actual cycle */
+      int    status_flag;
+      int    children;
+      long   mem_kbyte;
+      long   total_mem_kbyte;
+ int mem_percent; /**< percentage * 10 */ + int total_mem_percent; /**< percentage * 10 */ + int cpu_percent; /**< percentage * 10 */ + int total_cpu_percent; /**< percentage * 10 */ + time_t uptime; /**< Process uptime */
+    } process;
+  } priv;
 } *Info_T;


@@ -760,7 +764,7 @@
Info_T inf; /**< Service check result */ struct timeval collected; /**< When were data collected */ int doaction; /**< Action scheduled by http thread */ - char token[STRLEN]; /**< Action token */ + char *token; /**< Action token */

   /** Events */
   struct myevent {
=======================================
--- /trunk/p.y  Tue Sep 28 15:09:00 2010
+++ /trunk/p.y  Tue Dec 28 13:00:51 2010
@@ -1583,7 +1583,7 @@
yyerror2("cannot read usage of filesystem %s", current->path);
                     filesystemset.resource = RESOURCE_ID_SPACE;
                     filesystemset.operator = $<number>3;
- filesystemset.limit_absolute = (int)((float)$<real>4 / (float)current->inf->f_bsize * (float)$<number>5); + filesystemset.limit_absolute = (int)((float)$<real>4 / (float)current->inf->priv.filesystem.f_bsize * (float)$<number>5); addeventaction(&(filesystemset).action, $<number>8, $<number>9);
                     addfilesystem(&filesystemset);
                   }
=======================================
--- /trunk/process.c    Mon Jul 19 04:55:00 2010
+++ /trunk/process.c    Tue Dec 28 13:00:51 2010
@@ -113,40 +113,40 @@
   ASSERT(systeminfo.mem_kbyte_max > 0);

   /* save the previous pid and set actual one */
-  s->inf->_pid = s->inf->pid;
-  s->inf->pid  = pid;
+  s->inf->priv.process._pid = s->inf->priv.process.pid;
+  s->inf->priv.process.pid  = pid;

   if ((leaf = findprocess(pid, pt, treesize)) != -1) {

     /* save the previous ppid and set actual one */
-    s->inf->_ppid             = s->inf->ppid;
-    s->inf->ppid              = pt[leaf].ppid;
-    s->inf->uptime            = time(NULL) - pt[leaf].starttime;
-    s->inf->children          = pt[leaf].children_sum;
-    s->inf->mem_kbyte         = pt[leaf].mem_kbyte;
-    s->inf->status_flag       = pt[leaf].status_flag;
-    s->inf->total_mem_kbyte   = pt[leaf].mem_kbyte_sum;
-    s->inf->cpu_percent       = pt[leaf].cpu_percent;
-    s->inf->total_cpu_percent = pt[leaf].cpu_percent_sum;
+    s->inf->priv.process._ppid             = s->inf->priv.process.ppid;
+    s->inf->priv.process.ppid              = pt[leaf].ppid;
+ s->inf->priv.process.uptime = time(NULL) - pt[leaf].starttime;
+    s->inf->priv.process.children          = pt[leaf].children_sum;
+    s->inf->priv.process.mem_kbyte         = pt[leaf].mem_kbyte;
+    s->inf->priv.process.status_flag       = pt[leaf].status_flag;
+    s->inf->priv.process.total_mem_kbyte   = pt[leaf].mem_kbyte_sum;
+    s->inf->priv.process.cpu_percent       = pt[leaf].cpu_percent;
+    s->inf->priv.process.total_cpu_percent = pt[leaf].cpu_percent_sum;

     if (systeminfo.mem_kbyte_max == 0) {
-      s->inf->total_mem_percent = 0;
-      s->inf->mem_percent       = 0;
+      s->inf->priv.process.total_mem_percent = 0;
+      s->inf->priv.process.mem_percent       = 0;
     } else {
- s->inf->total_mem_percent = (int)((double)pt[leaf].mem_kbyte_sum * 1000.0 / systeminfo.mem_kbyte_max); - s->inf->mem_percent = (int)((double)pt[leaf].mem_kbyte * 1000.0 / systeminfo.mem_kbyte_max); + s->inf->priv.process.total_mem_percent = (int)((double)pt[leaf].mem_kbyte_sum * 1000.0 / systeminfo.mem_kbyte_max); + s->inf->priv.process.mem_percent = (int)((double)pt[leaf].mem_kbyte * 1000.0 / systeminfo.mem_kbyte_max);
     }

   } else {
-    s->inf->ppid              = 0;
-    s->inf->uptime            = 0;
-    s->inf->children          = 0;
-    s->inf->total_mem_kbyte   = 0;
-    s->inf->total_mem_percent = 0;
-    s->inf->mem_kbyte         = 0;
-    s->inf->mem_percent       = 0;
-    s->inf->cpu_percent       = 0;
-    s->inf->total_cpu_percent = 0;
+    s->inf->priv.process.ppid              = 0;
+    s->inf->priv.process.uptime            = 0;
+    s->inf->priv.process.children          = 0;
+    s->inf->priv.process.total_mem_kbyte   = 0;
+    s->inf->priv.process.total_mem_percent = 0;
+    s->inf->priv.process.mem_kbyte         = 0;
+    s->inf->priv.process.mem_percent       = 0;
+    s->inf->priv.process.cpu_percent       = 0;
+    s->inf->priv.process.total_cpu_percent = 0;
   }

   return TRUE;
=======================================
--- /trunk/spawn.c      Mon Jul 26 12:10:25 2010
+++ /trunk/spawn.c      Tue Dec 28 13:00:51 2010
@@ -282,13 +282,13 @@
snprintf(buf, STRLEN, "MONIT_PROCESS_PID=%d", Util_isProcessRunning(s));
     push_monit_environment(buf, e);

-    snprintf(buf, STRLEN, "MONIT_PROCESS_MEMORY=%ld", s->inf->mem_kbyte);
+ snprintf(buf, STRLEN, "MONIT_PROCESS_MEMORY=%ld", s->inf->priv.process.mem_kbyte);
     push_monit_environment(buf, e);

-    snprintf(buf, STRLEN, "MONIT_PROCESS_CHILDREN=%d", s->inf->children);
+ snprintf(buf, STRLEN, "MONIT_PROCESS_CHILDREN=%d", s->inf->priv.process.children);
     push_monit_environment(buf, e);

- snprintf(buf, STRLEN, "MONIT_PROCESS_CPU_PERCENT=%d", s->inf->cpu_percent); + snprintf(buf, STRLEN, "MONIT_PROCESS_CPU_PERCENT=%d", s->inf->priv.process.cpu_percent);
     push_monit_environment(buf, e);
   }

=======================================
--- /trunk/util.c       Fri Sep 24 13:07:47 2010
+++ /trunk/util.c       Tue Dec 28 13:00:51 2010
@@ -2049,14 +2049,18 @@
  */
 void Util_resetInfo(Service_T s) {
   memset(s->inf, 0, sizeof *(s->inf));
-  s->inf->_pid=        -1;
-  s->inf->_ppid=       -1;
-  s->inf->_flags=      -1;
-  s->inf->pid=         -1;
-  s->inf->ppid=        -1;
-  s->inf->flags=       -1;
-  s->inf->st_ino_prev=  0;
-  s->inf->readpos=      0;
+  switch (s->type) {
+    case TYPE_PROCESS:
+      s->inf->priv.process._pid  = -1;
+      s->inf->priv.process._ppid = -1;
+      s->inf->priv.process.pid   = -1;
+      s->inf->priv.process.ppid  = -1;
+      break;
+    case TYPE_FILESYSTEM:
+      s->inf->priv.filesystem._flags = -1;
+      s->inf->priv.filesystem.flags  = -1;
+      break;
+  }
 }


=======================================
--- /trunk/validate.c   Tue Sep 28 15:09:00 2010
+++ /trunk/validate.c   Tue Dec 28 13:00:51 2010
@@ -276,10 +276,10 @@
Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "unable to read filesystem %s state", p);
     return FALSE;
   }
- s->inf->inode_percent = s->inf->f_files > 0 ? (int)((1000.0 * (s->inf->f_files - s->inf->f_filesfree)) / (float)s->inf->f_files) : 0; - s->inf->space_percent = s->inf->f_blocks > 0 ? (int)((1000.0 * (s->inf->f_blocks - s->inf->f_blocksfree)) / (float)s->inf->f_blocks) : 0;
-  s->inf->inode_total   = s->inf->f_files - s->inf->f_filesfree;
-  s->inf->space_total   = s->inf->f_blocks - s->inf->f_blocksfreetotal;
+ s->inf->priv.filesystem.inode_percent = s->inf->priv.filesystem.f_files
0 ? (int)((1000.0 * (s->inf->priv.filesystem.f_files -
s->inf->priv.filesystem.f_filesfree)) / (float)s->inf->priv.filesystem.f_files) : 0; + s->inf->priv.filesystem.space_percent = s->inf->priv.filesystem.f_blocks
0 ? (int)((1000.0 * (s->inf->priv.filesystem.f_blocks -
s->inf->priv.filesystem.f_blocksfree)) / (float)s->inf->priv.filesystem.f_blocks) : 0; + s->inf->priv.filesystem.inode_total = s->inf->priv.filesystem.f_files - s->inf->priv.filesystem.f_filesfree; + s->inf->priv.filesystem.space_total = s->inf->priv.filesystem.f_blocks - s->inf->priv.filesystem.f_blocksfreetotal; Event_post(s, Event_Data, STATE_SUCCEEDED, s->action_DATA, "succeeded getting filesystem statistic for %s", p);

   if (s->perm)
@@ -315,16 +315,16 @@
     return FALSE;
   } else {
     s->inf->st_mode = stat_buf.st_mode;
-    if (s->inf->st_ino == 0) {
-      s->inf->st_ino_prev = stat_buf.st_ino;
-      s->inf->readpos     = stat_buf.st_size;
+    if (s->inf->priv.file.st_ino == 0) {
+      s->inf->priv.file.st_ino_prev = stat_buf.st_ino;
+      s->inf->priv.file.readpos     = stat_buf.st_size;
     } else
-      s->inf->st_ino_prev = s->inf->st_ino;
-    s->inf->st_ino    = stat_buf.st_ino;
-    s->inf->st_uid    = stat_buf.st_uid;
-    s->inf->st_gid    = stat_buf.st_gid;
-    s->inf->st_size   = stat_buf.st_size;
-    s->inf->timestamp = MAX(stat_buf.st_mtime, stat_buf.st_ctime);
+      s->inf->priv.file.st_ino_prev = s->inf->priv.file.st_ino;
+    s->inf->priv.file.st_ino  = stat_buf.st_ino;
+    s->inf->st_uid            = stat_buf.st_uid;
+    s->inf->st_gid            = stat_buf.st_gid;
+    s->inf->priv.file.st_size = stat_buf.st_size;
+    s->inf->timestamp         = MAX(stat_buf.st_mtime, stat_buf.st_ctime);
     DEBUG("'%s' file exists check succeeded\n", s->name);
Event_post(s, Event_Nonexist, STATE_SUCCEEDED, s->action_NONEXIST, "file exist");
   }
@@ -619,10 +619,10 @@

   ASSERT(s);

-  if (s->inf->status_flag & PROCESS_ZOMBIE)
- Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "process with pid %d is a zombie", s->inf->pid);
+  if (s->inf->priv.process.status_flag & PROCESS_ZOMBIE)
+ Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "process with pid %d is a zombie", s->inf->priv.process.pid);
   else {
- DEBUG("'%s' zombie check succeeded [status_flag=%04x]\n", s->name, s->inf->status_flag); + DEBUG("'%s' zombie check succeeded [status_flag=%04x]\n", s->name, s->inf->priv.process.status_flag); Event_post(s, Event_Data, STATE_SUCCEEDED, s->action_DATA, "check process state succeeded");
   }

@@ -637,11 +637,11 @@
   ASSERT(s && s->inf);

   /* process pid was not initialized yet */
-  if (s->inf->_pid == -1)
+  if (s->inf->priv.process._pid == -1)
     return;

-  if (s->inf->_pid != s->inf->pid)
- Event_post(s, Event_Pid, STATE_CHANGED, s->action_PID, "process PID changed to %d", s->inf->pid);
+  if (s->inf->priv.process._pid != s->inf->priv.process.pid)
+ Event_post(s, Event_Pid, STATE_CHANGED, s->action_PID, "process PID changed to %d", s->inf->priv.process.pid);
   else
Event_post(s, Event_Pid, STATE_CHANGEDNOT, s->action_PID, "process PID has not changed since last cycle");
 }
@@ -655,11 +655,11 @@
   ASSERT(s && s->inf);

   /* process ppid was not initialized yet */
-  if (s->inf->_ppid == -1)
+  if (s->inf->priv.process._ppid == -1)
     return;

-  if (s->inf->_ppid != s->inf->ppid)
- Event_post(s, Event_PPid, STATE_CHANGED, s->action_PPID, "process PPID changed to %d", s->inf->ppid);
+  if (s->inf->priv.process._ppid != s->inf->priv.process.ppid)
+ Event_post(s, Event_PPid, STATE_CHANGED, s->action_PPID, "process PPID changed to %d", s->inf->priv.process.ppid);
   else
Event_post(s, Event_PPid, STATE_CHANGEDNOT, s->action_PPID, "process PPID has not changed since last cycle");
 }
@@ -678,23 +678,23 @@
   switch(r->resource_id) {

   case RESOURCE_ID_CPU_PERCENT:
-    if (s->monitor == MONITOR_INIT || s->inf->cpu_percent < 0) {
+ if (s->monitor == MONITOR_INIT || s->inf->priv.process.cpu_percent < 0) {
       DEBUG("'%s' cpu usage check skipped (initializing)\n", s->name);
- } else if (Util_evalQExpression(r->operator, s->inf->cpu_percent, r->limit)) { - snprintf(report, STRLEN, "cpu usage of %.1f%% matches resource limit [cpu usage%s%.1f%%]", s->inf->cpu_percent/10.0, operatorshortnames[r->operator], r->limit/10.0); + } else if (Util_evalQExpression(r->operator, s->inf->priv.process.cpu_percent, r->limit)) { + snprintf(report, STRLEN, "cpu usage of %.1f%% matches resource limit [cpu usage%s%.1f%%]", s->inf->priv.process.cpu_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' cpu usage check succeeded [current cpu usage=%.1f%%]", s->name, s->inf->cpu_percent/10.0); + snprintf(report, STRLEN, "'%s' cpu usage check succeeded [current cpu usage=%.1f%%]", s->name, s->inf->priv.process.cpu_percent/10.0);
     break;

   case RESOURCE_ID_TOTAL_CPU_PERCENT:
-    if (s->monitor == MONITOR_INIT || s->inf->total_cpu_percent < 0) {
+ if (s->monitor == MONITOR_INIT || s->inf->priv.process.total_cpu_percent < 0) { DEBUG("'%s' total cpu usage check skipped (initializing)\n", s->name); - } else if (Util_evalQExpression(r->operator, s->inf->total_cpu_percent, r->limit)) { - snprintf(report, STRLEN, "total cpu usage of %.1f%% matches resource limit [cpu usage%s%.1f%%]", s->inf->total_cpu_percent/10.0, operatorshortnames[r->operator], r->limit/10.0); + } else if (Util_evalQExpression(r->operator, s->inf->priv.process.total_cpu_percent, r->limit)) { + snprintf(report, STRLEN, "total cpu usage of %.1f%% matches resource limit [cpu usage%s%.1f%%]", s->inf->priv.process.total_cpu_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' total cpu usage check succeeded [current cpu usage=%.1f%%]", s->name, s->inf->total_cpu_percent/10.0); + snprintf(report, STRLEN, "'%s' total cpu usage check succeeded [current cpu usage=%.1f%%]", s->name, s->inf->priv.process.total_cpu_percent/10.0);
     break;

   case RESOURCE_ID_CPUUSER:
@@ -735,11 +735,11 @@
       } else
snprintf(report, STRLEN, "'%s' mem usage check succeeded [current mem usage=%.1f%%]", s->name, systeminfo.total_mem_percent/10.0);
     } else {
- if (Util_evalQExpression(r->operator, s->inf->mem_percent, r->limit)) { - snprintf(report, STRLEN, "mem usage of %.1f%% matches resource limit [mem usage%s%.1f%%]", s->inf->mem_percent/10.0, operatorshortnames[r->operator], r->limit/10.0); + if (Util_evalQExpression(r->operator, s->inf->priv.process.mem_percent, r->limit)) { + snprintf(report, STRLEN, "mem usage of %.1f%% matches resource limit [mem usage%s%.1f%%]", s->inf->priv.process.mem_percent/10.0, operatorshortnames[r->operator], r->limit/10.0);
         okay = FALSE;
       } else
- snprintf(report, STRLEN, "'%s' mem usage check succeeded [current mem usage=%.1f%%]", s->name, s->inf->mem_percent/10.0); + snprintf(report, STRLEN, "'%s' mem usage check succeeded [current mem usage=%.1f%%]", s->name, s->inf->priv.process.mem_percent/10.0);
     }
     break;

@@ -751,11 +751,11 @@
       } else
snprintf(report, STRLEN, "'%s' mem amount check succeeded [current mem amount=%ldkB]", s->name, systeminfo.total_mem_kbyte);
     } else {
-      if (Util_evalQExpression(r->operator, s->inf->mem_kbyte, r->limit)) {
- snprintf(report, STRLEN, "mem amount of %ldkB matches resource limit [mem amount%s%ldkB]", s->inf->mem_kbyte, operatorshortnames[r->operator], r->limit); + if (Util_evalQExpression(r->operator, s->inf->priv.process.mem_kbyte, r->limit)) { + snprintf(report, STRLEN, "mem amount of %ldkB matches resource limit [mem amount%s%ldkB]", s->inf->priv.process.mem_kbyte, operatorshortnames[r->operator], r->limit);
         okay = FALSE;
       } else
- snprintf(report, STRLEN, "'%s' mem amount check succeeded [current mem amount=%ldkB]", s->name, s->inf->mem_kbyte); + snprintf(report, STRLEN, "'%s' mem amount check succeeded [current mem amount=%ldkB]", s->name, s->inf->priv.process.mem_kbyte);
     }
     break;

@@ -804,27 +804,27 @@
     break;

   case RESOURCE_ID_CHILDREN:
-    if (Util_evalQExpression(r->operator, s->inf->children, r->limit)) {
- snprintf(report, STRLEN, "children of %i matches resource limit [children%s%ld]", s->inf->children, operatorshortnames[r->operator], r->limit); + if (Util_evalQExpression(r->operator, s->inf->priv.process.children, r->limit)) { + snprintf(report, STRLEN, "children of %i matches resource limit [children%s%ld]", s->inf->priv.process.children, operatorshortnames[r->operator], r->limit);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' children check succeeded [current children=%i]", s->name, s->inf->children); + snprintf(report, STRLEN, "'%s' children check succeeded [current children=%i]", s->name, s->inf->priv.process.children);
     break;

   case RESOURCE_ID_TOTAL_MEM_KBYTE:
- if (Util_evalQExpression(r->operator, s->inf->total_mem_kbyte, r->limit)) { - snprintf(report, STRLEN, "total mem amount of %ldkB matches resource limit [total mem amount%s%ldkB]", s->inf->total_mem_kbyte, operatorshortnames[r->operator], r->limit); + if (Util_evalQExpression(r->operator, s->inf->priv.process.total_mem_kbyte, r->limit)) { + snprintf(report, STRLEN, "total mem amount of %ldkB matches resource limit [total mem amount%s%ldkB]", s->inf->priv.process.total_mem_kbyte, operatorshortnames[r->operator], r->limit);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' total mem amount check succeeded [current total mem amount=%ldkB]", s->name, s->inf->total_mem_kbyte); + snprintf(report, STRLEN, "'%s' total mem amount check succeeded [current total mem amount=%ldkB]", s->name, s->inf->priv.process.total_mem_kbyte);
     break;

   case RESOURCE_ID_TOTAL_MEM_PERCENT:
- if (Util_evalQExpression(r->operator, s->inf->total_mem_percent, r->limit)) { - snprintf(report, STRLEN, "total mem amount of %.1f%% matches resource limit [total mem amount%s%.1f%%]", (float)s->inf->total_mem_percent/10.0, operatorshortnames[r->operator], (float)r->limit/10.0); + if (Util_evalQExpression(r->operator, s->inf->priv.process.total_mem_percent, r->limit)) { + snprintf(report, STRLEN, "total mem amount of %.1f%% matches resource limit [total mem amount%s%.1f%%]", (float)s->inf->priv.process.total_mem_percent/10.0, operatorshortnames[r->operator], (float)r->limit/10.0);
       okay = FALSE;
     } else
- snprintf(report, STRLEN, "'%s' total mem amount check succeeded [current total mem amount=%.1f%%]", s->name, s->inf->total_mem_percent/10.0); + snprintf(report, STRLEN, "'%s' total mem amount check succeeded [current total mem amount=%.1f%%]", s->name, s->inf->priv.process.total_mem_percent/10.0);
     break;

   default:
@@ -853,20 +853,20 @@

   cs = s->checksum;

- if (Util_getChecksum(s->path, cs->type, s->inf->cs_sum, sizeof(s->inf->cs_sum))) { + if (Util_getChecksum(s->path, cs->type, s->inf->priv.file.cs_sum, sizeof(s->inf->priv.file.cs_sum))) {

Event_post(s, Event_Data, STATE_SUCCEEDED, s->action_DATA, "checksum computed for %s", s->path);

     switch(cs->type) {
       case HASH_MD5:
-        changed = strncmp(cs->hash, s->inf->cs_sum, 32);
+        changed = strncmp(cs->hash, s->inf->priv.file.cs_sum, 32);
         break;
       case HASH_SHA1:
-        changed = strncmp(cs->hash, s->inf->cs_sum, 40);
+        changed = strncmp(cs->hash, s->inf->priv.file.cs_sum, 40);
         break;
       default:
         LogError("'%s' unknown hash type\n", s->name);
-        *s->inf->cs_sum = 0;
+        *s->inf->priv.file.cs_sum = 0;
         return;
     }

@@ -881,7 +881,7 @@
Event_post(s, Event_Checksum, STATE_CHANGED, cs->action, "checksum was changed for %s", s->path);

         /* reset expected value for next cycle */
-        snprintf(cs->hash, sizeof(cs->hash), "%s", s->inf->cs_sum);
+ snprintf(cs->hash, sizeof(cs->hash), "%s", s->inf->priv.file.cs_sum);

       } else
         /* we are testing constant value for failed or succeeded state */
@@ -1011,14 +1011,14 @@
/* the size was not initialized during monit start, so set the size now
          * and allow further size change testing */
         sl->test_changes_ok = TRUE;
-        sl->size = s->inf->st_size;
+        sl->size = s->inf->priv.file.st_size;
       } else {
-        if (sl->size != s->inf->st_size) {
+        if (sl->size != s->inf->priv.file.st_size) {
Event_post(s, Event_Size, STATE_CHANGED, sl->action, "size was changed for %s", s->path);
           /* reset expected value for next cycle */
-          sl->size = s->inf->st_size;
+          sl->size = s->inf->priv.file.st_size;
         } else {
- DEBUG("'%s' size has not changed [current size=%llu B]\n", s->name, s->inf->st_size); + DEBUG("'%s' size has not changed [current size=%llu B]\n", s->name, s->inf->priv.file.st_size); Event_post(s, Event_Size, STATE_CHANGEDNOT, sl->action, "size was not changed", s->path);
         }
       }
@@ -1026,10 +1026,10 @@
     }

     /* we are testing constant value for failed or succeeded state */
-    if (Util_evalQExpression(sl->operator, s->inf->st_size, sl->size))
- Event_post(s, Event_Size, STATE_FAILED, sl->action, "size test failed for %s -- current size is %llu B", s->path, s->inf->st_size); + if (Util_evalQExpression(sl->operator, s->inf->priv.file.st_size, sl->size)) + Event_post(s, Event_Size, STATE_FAILED, sl->action, "size test failed for %s -- current size is %llu B", s->path, s->inf->priv.file.st_size);
     else {
- DEBUG("'%s' file size check succeeded [current size=%llu B]\n", s->name, s->inf->st_size); + DEBUG("'%s' file size check succeeded [current size=%llu B]\n", s->name, s->inf->priv.file.st_size); Event_post(s, Event_Size, STATE_SUCCEEDED, sl->action, "size succeeded");
     }
   }
@@ -1047,11 +1047,11 @@
   ASSERT(s && s->matchlist);

   /* If inode changed or size shrinked -> set read position = 0 */
- if (s->inf->st_ino != s->inf->st_ino_prev || s->inf->readpos > s->inf->st_size)
-    s->inf->readpos = 0;
+ if (s->inf->priv.file.st_ino != s->inf->priv.file.st_ino_prev || s->inf->priv.file.readpos > s->inf->priv.file.st_size)
+    s->inf->priv.file.readpos = 0;

   /* Do we need to match? */
-  if (s->inf->readpos == s->inf->st_size)
+  if (s->inf->priv.file.readpos == s->inf->priv.file.st_size)
     return;

   /* Open the file */
@@ -1063,7 +1063,7 @@
   while (TRUE) {

     /* Seek to the read position */
-    if (fseek(file, s->inf->readpos, SEEK_SET)) {
+    if (fseek(file, s->inf->priv.file.readpos, SEEK_SET)) {
LogError("'%s' cannot seek file %s: %s\n", s->name, s->path, STRERROR);
       goto final;
     }
@@ -1103,7 +1103,7 @@
     }

     /* Set read position to the end of last read */
-    s->inf->readpos += advance;
+    s->inf->priv.file.readpos += advance;

     /* Remove appending newline */
     if (line[length-1] == '\n')
@@ -1205,11 +1205,11 @@
   ASSERT(s && s->inf);

   /* filesystem flags were not initialized yet */
-  if (s->inf->_flags == -1)
+  if (s->inf->priv.filesystem._flags == -1)
     return;

-  if (s->inf->_flags != s->inf->flags)
- Event_post(s, Event_Fsflag, STATE_CHANGED, s->action_FSFLAG, "filesytem flags changed to %#lx", s->inf->flags);
+  if (s->inf->priv.filesystem._flags != s->inf->priv.filesystem.flags)
+ Event_post(s, Event_Fsflag, STATE_CHANGED, s->action_FSFLAG, "filesytem flags changed to %#lx", s->inf->priv.filesystem.flags);
 }

 /**
@@ -1226,39 +1226,39 @@
   switch(td->resource) {

   case RESOURCE_ID_INODE:
-      if (s->inf->f_files <= 0) {
+      if (s->inf->priv.filesystem.f_files <= 0) {
        DEBUG("'%s' filesystem doesn't support inodes\n", s->name);
        return;
       }

       if (td->limit_percent >= 0) {
- if (Util_evalQExpression( td->operator, s->inf->inode_percent, td->limit_percent)) { - Event_post(s, Event_Resource, STATE_FAILED, td->action, "inode usage %.1f%% matches resource limit [inode usage%s%.1f%%]", s->inf->inode_percent/10., operatorshortnames[td->operator], td->limit_percent/10.); + if (Util_evalQExpression( td->operator, s->inf->priv.filesystem.inode_percent, td->limit_percent)) { + Event_post(s, Event_Resource, STATE_FAILED, td->action, "inode usage %.1f%% matches resource limit [inode usage%s%.1f%%]", s->inf->priv.filesystem.inode_percent/10., operatorshortnames[td->operator], td->limit_percent/10.);
          return;
        }
       } else {
- if (Util_evalQExpression(td->operator, s->inf->inode_total, td->limit_absolute)) { - Event_post(s, Event_Resource, STATE_FAILED, td->action, "inode usage %ld matches resource limit [inode usage%s%ld]", s->inf->inode_total, operatorshortnames[td->operator], td->limit_absolute); + if (Util_evalQExpression(td->operator, s->inf->priv.filesystem.inode_total, td->limit_absolute)) { + Event_post(s, Event_Resource, STATE_FAILED, td->action, "inode usage %ld matches resource limit [inode usage%s%ld]", s->inf->priv.filesystem.inode_total, operatorshortnames[td->operator], td->limit_absolute);
          return;
        }
       }
- DEBUG("'%s' inode usage check succeeded [current inode usage=%.1f%%]\n", s->name, s->inf->inode_percent/10.); + DEBUG("'%s' inode usage check succeeded [current inode usage=%.1f%%]\n", s->name, s->inf->priv.filesystem.inode_percent/10.); Event_post(s, Event_Resource, STATE_SUCCEEDED, td->action, "filesystem resources succeeded");
       return;

   case RESOURCE_ID_SPACE:
       if (td->limit_percent >= 0) {
- if (Util_evalQExpression( td->operator, s->inf->space_percent, td->limit_percent)) { - Event_post(s, Event_Resource, STATE_FAILED, td->action, "space usage %.1f%% matches resource limit [space usage%s%.1f%%]", s->inf->space_percent/10., operatorshortnames[td->operator], td->limit_percent/10.); + if (Util_evalQExpression( td->operator, s->inf->priv.filesystem.space_percent, td->limit_percent)) { + Event_post(s, Event_Resource, STATE_FAILED, td->action, "space usage %.1f%% matches resource limit [space usage%s%.1f%%]", s->inf->priv.filesystem.space_percent/10., operatorshortnames[td->operator], td->limit_percent/10.);
           return;
         }
       } else {
- if (Util_evalQExpression(td->operator, s->inf->space_total, td->limit_absolute)) { - Event_post(s, Event_Resource, STATE_FAILED, td->action, "space usage %ld blocks matches resource limit [space usage%s%ld blocks]", s->inf->space_total, operatorshortnames[td->operator], td->limit_absolute); + if (Util_evalQExpression(td->operator, s->inf->priv.filesystem.space_total, td->limit_absolute)) { + Event_post(s, Event_Resource, STATE_FAILED, td->action, "space usage %ld blocks matches resource limit [space usage%s%ld blocks]", s->inf->priv.filesystem.space_total, operatorshortnames[td->operator], td->limit_absolute);
          return;
         }
       }
- DEBUG("'%s' space usage check succeeded [current space usage=%.1f%%]\n", s->name, s->inf->space_percent/10.); + DEBUG("'%s' space usage check succeeded [current space usage=%.1f%%]\n", s->name, s->inf->priv.filesystem.space_percent/10.); Event_post(s, Event_Resource, STATE_SUCCEEDED, td->action, "filesystem resources succeeded");
       return;

@@ -1334,7 +1334,7 @@
     rv = control_service(s->name, s->doaction);
Event_post(s, Event_Action, STATE_CHANGED, s->action_ACTION, "%s action done", actionnames[s->doaction]);
     s->doaction = ACTION_IGNORE;
-    *s->token = 0;
+    FREE(s->token);
   }
   return rv;
 }
=======================================
--- /trunk/xml.c        Wed Sep 15 05:24:38 2010
+++ /trunk/xml.c        Tue Dec 28 13:00:51 2010
@@ -280,11 +280,11 @@
       if(S->type == TYPE_FILE) {
         Util_stringbuffer(B,
                "<size>%llu</size>",
-               (unsigned long long) S->inf->st_size);
+               (unsigned long long) S->inf->priv.file.st_size);
         if(S->checksum) {
           Util_stringbuffer(B,
                  "<checksum type=\"%s\">%s</checksum>",
-                 checksumnames[S->checksum->type], S->inf->cs_sum);
+                 checksumnames[S->checksum->type], S->inf->priv.file.cs_sum);
         }
       }
       if(S->type == TYPE_FILESYSTEM) {
@@ -295,20 +295,20 @@
                "<usage>%.1f MB</usage>"
                 "<total>%.1f MB</total>"
                "</block>",
-               S->inf->flags,
-               S->inf->space_percent/10.,
- S->inf->f_bsize > 0 ? (float)S->inf->space_total / (float)1048576 * (float)S->inf->f_bsize : 0, - S->inf->f_bsize > 0 ? (float)S->inf->f_blocks / (float)1048576 * (float)S->inf->f_bsize : 0);
-        if(S->inf->f_files > 0) {
+               S->inf->priv.filesystem.flags,
+               S->inf->priv.filesystem.space_percent/10.,
+ S->inf->priv.filesystem.f_bsize > 0 ? (float)S->inf->priv.filesystem.space_total / (float)1048576 * (float)S->inf->priv.filesystem.f_bsize : 0, + S->inf->priv.filesystem.f_bsize > 0 ? (float)S->inf->priv.filesystem.f_blocks / (float)1048576 * (float)S->inf->priv.filesystem.f_bsize : 0);
+        if(S->inf->priv.filesystem.f_files > 0) {
           Util_stringbuffer(B,
                  "<inode>"
                   "<percent>%.1f</percent>"
                   "<usage>%ld</usage>"
                   "<total>%ld</total>"
                  "</inode>",
-                 S->inf->inode_percent/10.,
-                 S->inf->inode_total,
-                  S->inf->f_files);
+                 S->inf->priv.filesystem.inode_percent/10.,
+                 S->inf->priv.filesystem.inode_total,
+                  S->inf->priv.filesystem.f_files);
         }
       }
       if(S->type == TYPE_PROCESS) {
@@ -316,9 +316,9 @@
                "<pid>%d</pid>"
                "<ppid>%d</ppid>"
                "<uptime>%ld</uptime>",
-               S->inf->pid,
-               S->inf->ppid,
-               (long)S->inf->uptime);
+               S->inf->priv.process.pid,
+               S->inf->priv.process.ppid,
+               (long)S->inf->priv.process.uptime);
         if(Run.doprocess) {
           Util_stringbuffer(B,
                  "<children>%d</children>"
@@ -332,13 +332,13 @@
                  "<percent>%.1f</percent>"
                  "<percenttotal>%.1f</percenttotal>"
                  "</cpu>",
-                 S->inf->children,
-                 S->inf->mem_percent/10.0,
-                 S->inf->total_mem_percent/10.0,
-                 S->inf->mem_kbyte,
-                 S->inf->total_mem_kbyte,
-                 S->inf->cpu_percent/10.0,
-                 S->inf->total_cpu_percent/10.0);
+                 S->inf->priv.process.children,
+                 S->inf->priv.process.mem_percent/10.0,
+                 S->inf->priv.process.total_mem_percent/10.0,
+                 S->inf->priv.process.mem_kbyte,
+                 S->inf->priv.process.total_mem_kbyte,
+                 S->inf->priv.process.cpu_percent/10.0,
+                 S->inf->priv.process.total_cpu_percent/10.0);
         }
       }
       if(S->type == TYPE_HOST && S->icmplist) {
@@ -476,7 +476,7 @@
     Event_get_state(E),
     Event_get_action(E),
     Event_get_message(E));
-  if ((s = Event_get_source(E)) && *s->token)
+  if ((s = Event_get_source(E)) && s->token)
     Util_stringbuffer(B, "<token>%s</token>", s->token);
   Util_stringbuffer(B,
     "</event>");



reply via email to

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