]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup: Added compile-time option to ignore certain hierarchies (e.g. systemd).
authorJan Safranek <jsafrane@redhat.com>
Fri, 9 Dec 2011 14:05:02 +0000 (15:05 +0100)
committerJan Safranek <jsafrane@redhat.com>
Fri, 16 Dec 2011 12:51:41 +0000 (13:51 +0100)
Libcgroup should not mess up with systemd 'name=systemd' hierarchy. Let's
add ./configure option to ignore it on distros, which use it.

Only one hierarchy can be ignored, at least at this time, further
enhancement is possible.

Usage:
$ configure --enable-opaque-hierarchy="name=systemd"

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
configure.in
src/api.c

index d1f19a2274a5b91a9982034bcd922bc217d207df..69cf5d48b7c9161ff89e44b174f16750ee452f03 100644 (file)
@@ -136,6 +136,19 @@ AC_ARG_ENABLE([pam-module-dir],
        ], [])
 AC_SUBST([pamlibdir],"$pam_module_dir")
 
+AC_ARG_ENABLE([opaque-hierarchy],
+       [AC_HELP_STRING([--enable-opaque-hierarchy=NAME],
+               [specify name of a hierarchy which libcgroup should ignore, e.g. name=systemd]
+               (default=none))],
+       [
+               if test "x$enableval" = xno -o "x$enableval" = xyes; then
+                       AC_MSG_ERROR([Provide name of a hierarchy.])
+               else
+                       AC_DEFINE_UNQUOTED([OPAQUE_HIERARCHY], "$enableval",
+                               [Define to ignore specific hierarchy.])
+               fi
+       ], [])
+
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
index 72333194b487856b5055cd008ecd9a83acdefdb2..e2e7efebfdb6a8d27a982a643b3e323a6eb41f5f 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -984,6 +984,15 @@ int cgroup_init(void)
                         * Check if it is a duplicate
                         */
                        duplicate = 0;
+
+#ifdef OPAQUE_HIERARCHY
+                       /*
+                        * Ignore the opaque hierarchy.
+                        */
+                       if (strcmp(mntopt, OPAQUE_HIERARCHY) == 0)
+                                       continue;
+#endif
+
                        for (j = 0; j < found_mnt; j++) {
                                if (strncmp(mntopt, cg_mount_table[j].name,
                                                        FILENAME_MAX) == 0) {