[libvirt] [PATCH] build: trivial fix error: implicit declaration of function 'malloc'
Natanael Copa
ncopa at alpinelinux.org
Thu Nov 22 13:46:51 UTC 2012
On Thu, 22 Nov 2012 13:36:14 +0000
"Daniel P. Berrange" <berrange at redhat.com> wrote:
> On Thu, Nov 22, 2012 at 01:28:08PM +0100, Natanael Copa wrote:
> > Fixes this error when building with -Werror on Alpine Linux:
...
> > --- a/src/util/processinfo.c
> > +++ b/src/util/processinfo.c
> > @@ -21,6 +21,7 @@
> >
> > #include <config.h>
> >
> > +#include <stdlib.h>
> > #include <sched.h>
> >
> > #include "processinfo.h"
>
> Let me guess, this is a failure seen with uclibc too ? The line
> that warning corresponds to is
>
> mask = CPU_ALLOC(numcpus);
>
> On glibc this is defined to a function _sched_cpualloc(), hence
> we don't see a warning.
>
> If your headers are defining this in terms of malloc(), then IMHO,
> the sched.h should be including stdlib.h on our behalf. IOW, I
> think this is a bug in the c library headers
You are right. uclibc does this:
#if 0 /* in uClibc we use macros */
extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur;
extern void __sched_cpufree (cpu_set_t *__set) __THROW;
#else
# define __sched_cpualloc(cnt) ((cpu_set_t *)malloc(__CPU_ALLOC_SIZE(cnt)))
# define __sched_cpufree(__set) free(__set)
#endif
And since this is only a warning, I don't think its worth the effort.
Thanks!
-nc
More information about the libvir-list
mailing list