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

Daniel Veillard veillard at redhat.com
Mon Jan 25 14:38:55 UTC 2010


On Mon, Jan 25, 2010 at 02:22:16PM +0000, Daniel P. Berrange wrote:
> 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.

  Ah, right, I got confused byt the output,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list