[systemd-commits] 2 commits - Makefile.am src/bus-driverd units/user

Kay Sievers kay at kemper.freedesktop.org
Tue Jan 7 17:06:59 PST 2014


 Makefile.am                               |   46 ++++++++++++++++++------------
 src/bus-driverd/bus-driverd.c             |    8 +++--
 units/user/.gitignore                     |    2 +
 units/user/systemd-bus-driverd.service.in |   14 +++++++++
 units/user/systemd-bus-proxyd at .service.in |   16 ++++++++++
 5 files changed, 66 insertions(+), 20 deletions(-)

New commits:
commit 54142c6af15c24a72a1b8dcf278dbe97b95e541a
Author: Kay Sievers <kay at vrfy.org>
Date:   Tue Jan 7 20:20:22 2014 +0800

    bus-driverd: support user mode

diff --git a/Makefile.am b/Makefile.am
index 2d299d4..7a15942 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -221,6 +221,8 @@ SYSINIT_TARGET_WANTS =
 SOCKETS_TARGET_WANTS =
 BUSNAMES_TARGET_WANTS =
 TIMERS_TARGET_WANTS =
+USER_SOCKETS_TARGET_WANTS =
+USER_BUSNAMES_TARGET_WANTS =
 
 SYSTEM_UNIT_ALIASES =
 USER_UNIT_ALIASES =
@@ -228,23 +230,25 @@ USER_UNIT_ALIASES =
 GENERAL_ALIASES =
 
 install-target-wants-hook:
