Re: [PATCH v3 02/19] build: link to glib library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 10, 2019 at 11:53:56AM +0100, Daniel P. Berrangé wrote:
Add the main glib.h to internal.h so that all common code can use it.

Historically glib allowed applications to register an alternative
memory allocator, so mixing g_malloc/g_free with malloc/free was not
safe.

This was feature was dropped in 2.46.0 with:

     commit 3be6ed60aa58095691bd697344765e715a327fc1
     Author: Alexander Larsson <alexl@xxxxxxxxxx>
     Date:   Sat Jun 27 18:38:42 2015 +0200

       Deprecate and drop support for memory vtables

Applications are still encourged to match g_malloc/g_free, but it is no
longer a mandatory requirement for correctness, just stylistic. This is
explicitly clarified in

   commit 1f24b36607bf708f037396014b2cdbc08d67b275
   Author: Daniel P. Berrangé <berrange@xxxxxxxxxx>
   Date:   Thu Sep 5 14:37:54 2019 +0100

       gmem: clarify that g_malloc always uses the system allocator

Applications can still use custom allocators in general, but they must
do this by linking to a library that replaces the core malloc/free
implemenentation entirely, instead of via a glib specific call.

This means that libvirt does not need to be concerned about use of
g_malloc/g_free causing an ABI change in the public libary, and can
avoid memory copying when talking to external libraries.

This patch probes for glib, which provides the foundation layer with
a collection of data structures, helper APIs, and platform portability
logic.

Later patches will introduce linkage to gobject which provides the
object type system, built on glib, and gio which providing objects
for various interesting tasks, most notably including DBus client
and server support and portable sockets APIs, but much more too.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
docs/hacking.html.in            | 21 +++++++++++++++++++++
src/Makefile.am                 |  3 +++
src/access/Makefile.inc.am      |  4 +++-
src/bhyve/Makefile.inc.am       |  1 +
src/interface/Makefile.inc.am   |  1 +
src/internal.h                  |  1 +
src/libxl/Makefile.inc.am       |  1 +
src/locking/Makefile.inc.am     |  9 ++++++++-
src/logging/Makefile.inc.am     |  1 +
src/lxc/Makefile.inc.am         |  4 ++++
src/network/Makefile.inc.am     |  2 ++
src/node_device/Makefile.inc.am |  5 ++++-
src/nwfilter/Makefile.inc.am    |  1 +
src/qemu/Makefile.inc.am        |  1 +
src/remote/Makefile.inc.am      |  2 ++
src/secret/Makefile.inc.am      |  1 +
src/security/Makefile.inc.am    |  1 +
src/storage/Makefile.inc.am     | 16 ++++++++++++++++
src/vbox/Makefile.inc.am        |  1 +
src/vz/Makefile.inc.am          |  1 +
tests/Makefile.am               |  7 +++++--
tools/Makefile.am               |  4 ++++
22 files changed, 83 insertions(+), 5 deletions(-)


Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux