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

[libvirt] [PATCH 3/1] build: work with glibc that lacks CPU_COUNT



Building on RHEL 5 warned:

nodeinfo.c: 305: warning: implicit declaration of function 'CPU_COUNT'

This extension macro in <sched.h> was not added until later glibc.

* src/nodeinfo.c (CPU_COUNT): Add fallback implementation.
---

Pushing under the build-breaker rule.  I'm still getting link
failures:

./.libs/libvirt_util.a(libvirt_util_la-virobject.o): In function `virAtomicIntXor':
/home/dummy/l,ibvirt/src/util/viratomoic.h:404: multiple definition of `virAtomicIntXor'
./.libs/libvirt_util.a(libvirt_util_la-viratomic.o):/home/dummy/libvirt/src/util/viratomic.h:404: first defined here

but at least the compile failures now appear to be solved.

 src/nodeinfo.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 84a5d66..e3d4a24 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -184,6 +184,19 @@ virNodeParseSocket(const char *dir, unsigned int cpu)
     return ret;
 }

+# ifndef CPU_COUNT
+static int
+CPU_COUNT(cpu_set_t *set)
+{
+    int i, count = 0;
+
+    for (i = 0; i < CPU_SETSIZE; i++)
+        if (CPU_ISSET(i, set))
+            count++;
+    return count;
+}
+# endif /* !CPU_COUNT */
+
 /* parses a node entry, returning number of processors in the node and
  * filling arguments */
 static int
-- 
1.7.11.4


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