[libvirt] [PATCH] udev: Fix build on older platforms

Daniel P. Berrange berrange at redhat.com
Wed May 31 10:26:41 UTC 2017


On Wed, May 31, 2017 at 12:22:01PM +0200, Erik Skultety wrote:
> Caused by commit @d1eea6c1 due to the missing symbol on older platforms.
> 
> Signed-off-by: Erik Skultety <eskultet at redhat.com>
> ---
> Despite falling under build-breaker category, I'd like to get a proper review,
> since I'm not really familiar with autoconf and there might be a better fix.
> 
> Erik
> 
>  configure.ac                       | 2 +-
>  src/node_device/node_device_udev.c | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 246f4e077..b78c8b790 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -322,7 +322,7 @@ AC_CHECK_FUNCS_ONCE([cfmakeraw fallocate geteuid getgid getgrnam_r \
>    getmntent_r getpwuid_r getrlimit getuid if_indextoname kill mmap \
>    newlocale posix_fallocate posix_memalign prlimit regexec \
>    sched_getaffinity setgroups setns setrlimit symlink sysctlbyname \
> -  getifaddrs sched_setscheduler unshare])
> +  getifaddrs sched_setscheduler unshare udev_monitor_set_receive_buffer_size])

That is always going to fail - this AC_CHECK_FUNCS_ONCE macro is only
able to detect functions that are part of glibc.


Take a look at m4/virt-dbus.m4 for an example of how to check for a
function in another library, after detecting the library with pkgconfig


>  dnl Availability of various common headers (non-fatal if missing).
>  AC_CHECK_HEADERS([pwd.h regex.h sys/un.h \
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index a69dc1175..01438ea17 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -1764,12 +1764,14 @@ static int nodeStateInitialize(bool privileged,
> 
>      udev_monitor_enable_receiving(priv->udev_monitor);
> 
> +#if HAVE_UDEV_MONITOR_SET_RECEIVE_BUFFER_SIZE
>      /* mimic udevd's behaviour and override the systems rmem_max limit in case
>       * there's a significant number of device 'add' events
>       */
>      if (geteuid() == 0)
>          udev_monitor_set_receive_buffer_size(priv->udev_monitor,
>                                               128 * 1024 * 1024);
> +#endif
> 
>      /* We register the monitor with the event callback so we are
>       * notified by udev of device changes before we enumerate existing
> --
> 2.13.0
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list