Re: [PATCH] build: trivial fix error: implicit declaration of function 'malloc'

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

 



On Thu, 22 Nov 2012 13:36:14 +0000
"Daniel P. Berrange" <berrange@xxxxxxxxxx> 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

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