Re: [PATCH] vircgroupv1: add ifdef around cgroup code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 25, 2018 at 03:35:11PM +0200, Pavel Hrdina wrote:
Cgroups are supported only on linux.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
src/util/vircgroupv1.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index 62a6e5c448..3d05fbd745 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -55,6 +55,8 @@ VIR_ENUM_IMPL(virCgroupV1Controller, VIR_CGROUP_CONTROLLER_LAST,
              "name=systemd");


+#ifdef VIR_CGROUP_SUPPORTED
+
/* We're looking for at least one 'cgroup' fs mount,
 * which is *not* a named mount. */
static bool
@@ -2099,3 +2101,15 @@ virCgroupV1Register(void)
{
    virCgroupBackendRegister(&virCgroupV1Backend);
}
+
+#else /* !VIR_CGROUP_SUPPORTED */
+
+void
+virCgroupV1Register(void)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;

util/vircgroupv1.c:2112:5: error: void function 'virCgroupV1Register' should not return a value [-Wreturn-type]
   return -1;
   ^      ~~
1 error generated.

Also, vircgrouptest.c is only guarded by #ifdef __linux__. I don't know
whether it was quietly broken on Linuxes that do not satisfy
VIR_CGROUP_SUPPORTED and nobody cared, or the dependency was introduced
by:
commit 8b62008d2bc5442f7755e579ea754ffd5e3f9691
   vircgrouptest: call virCgroupNewSelf instead virCgroupDetectMounts

Jano

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux