1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-12 13:17:58 +03:00

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.
This commit is contained in:
Eric Blake 2012-08-21 11:10:14 -06:00
parent 77de1f3573
commit 0d03735f4a

View File

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