Re: [PATCHv2 2/2] FreeBSD: stub out CPU affinity functions.

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

 



  Peter Krempa wrote:

> From: Roman Bogorodskiy <bogorodskiy@xxxxxxxxx>
> 
> ---
> This version incorporates DanPB's idea of checking if setting affinity for all
> processors and failing otherwise.

Thanks, this version looks good and works for me.

> ---
>  src/util/processinfo.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/src/util/processinfo.c b/src/util/processinfo.c
> index b1db049..6cca426 100644
> --- a/src/util/processinfo.c
> +++ b/src/util/processinfo.c
> @@ -168,6 +168,34 @@ realloc:
>      return 0;
>  }
> 
> +#elif defined(__FreeBSD__)
> +
> +int virProcessInfoSetAffinity(pid_t pid ATTRIBUTE_UNUSED,
> +                              virBitmapPtr map)
> +{
> +    if (!virBitmapIsAllSet(map)) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("setting process affinity isn't supported "
> +                         "on FreeBSD yet"));
> +        return -1;
> +    }
> +
> +    return 0;
> +}
> +
> +int virProcessInfoGetAffinity(pid_t pid ATTRIBUTE_UNUSED,
> +                              virBitmapPtr *map,
> +                              int maxcpu)
> +{
> +    if (!(*map = virBitmapNew(maxcpu))) {
> +        virReportOOMError();
> +        return -1;
> +    }
> +    virBitmapSetAll(*map);
> +
> +    return 0;
> +}
> +
>  #else /* HAVE_SCHED_GETAFFINITY */
> 
>  int virProcessInfoSetAffinity(pid_t pid ATTRIBUTE_UNUSED,
> -- 
> 1.8.0.2
> 

Roman Bogorodskiy

Attachment: pgpT5KCQrKev2.pgp
Description: PGP 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]