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

Erik Skultety eskultet at redhat.com
Tue Sep 25 13:43:30 UTC 2018


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 at 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list