Le lundi, 2 février 2015, 14.34:14 Michael Biebl a écrit :
> To keep the diff smaller, could you change the patch to simply use
> (…)
> A more verbose patch header would be great as well.
> Just add a few sentences that for MM we use runtime detection since we
> want the dbus autostart behaviour on !systemd for MM.
Something along these lines?
Cheers,
OdyX
>From 80f1f68bb928e732a3d206f7001c552f4d55c0c7 Mon Sep 17 00:00:00 2001
From: Didier Raboud <o...@debian.org>
Date: Mon, 2 Feb 2015 16:06:32 +0100
Subject: [PATCH] In ModemManager lifecycle handler, replace build-time
HAVE_SYSTEMD with runtime sd_booted calls.
This makes NetworkManager use runtime detection to manage the ModemManager lifecycle when not run by systemd.
Under systemd, we keep the dbus autostart behaviour to manage ModemManager.
Bug-Debian: #770871
---
src/devices/wwan/nm-modem-manager.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/devices/wwan/nm-modem-manager.c b/src/devices/wwan/nm-modem-manager.c
index c481170..13b7531 100644
--- a/src/devices/wwan/nm-modem-manager.c
+++ b/src/devices/wwan/nm-modem-manager.c
@@ -21,6 +21,7 @@
*/
#include <string.h>
+#include <systemd/sd-daemon.h>
#include "config.h"
#include "nm-modem-manager.h"
#include "nm-logging.h"
@@ -466,10 +467,10 @@ modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
if (!name_owner) {
nm_log_info (LOGD_MB, "ModemManager disappeared from bus");
-#if !HAVE_SYSTEMD
- /* If not managed by systemd, schedule relaunch */
- schedule_modem_manager_1_relaunch (self, 0);
-#endif
+ if (!sd_booted()) {
+ /* If not managed by systemd, schedule relaunch */
+ schedule_modem_manager_1_relaunch (self, 0);
+ }
return;
}
@@ -490,13 +491,15 @@ modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
*/
}
-#if !HAVE_SYSTEMD
-
static void
modem_manager_1_poke_cb (GDBusConnection *connection,
GAsyncResult *res,
NMModemManager *self)
{
+ /* Do nothing if booted with systemd */
+ if (sd_booted())
+ return;
+
GError *error = NULL;
GVariant *result;
@@ -525,6 +528,10 @@ modem_manager_1_poke_cb (GDBusConnection *connection,
static void
modem_manager_1_poke (NMModemManager *self)
{
+ /* Do nothing if booted with systemd */
+ if (sd_booted())
+ return;
+
/* If there is no current owner right away, ensure we poke to get one */
g_dbus_connection_call (self->priv->dbus_connection,
"org.freedesktop.ModemManager1",
@@ -540,8 +547,6 @@ modem_manager_1_poke (NMModemManager *self)
g_object_ref (self)); /* user_data */
}
-#endif /* HAVE_SYSTEMD */
-
static void
modem_manager_1_check_name_owner (NMModemManager *self)
{
@@ -555,10 +560,10 @@ modem_manager_1_check_name_owner (NMModemManager *self)
return;
}
-#if !HAVE_SYSTEMD
- /* If the lifecycle is not managed by systemd, poke */
- modem_manager_1_poke (self);
-#endif
+ if (!sd_booted()) {
+ /* If the lifecycle is not managed by systemd, poke */
+ modem_manager_1_poke (self);
+ }
}
static void
--
2.1.4