src/util/vircgroupv1.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Cgroups are supported only on linux.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
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;
+}
+
+#endif /* !VIR_CGROUP_SUPPORTED */
--
2.17.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
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@redhat.com>
> ---
> 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
this is defined in vircgroup.c, I don't think this works as expected in the
current form, I'd suggested moving the definition of the macro itself to a
header.
Erik
> +
> /* 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;
> +}
> +
> +#endif /* !VIR_CGROUP_SUPPORTED */
> --
> 2.17.1
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
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@redhat.com>
>---
> 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
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.