From nobody Tue Apr 30 02:40:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1501669577026838.0248822847254; Wed, 2 Aug 2017 03:26:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D9FF8123A; Wed, 2 Aug 2017 10:26:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 982246941D; Wed, 2 Aug 2017 10:26:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 110091803B21; Wed, 2 Aug 2017 10:26:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v72AQCBG007685 for ; Wed, 2 Aug 2017 06:26:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4EC107F1CC; Wed, 2 Aug 2017 10:26:12 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EA407F1AE; Wed, 2 Aug 2017 10:26:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0D9FF8123A Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Wed, 2 Aug 2017 11:26:06 +0100 Message-Id: <20170802102606.10827-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] driver: conditionalize use of dlopen functions & use mingw-dlfcn X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 02 Aug 2017 10:26:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Not every platform is guaranteed to have dlopen/dlsym, so we should conditionalize its use. Suprisingly it is actually present for Win32 via the mingw-dlfcn add on, but we should still conditionalize it. Signed-off-by: Daniel P. Berrange --- configure.ac | 2 +- mingw-libvirt.spec.in | 2 ++ src/driver.c | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index b12b7fae1..2b3375138 100644 --- a/configure.ac +++ b/configure.ac @@ -328,7 +328,7 @@ dnl Availability of various common headers (non-fatal i= f missing). AC_CHECK_HEADERS([pwd.h regex.h sys/un.h \ sys/poll.h syslog.h mntent.h net/ethernet.h linux/magic.h \ sys/un.h sys/syscall.h sys/sysctl.h netinet/tcp.h ifaddrs.h \ - libtasn1.h sys/ucred.h sys/mount.h stdarg.h]) + libtasn1.h sys/ucred.h sys/mount.h stdarg.h dlfcn.h]) dnl Check whether endian provides handy macros. AC_CHECK_DECLS([htole64], [], [], [[#include ]]) AC_CHECK_FUNCS([stat stat64 __xstat __xstat64 lstat lstat64 __lxstat __lxs= tat64]) diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in index 553d14022..dcb0837f7 100644 --- a/mingw-libvirt.spec.in +++ b/mingw-libvirt.spec.in @@ -54,6 +54,8 @@ BuildRequires: mingw32-libxml2 BuildRequires: mingw64-libxml2 BuildRequires: mingw32-portablexdr BuildRequires: mingw64-portablexdr +BuildRequires: mingw32-dlfcn +BuildRequires: mingw64-dlfcn =20 BuildRequires: pkgconfig # Need native version for msgfmt diff --git a/src/driver.c b/src/driver.c index 2e7dd01df..04dd0a443 100644 --- a/src/driver.c +++ b/src/driver.c @@ -34,10 +34,11 @@ VIR_LOG_INIT("driver"); =20 =20 /* XXX re-implement this for other OS, or use libtools helper lib ? */ - -#include #define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver" =20 +#ifdef HAVE_DLFCN_H +# include + =20 static void * virDriverLoadModuleFile(const char *file) @@ -126,6 +127,19 @@ virDriverLoadModuleFull(const char *path, return ret; } =20 +#else /* ! HAVE_DLFCN_H */ +int +virDriverLoadModuleFull(const char *path ATTRIBUTE_UNUSED, + const char *regfunc ATTRIBUTE_UNUSED, + void **handle) +{ + VIR_DEBUG("dlopen not available on this platform"); + if (handle) + *handle =3D NULL; + return -1; +} +#endif /* ! HAVE_DLFCN_H */ + =20 int virDriverLoadModule(const char *name, --=20 2.13.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list