From: Eric Blake Date: Tue, 21 Aug 2012 17:10:14 +0000 (-0600) Subject: build: work with glibc that lacks CPU_COUNT X-Git-Tag: v0.10.0-rc1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d03735f4a1e73b1dfce10e0c15f798927284f99;p=thirdparty%2Flibvirt.git 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 was not added until later glibc. * src/nodeinfo.c (CPU_COUNT): Add fallback implementation. --- diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 84a5d666e3..e3d4a242dd 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