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

Roman Bogorodskiy bogorodskiy at gmail.com
Wed Dec 19 14:32:39 UTC 2012


  Peter Krempa wrote:

> From: Roman Bogorodskiy <bogorodskiy at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121219/4b3aa7df/attachment-0001.sig>


More information about the libvir-list mailing list