LoadProcessTable() reads the output of "ps" into a linked list and
duplicates two copies, one for processes owned by root and one for
processes owned by other users.

  The method it uses to distinguish between root and non-root
processes is to match the regular expression /.*root.*/.

  This patch changes to a substring match for "root" instead.

  On our production Sparc Solaris machines a run of cfagent takes
upwards of 5 minutes to run without this patch and 9 seconds with it.
  Our Linux machines are happy either way.  I assume the Solaris
regular expression code is inefficient.

--- src/process.c.orig	2007-09-04 08:39:53.789511000 +0100
+++ src/process.c	2007-09-04 13:35:58.682319000 +0100
@@ -77,11 +77,11 @@
 CopyList(&rootprocs,*procdata);
 CopyList(&otherprocs,*procdata);
 
-while (DeleteItemNotMatching(&rootprocs,".*root.*"))
+while (DeleteItemNotContaining(&rootprocs,"root"))
    {
    }
 
-while (DeleteItemMatching(&otherprocs,".*root.*"))
+while (DeleteItemContaining(&otherprocs,"root"))
    {
    }
 


_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to