[systemd-commits] 7 commits - man/systemd.network.xml NEWS src/analyze src/boot src/bus-proxyd src/cgls src/cgroups-agent src/core src/fsck src/hostname src/import src/journal src/libsystemd src/locale src/login src/machine src/nspawn src/nss-mymachines src/nss-resolve src/resolve-host src/run src/shared src/systemctl src/systemd src/timedate

David Herrmann dvdhrm at kemper.freedesktop.org
Sun Jul 5 02:34:43 PDT 2015


 NEWS                                      |   20 ++++++++++++++++++++
 man/systemd.network.xml                   |    5 +++--
 src/analyze/analyze.c                     |    2 +-
 src/boot/bootctl.c                        |    2 +-
 src/bus-proxyd/proxy.c                    |    8 ++++----
 src/cgls/cgls.c                           |    2 +-
 src/cgroups-agent/cgroups-agent.c         |    2 +-
 src/core/mount-setup.c                    |    2 +-
 src/fsck/fsck.c                           |    2 +-
 src/hostname/hostnamectl.c                |    2 +-
 src/hostname/hostnamed.c                  |    4 ++--
 src/import/importd.c                      |    3 +--
 src/journal/journalctl.c                  |    2 +-
 src/libsystemd/libsystemd.sym             |    1 +
 src/libsystemd/sd-bus/busctl.c            |    2 +-
 src/libsystemd/sd-bus/sd-bus.c            |   11 +++++++++++
 src/libsystemd/sd-bus/test-bus-chat.c     |    4 ++--
 src/libsystemd/sd-bus/test-bus-gvariant.c |    2 +-
 src/libsystemd/sd-bus/test-bus-match.c    |    2 +-
 src/locale/localectl.c                    |    2 +-
 src/locale/localed.c                      |    4 ++--
 src/login/inhibit.c                       |    2 +-
 src/login/loginctl.c                      |    2 +-
 src/login/pam_systemd.c                   |    4 ++--
 src/machine/machinectl.c                  |    2 +-
 src/nspawn/nspawn.c                       |    4 ++--
 src/nss-mymachines/nss-mymachines.c       |    4 ++--
 src/nss-resolve/nss-resolve.c             |    6 +++---
 src/resolve-host/resolve-host.c           |    2 +-
 src/run/run.c                             |    2 +-
 src/shared/bus-util.h                     |   11 ++---------
 src/systemctl/systemctl.c                 |   10 +++++-----
 src/systemd/sd-bus.h                      |    1 +
 src/timedate/timedatectl.c                |    2 +-
 src/timedate/timedated.c                  |    4 ++--
 35 files changed, 83 insertions(+), 57 deletions(-)

New commits:
commit 1f49dffc0fcd9859feb1b97e1e3983d0b911f425
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Sun Jul 5 11:25:38 2015 +0200

    core: don't mount kdbusfs if not wanted
    
    Just like we conditionalize loading kdbus.ko, we should conditionalize
    mounting kdbusfs. Otherwise, we might run with kdbus if it is builtin,
    even though the user didn't want this.

diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index 42a6b95..163b35f 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -105,7 +105,7 @@ static const MountPoint mount_table[] = {
           is_efi_boot,   MNT_NONE                   },
 #endif
         { "kdbusfs",    "/sys/fs/kdbus",             "kdbusfs",    NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
-          NULL,       MNT_IN_CONTAINER },
+          is_kdbus_wanted,       MNT_IN_CONTAINER },
 };
 
 /* These are API file systems that might be mounted by other software,

commit 0db83ad7334809a6605501e24bad55f3b652c072
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Sun Jul 5 11:04:59 2015 +0200

    NEWS: mention accelerometer removal for 222
    
    Add NEWS entry for 222 and mention the removal of the udev accelerometer.
    iio-sensor-proxy-1.0 is required if you want orientation data to still
    work.

diff --git a/NEWS b/NEWS
index bda8a8e..097e853 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,25 @@
 systemd System and Service Manager
 
+CHANGES WITH 222:
+
+        * The udev accelerometer helper was removed. The functionality
+          is now fully included in iio-sensor-proxy. But this means,
+          older iio-sensor-proxy versions will no longer provide
+          accelerometer/orientation data with this systemd version.
+          Please upgrade iio-sensor-proxy to version 1.0.
+
+        Contributions from: Abdo Roig-Maranges, Andrew Eikum, Bastien Nocera,
+        Cédric Delmas, Christian Hesse, Christos Trochalakis, Daniel Mack,
+        daurnimator, David Herrmann, Dimitri John Ledkov, Eric Biggers, Eric
+        Cook, Felipe Sateler, Geert Jansen, Gerd Hoffmann, Gianpaolo Macario,
+        Greg Kroah-Hartman, Iago López Galeiras, Jan Alexander Steffens,
+        Jan Engelhardt, Jay Strict, Kay Sievers, Lennart Poettering,
+        Markus Knetschke, Martin Pitt, Michael Biebl, Michael Marineau, Michal
+        Sekletar, Miguel Bernal Marin, Peter Hutterer, Richard Maw, rinrinne,
+        Tom Gundersen, Vedran Miletić, WaLyong Cho, Zbigniew Jędrzejewski-Szmek
+
+        -- Berlin, 2015-07-XX
+
 CHANGES WITH 221:
 
         * The sd-bus.h and sd-event.h APIs have now been declared

commit 2cb9aa6bd16317de690462997441f10442e0cd43
Merge: e2bccc9 68cc17f
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Sat Jul 4 19:47:48 2015 -0400

    Merge pull request #488 from miguelinux/boot
    
    bootctl: fix sdboot to systemd-boot


commit 68cc17f13102bcb9aa425ef5f15feda1c2853ec8
Author: Miguel Bernal Marin <miguel.bernal.marin at linux.intel.com>
Date:   Sat Jul 4 17:03:50 2015 -0500

    bootctl: fix sdboot to systemd-boot
    
    sdboot was renamed to systemd-boot
    
    Fixes: e7dd673d1e0a ("gummiboot/sd-boot/systemd-boot: rename galore")
    
    Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin at linux.intel.com>

diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index 1e65597..ed69fb0 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -918,7 +918,7 @@ static int install_loader_config(const char *esp_path) {
 static int help(void) {
         printf("%s [COMMAND] [OPTIONS...]\n"
                "\n"
-               "Install, update or remove the sdboot EFI boot manager.\n\n"
+               "Install, update or remove the systemd-boot EFI boot manager.\n\n"
                "  -h --help          Show this help\n"
                "     --version       Print version\n"
                "     --path=PATH     Path to the EFI System Partition (ESP)\n"

commit e2bccc9d9974eb1290653ecfa3ccfd03c313842b
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Sat Jul 4 13:08:29 2015 +0200

    man: fix sysctl references in networkd-manpage
    
    We refer to the same sysctl-setting twice, which is misleading. Correctly
    list all global forwarding options. As we _always_ change the forwarding
    setting on links, they will get disabled by default. The global sysctl
    defaults thus will not have any effect.

diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index 1a2699a..71ced09 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -376,8 +376,9 @@
          <para>Note: unless this option is turned on, or set to <literal>kernel</literal>,
           no IP forwarding is done on this interface, even if this is
           globally turned on in the kernel, with the
-          <filename>net.ipv4.ip_forward</filename> and
-          <filename>net.ipv4.ip_forward</filename> sysctl
+          <filename>net.ipv4.ip_forward</filename>,
+          <filename>net.ipv4.conf.all.forwarding</filename>, and
+          <filename>net.ipv6.conf.all.forwarding</filename> sysctl
           options.</para>
           </listitem>
         </varlistentry>

commit 6acc94b6211af2c259453b9e6aa29c44967796f0
Merge: a0c8526 03976f7
Author: David Herrmann <dh.herrmann at googlemail.com>
Date:   Sat Jul 4 12:41:01 2015 +0200

    Merge pull request #485 from poettering/sd-bus-flush-close-unref
    
    sd-bus: introduce new sd_bus_flush_close_unref() call


commit 03976f7b4a84b8b1492a549a3470b2bba8f37008
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 3 19:49:03 2015 +0200

    sd-bus: introduce new sd_bus_flush_close_unref() call
    
    sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush()
    (which writes all unwritten messages out) + sd_bus_close() (which
    terminates the connection, releasing all unread messages) +
    sd_bus_unref() (which frees the connection).
    
    The combination of this call is used pretty frequently in systemd tools
    right before exiting, and should also be relevant for most external
    clients, and is hence useful to cover in a call of its own.
    
    Previously the combination of the three calls was already done in the
    _cleanup_bus_close_unref_ macro, but this was only available internally.
    
    Also see #327

diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 9583458..c0863e4 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1331,7 +1331,7 @@ int main(int argc, char *argv[]) {
                                  arg_user ? MANAGER_USER : MANAGER_SYSTEM,
                                  arg_man);
         else {
-                _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+                _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
 
                 r = bus_open_transport_systemd(arg_transport, arg_host, arg_user, &bus);
                 if (r < 0) {
diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index 1dc5517..c0055d3 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -45,7 +45,7 @@
 #include "formats-util.h"
 
 static int proxy_create_destination(Proxy *p, const char *destination, const char *local_sec, bool negotiate_fds) {
-        _cleanup_bus_close_unref_ sd_bus *b = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *b = NULL;
         int r;
 
         r = sd_bus_new(&b);
@@ -101,7 +101,7 @@ static int proxy_create_destination(Proxy *p, const char *destination, const cha
 }
 
 static int proxy_create_local(Proxy *p, int in_fd, int out_fd, bool negotiate_fds) {
-        _cleanup_bus_close_unref_ sd_bus *b = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *b = NULL;
         sd_id128_t server_id;
         int r;
 
@@ -238,8 +238,8 @@ Proxy *proxy_free(Proxy *p) {
         if (!p)
                 return NULL;
 
-        sd_bus_close_unrefp(&p->local_bus);
-        sd_bus_close_unrefp(&p->destination_bus);
+        sd_bus_flush_close_unref(p->local_bus);
+        sd_bus_flush_close_unref(p->destination_bus);
         set_free_free(p->owned_names);
         free(p);
 
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index c6f5485..46a4443 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -127,7 +127,7 @@ int main(int argc, char *argv[]) {
         int r = 0, retval = EXIT_FAILURE;
         int output_flags;
         _cleanup_free_ char *root = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
 
         log_parse_environment();
         log_open();
diff --git a/src/cgroups-agent/cgroups-agent.c b/src/cgroups-agent/cgroups-agent.c
index 529e843..612bc8f 100644
--- a/src/cgroups-agent/cgroups-agent.c
+++ b/src/cgroups-agent/cgroups-agent.c
@@ -26,7 +26,7 @@
 #include "bus-util.h"
 
 int main(int argc, char *argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         if (argc != 2) {
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 30254b6..bd3051f 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -62,7 +62,7 @@ static const char *arg_repair = "-a";
 
 static void start_target(const char *target) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         assert(target);
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 69ecd61..c996fc0 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -509,7 +509,7 @@ static int hostnamectl_main(sd_bus *bus, int argc, char *argv[]) {
 }
 
 int main(int argc, char *argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         setlocale(LC_ALL, "");
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 7ff3a4e..e52b872 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -663,7 +663,7 @@ static const sd_bus_vtable hostname_vtable[] = {
 };
 
 static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         assert(c);
@@ -695,7 +695,7 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
 int main(int argc, char *argv[]) {
         Context context = {};
         _cleanup_event_unref_ sd_event *event = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         log_set_target(LOG_TARGET_AUTO);
diff --git a/src/import/importd.c b/src/import/importd.c
index 03aede6..dd314f5 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -551,8 +551,7 @@ static Manager *manager_unref(Manager *m) {
 
         bus_verify_polkit_async_registry_free(m->polkit_registry);
 
-        sd_bus_close(m->bus);
-        sd_bus_unref(m->bus);
+        m->bus = sd_bus_flush_close_unref(m->bus);
         sd_event_unref(m->event);
 
         free(m);
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 76ec082..2d6ecfb 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1719,7 +1719,7 @@ static int access_check(sd_journal *j) {
 
 static int flush_to_var(void) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         _cleanup_close_ int watch_fd = -1;
         int r;
 
diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym
index 97005db..7bf1d66 100644
--- a/src/libsystemd/libsystemd.sym
+++ b/src/libsystemd/libsystemd.sym
@@ -465,4 +465,5 @@ global:
         /* sd-bus */
         sd_bus_emit_object_added;
         sd_bus_emit_object_removed;
