|
|
43fe83 |
From bc84df329033b0162efd5e4fd2753666d44be3ee Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <bc84df329033b0162efd5e4fd2753666d44be3ee.1381871412.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
43fe83 |
Date: Mon, 14 Oct 2013 16:45:18 +0100
|
|
|
43fe83 |
Subject: [PATCH] Add a method for closing the dbus system bus connection
|
|
|
43fe83 |
|
|
|
43fe83 |
For
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=998365
|
|
|
43fe83 |
|
|
|
43fe83 |
If the dbus system bus connection is marked as private, then
|
|
|
43fe83 |
allow it to be closed.
|
|
|
43fe83 |
|
|
|
43fe83 |
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
|
|
43fe83 |
(cherry picked from commit 489beb0aba5aad0e5423e123db9a7ab67421ca48)
|
|
|
43fe83 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/libvirt_private.syms | 1 +
|
|
|
43fe83 |
src/util/virdbus.c | 12 ++++++++++++
|
|
|
43fe83 |
src/util/virdbus.h | 1 +
|
|
|
43fe83 |
3 files changed, 14 insertions(+)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
|
43fe83 |
index c91a9f9..5e4de67 100644
|
|
|
43fe83 |
--- a/src/libvirt_private.syms
|
|
|
43fe83 |
+++ b/src/libvirt_private.syms
|
|
|
43fe83 |
@@ -1292,6 +1292,7 @@ virConfWriteMem;
|
|
|
43fe83 |
|
|
|
43fe83 |
# util/virdbus.h
|
|
|
43fe83 |
virDBusCallMethod;
|
|
|
43fe83 |
+virDBusCloseSystemBus;
|
|
|
43fe83 |
virDBusGetSessionBus;
|
|
|
43fe83 |
virDBusGetSystemBus;
|
|
|
43fe83 |
virDBusHasSystemBus;
|
|
|
43fe83 |
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
|
|
|
43fe83 |
index bcc5b1c..da69430 100644
|
|
|
43fe83 |
--- a/src/util/virdbus.c
|
|
|
43fe83 |
+++ b/src/util/virdbus.c
|
|
|
43fe83 |
@@ -122,6 +122,14 @@ virDBusHasSystemBus(void)
|
|
|
43fe83 |
}
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
+void virDBusCloseSystemBus(void)
|
|
|
43fe83 |
+{
|
|
|
43fe83 |
+ if (systembus && !sharedBus) {
|
|
|
43fe83 |
+ dbus_connection_close(systembus);
|
|
|
43fe83 |
+ systembus = NULL;
|
|
|
43fe83 |
+ }
|
|
|
43fe83 |
+}
|
|
|
43fe83 |
+
|
|
|
43fe83 |
static void virDBusSessionBusInit(void)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
sessionbus = virDBusBusInit(DBUS_BUS_SESSION, &sessiondbuserr);
|
|
|
43fe83 |
@@ -1293,6 +1301,10 @@ virDBusHasSystemBus(void)
|
|
|
43fe83 |
return false;
|
|
|
43fe83 |
}
|
|
|
43fe83 |
|
|
|
43fe83 |
+void virDBusCloseSystemBus(void)
|
|
|
43fe83 |
+{
|
|
|
43fe83 |
+ /* nothing */
|
|
|
43fe83 |
+}
|
|
|
43fe83 |
|
|
|
43fe83 |
DBusConnection *virDBusGetSessionBus(void)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
diff --git a/src/util/virdbus.h b/src/util/virdbus.h
|
|
|
43fe83 |
index 125a405..979c566 100644
|
|
|
43fe83 |
--- a/src/util/virdbus.h
|
|
|
43fe83 |
+++ b/src/util/virdbus.h
|
|
|
43fe83 |
@@ -35,6 +35,7 @@ void virDBusSetSharedBus(bool shared);
|
|
|
43fe83 |
|
|
|
43fe83 |
DBusConnection *virDBusGetSystemBus(void);
|
|
|
43fe83 |
bool virDBusHasSystemBus(void);
|
|
|
43fe83 |
+void virDBusCloseSystemBus(void);
|
|
|
43fe83 |
DBusConnection *virDBusGetSessionBus(void);
|
|
|
43fe83 |
|
|
|
43fe83 |
int virDBusCallMethod(DBusConnection *conn,
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.3.2
|
|
|
43fe83 |
|