cgroup_init() can be called several times in sequence. New call completelly rewrites old data, i.e. things that were unmounted between two cgroup_init() calls disappear and new mount points show up.
Signed-off-by: Jan Safranek <jsafr...@redhat.com> --- src/api.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/api.c b/src/api.c index 769c080..1c6ca97 100644 --- a/src/api.c +++ b/src/api.c @@ -835,6 +835,17 @@ int cgroup_init(void) pthread_rwlock_wrlock(&cg_mount_table_lock); + /* free global variables filled by previous cgroup_init() */ + for (i = 0; cg_mount_table[i].name[0] != '\0'; i++) { + struct cg_mount_point *mount = cg_mount_table[i].mount.next; + while (mount) { + struct cg_mount_point *tmp = mount; + mount = mount->next; + free(tmp); + } + } + memset(&cg_mount_table, 0, sizeof(cg_mount_table)); + proc_cgroup = fopen("/proc/cgroups", "re"); if (!proc_cgroup) { @@ -863,6 +874,7 @@ int cgroup_init(void) } free(buf); + i = 0; while (!feof(proc_cgroup)) { err = fscanf(proc_cgroup, "%s %d %d %d", subsys_name, &hierarchy, &num_cgroups, &enabled); ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel