Peter Krempa wrote:
From: Roman Bogorodskiy <bogorodskiy(a)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