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

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



  Peter Krempa wrote:

> From: Roman Bogorodskiy <bogorodskiy gmail com>
> 
> ---
> 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: pgpjco6hNySAr.pgp
Description: PGP signature


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