-	what="$(RUNLEVEL1_TARGET_WANTS)" && wants=runlevel1.target && $(add-wants)
-	what="$(RUNLEVEL2_TARGET_WANTS)" && wants=runlevel2.target && $(add-wants)
-	what="$(RUNLEVEL3_TARGET_WANTS)" && wants=runlevel3.target && $(add-wants)
-	what="$(RUNLEVEL4_TARGET_WANTS)" && wants=runlevel4.target && $(add-wants)
-	what="$(RUNLEVEL5_TARGET_WANTS)" && wants=runlevel5.target && $(add-wants)
-	what="$(SHUTDOWN_TARGET_WANTS)" && wants=shutdown.target && $(add-wants)
-	what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && $(add-wants)
-	what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && $(add-wants)
-	what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && $(add-wants)
-	what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && $(add-wants)
-	what="$(BUSNAMES_TARGET_WANTS)" && wants=busnames.target && $(add-wants)
-	what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && $(add-wants)
-	what="$(SLICES_TARGET_WANTS)" && wants=slices.target && $(add-wants)
+	what="$(RUNLEVEL1_TARGET_WANTS)" && wants=runlevel1.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(RUNLEVEL2_TARGET_WANTS)" && wants=runlevel2.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(RUNLEVEL3_TARGET_WANTS)" && wants=runlevel3.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(RUNLEVEL4_TARGET_WANTS)" && wants=runlevel4.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(RUNLEVEL5_TARGET_WANTS)" && wants=runlevel5.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(SHUTDOWN_TARGET_WANTS)" && wants=shutdown.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(SLICES_TARGET_WANTS)" && wants=slices.target && dir=$(systemunitdir) && $(add-wants)
+	what="$(USER_SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(userunitdir) && $(add-wants)
+	what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
 
 define add-wants
 	[ -z "$$what" ] || ( \
-	  dir=$(DESTDIR)$(systemunitdir)/$$wants.wants && \
+	  dir=$(DESTDIR)$$dir/$$wants.wants && \
 	  $(MKDIR_P) -m 0755 $$dir && \
 	  cd $$dir && \
 	  rm -f $$what && \
@@ -3752,6 +3756,14 @@ dist_systemunit_DATA += \
 BUSNAMES_TARGET_WANTS += \
 	org.freedesktop.DBus.busname
 
+nodist_userunit_DATA += \
+	units/user/systemd-bus-driverd.service
+
+USER_BUSNAMES_TARGET_WANTS += \
+	org.freedesktop.DBus.busname
+
+USER_UNIT_ALIASES += \
+	$(systemunitdir)/org.freedesktop.DBus.busname org.freedesktop.DBus.busname
 endif
 
 EXTRA_DIST += \
diff --git a/src/bus-driverd/bus-driverd.c b/src/bus-driverd/bus-driverd.c
index 44172c4..172ad68 100644
--- a/src/bus-driverd/bus-driverd.c
+++ b/src/bus-driverd/bus-driverd.c
@@ -51,6 +51,7 @@
 #include "def.h"
 #include "unit-name.h"
 #include "bus-control.h"
+#include "cgroup-util.h"
 
 #define CLIENTS_MAX 1024
 #define MATCHES_MAX 1024
@@ -748,7 +749,11 @@ static int connect_bus(Context *c) {
 
         assert(c);
 
-        r = sd_bus_default_system(&c->bus);
+        r = cg_pid_get_owner_uid(0, NULL);
+        if (r < 0)
+                r = sd_bus_default_system(&c->bus);
+        else
+                r = sd_bus_default_user(&c->bus);
         if (r < 0) {
                 log_error("Failed to create bus: %s", strerror(-r));
                 return r;
@@ -828,5 +833,4 @@ finish:
         sd_event_unref(context.event);
 
         return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
-
 }
diff --git a/units/user/.gitignore b/units/user/.gitignore
index 6aa5475..825102c 100644
--- a/units/user/.gitignore
+++ b/units/user/.gitignore
@@ -1,2 +1,3 @@
 /systemd-exit.service
 /systemd-bus-proxyd at .service
+/systemd-bus-driverd.service
diff --git a/units/user/systemd-bus-driverd.service.in b/units/user/systemd-bus-driverd.service.in
new file mode 100644
index 0000000..575bddc
--- /dev/null
+++ b/units/user/systemd-bus-driverd.service.in
@@ -0,0 +1,14 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Bus Driver Service
+
+[Service]
+ExecStart=@rootlibexecdir@/systemd-bus-driverd
+BusName=org.freedesktop.DBus
+WatchdogSec=1min

commit 7ca7b61f70371493a0539a76108dd84e0f765264
Author: Kay Sievers <kay at vrfy.org>
Date:   Tue Jan 7 07:30:34 2014 +0800

    bus-proxyd: support --user bus address

diff --git a/Makefile.am b/Makefile.am
index aed8c32..2d299d4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1921,10 +1921,8 @@ dist_systemunit_DATA += \
 	units/systemd-bus-proxyd.socket
 
 dist_userunit_DATA += \
-	units/user/systemd-bus-proxyd.socket
-
-USER_UNIT_ALIASES += \
-	$(systemunitdir)/systemd-bus-proxyd at .service systemd-bus-proxyd at .service
+	units/user/systemd-bus-proxyd.socket \
+	units/user/systemd-bus-proxyd at .service
 endif
 
 EXTRA_DIST += \
diff --git a/units/user/.gitignore b/units/user/.gitignore
index 41a74f5..6aa5475 100644
--- a/units/user/.gitignore
+++ b/units/user/.gitignore
@@ -1 +1,2 @@
 /systemd-exit.service
+/systemd-bus-proxyd at .service
diff --git a/units/user/systemd-bus-proxyd at .service.in b/units/user/systemd-bus-proxyd at .service.in
new file mode 100644
index 0000000..5a9f31c
--- /dev/null
+++ b/units/user/systemd-bus-proxyd at .service.in
@@ -0,0 +1,16 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Legacy D-Bus Protocol Compatibility Daemon
+
+[Service]
+# The first argument will be replaced by the service by information on
+# the process requesting the proxy, we need a placeholder to keep the
+# space available for this.
+ExecStart=@rootlibexecdir@/systemd-bus-proxyd --address=kernel:path=/dev/kdbus/%U-user/bus xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+NotifyAccess=main



More information about the systemd-commits mailing list