+        sd_bus_flush_close_unref;
 } LIBSYSTEMD_221;
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 39caa4e..704939c 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -1973,7 +1973,7 @@ static int busctl_main(sd_bus *bus, int argc, char *argv[]) {
 }
 
 int main(int argc, char *argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         log_parse_environment();
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 5dd6468..0ca225c 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -1428,6 +1428,17 @@ _public_ void sd_bus_close(sd_bus *bus) {
          * ioctl on the fd when they are freed. */
 }
 
+_public_ sd_bus* sd_bus_flush_close_unref(sd_bus *bus) {
+
+        if (!bus)
+                return NULL;
+
+        sd_bus_flush(bus);
+        sd_bus_close(bus);
+
+        return sd_bus_unref(bus);
+}
+
 static void bus_enter_closing(sd_bus *bus) {
         assert(bus);
 
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c
index 046e999..754335b 100644
--- a/src/libsystemd/sd-bus/test-bus-chat.c
+++ b/src/libsystemd/sd-bus/test-bus-chat.c
@@ -262,7 +262,7 @@ fail:
 
 static void* client1(void*p) {
         _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         const char *hello;
         int r;
@@ -361,7 +361,7 @@ static int quit_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_er
 
 static void* client2(void*p) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         bool quit = false;
         const char *mid;
diff --git a/src/libsystemd/sd-bus/test-bus-gvariant.c b/src/libsystemd/sd-bus/test-bus-gvariant.c
index 22ea00c..9b7dd2e 100644
--- a/src/libsystemd/sd-bus/test-bus-gvariant.c
+++ b/src/libsystemd/sd-bus/test-bus-gvariant.c
@@ -132,7 +132,7 @@ static void test_bus_gvariant_get_alignment(void) {
 
 static void test_marshal(void) {
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL, *n = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         _cleanup_free_ void *blob;
         size_t sz;
         int r;
diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c
index a1687b1..83cb5c6 100644
--- a/src/libsystemd/sd-bus/test-bus-match.c
+++ b/src/libsystemd/sd-bus/test-bus-match.c
@@ -92,7 +92,7 @@ int main(int argc, char *argv[]) {
         };
 
         _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         enum bus_match_node_type i;
         sd_bus_slot slots[19];
         int r;
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 601839d..3616f4a 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -667,7 +667,7 @@ static int localectl_main(sd_bus *bus, int argc, char *argv[]) {
 }
 
 int main(int argc, char*argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         setlocale(LC_ALL, "");
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 0e59350..8875654 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -1240,7 +1240,7 @@ static const sd_bus_vtable locale_vtable[] = {
 };
 
 static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         assert(c);
@@ -1272,7 +1272,7 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
 int main(int argc, char *argv[]) {
         _cleanup_(context_free) Context context = {};
         _cleanup_event_unref_ sd_event *event = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         log_set_target(LOG_TARGET_AUTO);
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 0e5dce5..c53ea8a 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -223,7 +223,7 @@ static int parse_argv(int argc, char *argv[]) {
 
 int main(int argc, char *argv[]) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         log_parse_environment();
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 06208bc..9709eca 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -1389,7 +1389,7 @@ static int loginctl_main(int argc, char *argv[], sd_bus *bus) {
 }
 
 int main(int argc, char *argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         setlocale(LC_ALL, "");
diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
index dd192b9..2f39023 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
@@ -213,7 +213,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
                 *seat = NULL,
                 *type = NULL, *class = NULL,
                 *class_pam = NULL, *type_pam = NULL, *cvtnr = NULL, *desktop = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int session_fd = -1, existing, r;
         bool debug = false, remote;
         struct passwd *pw;
@@ -496,7 +496,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
                 int argc, const char **argv) {
 
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         const void *existing = NULL;
         const char *id;
         int r;
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 7938aa4..7cb6ce7 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -2572,7 +2572,7 @@ static int machinectl_main(int argc, char *argv[], sd_bus *bus) {
 }
 
 int main(int argc, char*argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         setlocale(LC_ALL, "");
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 7fa098b..4fa88c9 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2273,7 +2273,7 @@ static int drop_capabilities(void) {
 
 static int register_machine(pid_t pid, int local_ifindex) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         if (!arg_register)
@@ -2430,7 +2430,7 @@ static int register_machine(pid_t pid, int local_ifindex) {
 static int terminate_machine(pid_t pid) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         const char *path;
         int r;
 
diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
index 9476ad1..f712033 100644
--- a/src/nss-mymachines/nss-mymachines.c
+++ b/src/nss-mymachines/nss-mymachines.c
@@ -79,7 +79,7 @@ enum nss_status _nss_mymachines_gethostbyname4_r(
 
         struct gaih_addrtuple *r_tuple, *r_tuple_first = NULL;
         _cleanup_bus_message_unref_ sd_bus_message* reply = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         _cleanup_free_ int *ifindices = NULL;
         _cleanup_free_ char *class = NULL;
         size_t l, ms, idx;
@@ -228,7 +228,7 @@ enum nss_status _nss_mymachines_gethostbyname3_r(
                 char **canonp) {
 
         _cleanup_bus_message_unref_ sd_bus_message* reply = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         _cleanup_free_ char *class = NULL;
         unsigned c = 0, i = 0;
         char *r_name, *r_aliases, *r_addr, *r_addr_list;
diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c
index 8f181a6..da22f98 100644
--- a/src/nss-resolve/nss-resolve.c
+++ b/src/nss-resolve/nss-resolve.c
@@ -122,7 +122,7 @@ enum nss_status _nss_resolve_gethostbyname4_r(
         _cleanup_bus_message_unref_ sd_bus_message *req = NULL, *reply = NULL;
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         struct gaih_addrtuple *r_tuple, *r_tuple_first = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         const char *canonical = NULL;
         size_t l, ms, idx;
         char *r_name;
@@ -305,7 +305,7 @@ enum nss_status _nss_resolve_gethostbyname3_r(
         _cleanup_bus_message_unref_ sd_bus_message *req = NULL, *reply = NULL;
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         char *r_name, *r_aliases, *r_addr, *r_addr_list;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         size_t l, idx, ms, alen;
         const char *canonical;
         int c, r, i = 0, ifindex;
@@ -513,7 +513,7 @@ enum nss_status _nss_resolve_gethostbyaddr2_r(
         _cleanup_bus_message_unref_ sd_bus_message *req = NULL, *reply = NULL;
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         char *r_name, *r_aliases, *r_addr, *r_addr_list;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         unsigned c = 0, i = 0;
         size_t ms = 0, idx;
         const char *n;
diff --git a/src/resolve-host/resolve-host.c b/src/resolve-host/resolve-host.c
index 068756c..f9448e3 100644
--- a/src/resolve-host/resolve-host.c
+++ b/src/resolve-host/resolve-host.c
@@ -592,7 +592,7 @@ static int parse_argv(int argc, char *argv[]) {
 }
 
 int main(int argc, char **argv) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         log_parse_environment();
diff --git a/src/run/run.c b/src/run/run.c
index 99d960a..148854a 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -1099,7 +1099,7 @@ static int start_transient_timer(
 }
 
 int main(int argc, char* argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         _cleanup_free_ char *description = NULL, *command = NULL;
         int r;
 
diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h
index d8dba58..4ae216b 100644
--- a/src/shared/bus-util.h
+++ b/src/shared/bus-util.h
@@ -135,22 +135,15 @@ typedef struct UnitInfo {
 
 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u);
 
-static inline void sd_bus_close_unrefp(sd_bus **bus) {
-        if (*bus) {
-                sd_bus_flush(*bus);
-                sd_bus_close(*bus);
-                sd_bus_unref(*bus);
-        }
-}
-
 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_flush_close_unref);
 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_slot*, sd_bus_slot_unref);
 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref);
 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_creds*, sd_bus_creds_unref);
 DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_track*, sd_bus_track_unref);
 
 #define _cleanup_bus_unref_ _cleanup_(sd_bus_unrefp)
-#define _cleanup_bus_close_unref_ _cleanup_(sd_bus_close_unrefp)
+#define _cleanup_bus_flush_close_unref_ _cleanup_(sd_bus_flush_close_unrefp)
 #define _cleanup_bus_slot_unref_ _cleanup_(sd_bus_slot_unrefp)
 #define _cleanup_bus_message_unref_ _cleanup_(sd_bus_message_unrefp)
 #define _cleanup_bus_creds_unref_ _cleanup_(sd_bus_creds_unrefp)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 538838b..6db4d65 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -617,7 +617,7 @@ static int get_unit_list_recursive(
                         return r;
 
                 STRV_FOREACH(i, machines) {
-                        _cleanup_bus_close_unref_ sd_bus *container = NULL;
+                        _cleanup_bus_flush_close_unref_ sd_bus *container = NULL;
                         int k;
 
                         r = sd_bus_open_system_machine(&container, *i);
@@ -1709,7 +1709,7 @@ static int compare_machine_info(const void *a, const void *b) {
 }
 
 static int get_machine_properties(sd_bus *bus, struct machine_info *mi) {
-        _cleanup_bus_close_unref_ sd_bus *container = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *container = NULL;
         int r;
 
         assert(mi);
@@ -7340,7 +7340,7 @@ static int halt_main(sd_bus *bus) {
 
         if (arg_when > 0) {
                 _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-                _cleanup_bus_close_unref_ sd_bus *b = NULL;
+                _cleanup_bus_flush_close_unref_ sd_bus *b = NULL;
                 _cleanup_free_ char *m = NULL;
 
                 if (avoid_bus()) {
@@ -7449,7 +7449,7 @@ static int runlevel_main(void) {
 }
 
 int main(int argc, char*argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         setlocale(LC_ALL, "");
@@ -7517,7 +7517,7 @@ int main(int argc, char*argv[]) {
 
         case ACTION_CANCEL_SHUTDOWN: {
                 _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-                _cleanup_bus_close_unref_ sd_bus *b = NULL;
+                _cleanup_bus_flush_close_unref_ sd_bus *b = NULL;
                 _cleanup_free_ char *m = NULL;
 
                 if (avoid_bus()) {
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 57e46ce..f348931 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -156,6 +156,7 @@ void sd_bus_close(sd_bus *bus);
 
 sd_bus *sd_bus_ref(sd_bus *bus);
 sd_bus *sd_bus_unref(sd_bus *bus);
+sd_bus *sd_bus_flush_close_unref(sd_bus *bus);
 
 int sd_bus_is_open(sd_bus *bus);
 
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 25c2595..240578b 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -491,7 +491,7 @@ static int timedatectl_main(sd_bus *bus, int argc, char *argv[]) {
 }
 
 int main(int argc, char *argv[]) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         setlocale(LC_ALL, "");
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 4e8ae94..21d6ee4 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -660,7 +660,7 @@ static const sd_bus_vtable timedate_vtable[] = {
 };
 
 static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         assert(c);
@@ -692,7 +692,7 @@ static int connect_bus(Context *c, sd_event *event, sd_bus **_bus) {
 int main(int argc, char *argv[]) {
         Context context = {};
         _cleanup_event_unref_ sd_event *event = NULL;
-        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
         int r;
 
         log_set_target(LOG_TARGET_AUTO);



More information about the systemd-commits mailing list