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

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

 



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

--
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]