[libvirt] [PATCH 2/4] Add some missing include files which break build in certain platforms

Daniel P. Berrange berrange at redhat.com
Mon Jan 25 14:22:16 UTC 2010


On Mon, Jan 25, 2010 at 03:15:27PM +0100, Daniel Veillard wrote:
> On Fri, Jan 22, 2010 at 05:01:12PM +0000, Daniel P. Berrange wrote:
> > Two files were using functions from <sys/stat.h> but not including
> > in. Most of the time they got this automatically via another header,
> > but certain build flag combinations can reveal the problem
> > 
> > * src/lxc/lxc_container.c, src/node_device/node_device_linux_sysfs.c:
> >   Add <sys/stat.h>
> > ---
> >  src/lxc/lxc_container.c                   |    1 +
> >  src/node_device/node_device_linux_sysfs.c |    1 +
> >  2 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> > index 539a1f4..02242c7 100644
> > --- a/src/lxc/lxc_container.c
> > +++ b/src/lxc/lxc_container.c
> > @@ -32,6 +32,7 @@
> >  #include <sys/ioctl.h>
> >  #include <sys/mount.h>
> >  #include <sys/wait.h>
> > +#include <sys/stat.h>
> >  #include <unistd.h>
> >  #include <mntent.h>
> >  
> > diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
> > index 361a084..33e658d 100644
> > --- a/src/node_device/node_device_linux_sysfs.c
> > +++ b/src/node_device/node_device_linux_sysfs.c
> > @@ -23,6 +23,7 @@
> >  #include <config.h>
> >  
> >  #include <fcntl.h>
> > +#include <sys/stat.h>
> >  
> >  #include "node_device_driver.h"
> >  #include "node_device_hal.h"
> 
>   ACK, I remember seeing some warning on builds for stat() but there
> were another one, I need to dig out ... here they are:
> 
> ---------------------
>   CC     libvirt_driver_lxc_la-lxc_driver.lo
>   lxc/lxc_container.c: In function 'lxcContainerPopulateDevices':
>   lxc/lxc_container.c:465: warning: implicit declaration of function
>   'mknod'
>   lxc/lxc_container.c:465: warning: nested extern declaration of 'mknod'
>   lxc/lxc_container.c:466: warning: implicit declaration of function
>   'chmod'
>   lxc/lxc_container.c:466: warning: nested extern declaration of 'chmod'
> 
> and
> 
>    CC     libvirt_lxc-lxc_controller.o
>    lxc/lxc_container.c: In function 'lxcContainerPopulateDevices':
>    lxc/lxc_container.c:465: warning: implicit declaration of function
>    'mknod'
>    lxc/lxc_container.c:465: warning: nested extern declaration of
>    'mknod'
>    lxc/lxc_container.c:466: warning: implicit declaration of function
>    'chmod'
>    lxc/lxc_container.c:466: warning: nested extern declaration of
>    'chmod'
> ---------------------
> 
> since <fcntl.h> <sys/types.h> and <unistd.h> are in src/lxc/lxc_driver.c
> I think this means #include <sys/stat.h> should also be added to
> src/lxc/lxc_driver.c too to avoid the warning, can you add it too ?

Those warnings you paste are the ones that my patch is fixing - I don't
think we need to change  lxc_driver.c - just  lxc_container.c should be
sufficient, as lxc_driver.c doesn't use the mknod/chmod stuff at all.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list