From: Jan Safranek Date: Fri, 9 Dec 2011 14:05:02 +0000 (+0100) Subject: libcgroup: Added compile-time option to ignore certain hierarchies (e.g. systemd). X-Git-Tag: v0.38~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2e4b8a93a0dcf43ff22a87f07aa2637ccd1aa99;p=thirdparty%2Flibcgroup.git libcgroup: Added compile-time option to ignore certain hierarchies (e.g. systemd). 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 --- diff --git a/configure.in b/configure.in index d1f19a22..69cf5d48 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/src/api.c b/src/api.c index 72333194..e2e7efeb 100644 --- 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) {