[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:15:27 UTC 2010


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 ?

 thanks,

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