Index: trunk/src/sh_processcheck.c
===================================================================
--- trunk/src/sh_processcheck.c	(revision 203)
+++ trunk/src/sh_processcheck.c	(revision 204)
@@ -95,5 +95,5 @@
 static time_t   sh_prochk_interval = SH_PROCHK_INTERVAL;
 static int      sh_prochk_severity = SH_ERR_SEVERE;
-
+static int      sh_prochk_openvz   = S_FALSE;
 
 static int sh_prochk_set_maxpid  (const char * str);
@@ -105,4 +105,5 @@
 static int sh_prochk_set_interval(const char *str);
 static int sh_prochk_set_severity(const char *str);
+static int sh_prochk_set_openvz  (const char *str);
 
 sh_rconf sh_prochk_table[] = {
@@ -138,4 +139,8 @@
         N_("processcheckinterval"),
         sh_prochk_set_interval,
+    },
+    {
+        N_("processcheckisopenvz"),
+        sh_prochk_set_openvz,
     },
     {
@@ -513,5 +518,5 @@
 
   if (!str && ('/' != str[0]))
-    SL_RETURN((-1), _("sh_prochk_set_psarg"));
+    SL_RETURN((-1), _("sh_prochk_set_pspath"));
   if (sh_prochk_pspath)
     SH_FREE(sh_prochk_pspath);
@@ -548,4 +553,23 @@
 
   SL_RETURN((value), _("sh_prochk_set_active"));
+}
+
+/* Are we on openvz.
+ */
+static int openvz_hidden = 0;
+
+int sh_prochk_set_openvz(const char *str) 
+{
+  int value;
+    
+  SL_ENTER(_("sh_prochk_set_openvz"));
+
+  value = sh_util_flagval(str, &sh_prochk_openvz);
+
+  if (sh_prochk_openvz != S_FALSE) {
+    openvz_hidden = 1;
+  }
+
+  SL_RETURN((value), _("sh_prochk_set_openvz"));
 }
 
@@ -1065,4 +1089,36 @@
 }
 
+/* Check whether there is a visible process
+ * with PID = i + 1024
+ */
+static int openvz_ok(short * res, size_t i)
+{
+  if (sh_prochk_openvz == S_FALSE) {
+    return 0;
+  }
+
+  i += 1024;
+
+  if (i >= sh_prochk_size) {
+    return 0;
+  }
+
+  if ( ((res[i] & SH_PR_PS) || (res[i] & SH_PR_PS2)) && (res[i] & SH_PR_ANY))
+    {
+      /* This is a system process corresponding to a 'virtual'
+       * process that has a PID offset by 1024
+       */
+      return 1;
+    }
+
+  if (openvz_hidden)
+    {
+      --openvz_hidden;
+      return 1;
+    }
+
+  return 0;
+}
+
 static int sh_process_check_int (short * res)
 {
@@ -1158,5 +1214,5 @@
 	       * if still there, it is real and hidden
 	       */
-	      if (res[j] & SH_PR_ANY)
+	      if ((res[j] & SH_PR_ANY) && !openvz_ok(res, j))
 		{
 		  if (S_FALSE == is_in_list(&list_hidden, NULL, i))
@@ -1352,4 +1408,5 @@
   sh_prochk_minpid   = 0x0001;
   sh_prochk_interval = SH_PROCHK_INTERVAL;
+  sh_prochk_openvz   = S_FALSE;
 
   sh_prochk_free_list(process_check);
