Per our supported platforms the minimum available versions are:
CentOS Stream 9: 2.68.4
Debian 11: 2.66.8
Fedora 39: 2.78.6
openSUSE Leap 15.6: 2.78.6
Ubuntu 24.04: 2.72.4
FreeBSD: 2.80.5
Bump to 2.66 which is limited by Debian 11. While ideally we'd bump to
2.68 which would give us 'g_strv_builder' and friends 2.66 is enough for
g_ptr_array_steal() which can be used to emulate the former with almost
no extra code.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
libvirt.spec.in | 2 +-
meson.build | 2 +-
src/libvirt_private.syms | 4 --
src/qemu/qemu_agent.c | 2 +-
src/qemu/qemu_monitor.c | 2 +-
src/util/glibcompat.c | 94 ----------------------------------------
src/util/glibcompat.h | 18 --------
src/util/vireventglib.c | 12 ++---
8 files changed, 10 insertions(+), 126 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index f397b95b79..c5585a72c0 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -357,7 +357,7 @@ BuildRequires: gcc
%if %{with_libxl}
BuildRequires: xen-devel
%endif
-BuildRequires: glib2-devel >= 2.58
+BuildRequires: glib2-devel >= 2.66
BuildRequires: libxml2-devel
BuildRequires: readline-devel
BuildRequires: pkgconfig(bash-completion) >= 2.0
diff --git a/meson.build b/meson.build
index 1b0b717901..52fef8c0fb 100644
--- a/meson.build
+++ b/meson.build
@@ -1004,7 +1004,7 @@ else
endif
endif
-glib_version = '2.58.0'
+glib_version = '2.66.0'
glib_dep = dependency('glib-2.0', version: '>=' + glib_version)
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_version)
if host_machine.system() == 'windows'
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ee90fb2b84..2fe0a07944 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1879,10 +1879,6 @@ virStorageSourceUpdatePhysicalSize;
# util/glibcompat.h
-vir_g_fsync;
-vir_g_source_unref;
-vir_g_strdup_printf;
-vir_g_strdup_vprintf;
vir_g_string_replace;
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 22359f8518..43fca86f10 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -448,7 +448,7 @@ qemuAgentUnregister(qemuAgent *agent)
{
if (agent->watch) {
g_source_destroy(agent->watch);
- vir_g_source_unref(agent->watch, agent->context);
+ g_source_unref(agent->watch);
agent->watch = NULL;
}
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index ec2f166785..e0b1bf1d37 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -745,7 +745,7 @@ qemuMonitorUnregister(qemuMonitor *mon)
{
if (mon->watch) {
g_source_destroy(mon->watch);
- vir_g_source_unref(mon->watch, mon->context);
+ g_source_unref(mon->watch);
mon->watch = NULL;
}
}
diff --git a/src/util/glibcompat.c b/src/util/glibcompat.c
index 98dcfab389..bcb666992a 100644
--- a/src/util/glibcompat.c
+++ b/src/util/glibcompat.c
@@ -63,100 +63,6 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#undef g_fsync
-#undef g_strdup_printf
-#undef g_strdup_vprintf
-
-
-/* Drop when min glib >= 2.63.0 */
-gint
-vir_g_fsync(gint fd)
-{
-#ifdef G_OS_WIN32
- return _commit(fd);
-#else
- return fsync(fd);
-#endif
-}
-
-
-/* Due to a bug in glib, g_strdup_printf() nor g_strdup_vprintf()
- * abort on OOM. It's fixed in glib's upstream. Provide our own
- * implementation until the fix gets distributed. */
-char *
-vir_g_strdup_printf(const char *msg, ...)
-{
- va_list args;
- char *ret;
- va_start(args, msg);
- ret = g_strdup_vprintf(msg, args);
- if (!ret)
- abort();
- va_end(args);
- return ret;
-}
-
-
-char *
-vir_g_strdup_vprintf(const char *msg, va_list args)
-{
- char *ret;
- ret = g_strdup_vprintf(msg, args);
- if (!ret)
- abort();
- return ret;
-}
-
-
-/*
- * If the last reference to a GSource is released in a non-main
- * thread we're exposed to a race condition that causes a
- * crash:
- *
- *
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1358
- *
- * Thus we're using an idle func to release our ref...
- *
- * ...but this imposes a significant performance penalty on
- * I/O intensive workloads which are sensitive to the iterations
- * of the event loop, so avoid the workaround if we know we have
- * new enough glib.
- *
- * The function below is used from a header file definition.
- *
- * Drop when min glib >= 2.64.0
- */
-#if GLIB_CHECK_VERSION(2, 64, 0)
-void vir_g_source_unref(GSource *src, GMainContext *ctx G_GNUC_UNUSED)
-{
- g_source_unref(src);
-}
-#else
-
-static gboolean
-virEventGLibSourceUnrefIdle(gpointer data)
-{
- GSource *src = data;
-
- g_source_unref(src);
-
- return FALSE;
-}
-
-void vir_g_source_unref(GSource *src, GMainContext *ctx)
-{
- GSource *idle = g_idle_source_new();
-
- g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL);
-
- g_source_attach(idle, ctx);
-
- g_source_unref(idle);
-}
-
-#endif
-
-
/**
* Adapted (to pass syntax check) from 'g_string_replace' from
* glib-2.81.1. Drop once minimum glib is bumped to 2.68.
diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h
index 474ff95bc5..a3d01089e6 100644
--- a/src/util/glibcompat.h
+++ b/src/util/glibcompat.h
@@ -42,24 +42,6 @@
#endif /* GLib < 2.67.0 */
-
-gint vir_g_fsync(gint fd);
-char *vir_g_strdup_printf(const char *msg, ...)
- G_GNUC_PRINTF(1, 2);
-char *vir_g_strdup_vprintf(const char *msg, va_list args)
- G_GNUC_PRINTF(1, 0);
-
-#if !GLIB_CHECK_VERSION(2, 64, 0)
-# define g_strdup_printf vir_g_strdup_printf
-# define g_strdup_vprintf vir_g_strdup_vprintf
-#endif
-
-#undef g_fsync
-#define g_fsync vir_g_fsync
-
-void vir_g_source_unref(GSource *src, GMainContext *ctx);
-
-
/* Drop once we require glib-2.68 at minimum */
guint
vir_g_string_replace(GString *string,
diff --git a/src/util/vireventglib.c b/src/util/vireventglib.c
index 023dc37445..6c54f62123 100644
--- a/src/util/vireventglib.c
+++ b/src/util/vireventglib.c
@@ -213,7 +213,7 @@ virEventGLibHandleUpdate(int watch,
if (data->source != NULL) {
VIR_DEBUG("Removed old handle source=%p", data->source);
g_source_destroy(data->source);
- vir_g_source_unref(data->source, NULL);
+ g_source_unref(data->source);
}
data->source = virEventGLibAddSocketWatch(
@@ -227,7 +227,7 @@ virEventGLibHandleUpdate(int watch,
VIR_DEBUG("Removed old handle source=%p", data->source);
g_source_destroy(data->source);
- vir_g_source_unref(data->source, NULL);
+ g_source_unref(data->source);
data->source = NULL;
data->events = 0;
}
@@ -276,7 +276,7 @@ virEventGLibHandleRemove(int watch)
if (data->source != NULL) {
g_source_destroy(data->source);
- vir_g_source_unref(data->source, NULL);
+ g_source_unref(data->source);
data->source = NULL;
data->events = 0;
}
@@ -409,7 +409,7 @@ virEventGLibTimeoutUpdate(int timer,
if (interval >= 0) {
if (data->source != NULL) {
g_source_destroy(data->source);
- vir_g_source_unref(data->source, NULL);
+ g_source_unref(data->source);
}
data->interval = interval;
@@ -419,7 +419,7 @@ virEventGLibTimeoutUpdate(int timer,
goto cleanup;
g_source_destroy(data->source);
- vir_g_source_unref(data->source, NULL);
+ g_source_unref(data->source);
data->source = NULL;
}
@@ -468,7 +468,7 @@ virEventGLibTimeoutRemove(int timer)
if (data->source != NULL) {
g_source_destroy(data->source);
- vir_g_source_unref(data->source, NULL);
+ g_source_unref(data->source);
data->source = NULL;
}
--
2.48.1