Add a wrapper, so that we can then be ready for the cgrules configuration
directory.

Signed-off-by: Dhaval Giani <dhaval.gi...@gmail.com>
---
 src/cgrules.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Index: libcg/src/cgrules.c
===================================================================
--- libcg.orig/src/cgrules.c
+++ libcg/src/cgrules.c
@@ -150,8 +150,8 @@ static char *cg_skip_unused_charactors_i
  *     @return 0 on success, -1 if no cache and match found, > 0 on error.
  * TODO: Make this function thread safe!
  */
-static int cgroup_parse_rules(bool cache, uid_t muid,
-                                         gid_t mgid, const char *mprocname)
+static int cgroup_parse_rules_file(bool cache, uid_t muid, gid_t mgid,
+                       const char *mprocname, const char *cgrules_config)
 {
        /* File descriptor for the configuration file */
        FILE *fp = NULL;
@@ -207,7 +207,7 @@ static int cgroup_parse_rules(bool cache
 
        /* Open the configuration file. */
        pthread_rwlock_wrlock(&rl_lock);
-       fp = fopen(cgrules_config_file, "re");
+       fp = fopen(cgrules_config, "re");
        if (!fp) {
                cgroup_dbg("Failed to open configuration file %s with"
                                " error: %s\n", cgrules_config_file_file,
@@ -471,6 +471,11 @@ unlock:
        return ret;
 }
 
+static int cgroup_parse_rules(bool cache, uid_t muid,
+                                         gid_t mgid, const char *mprocname)
+{
+       return cgroup_parse_rules_file(cache, muid, mgid, mprocname, 
cgrules_config_file);
+}
 /** cg_prepare_cgroup
  * Process the selected rule. Prepare the cgroup structure which can be
  * used to add the task to destination cgroup.



------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to