mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
bus-driverd: support user mode
This commit is contained in:
parent
7ca7b61f70
commit
54142c6af1
40
Makefile.am
40
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 += \
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
1
units/user/.gitignore
vendored
1
units/user/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
/systemd-exit.service
|
||||
/systemd-bus-proxyd@.service
|
||||
/systemd-bus-driverd.service
|
||||
|
14
units/user/systemd-bus-driverd.service.in
Normal file
14
units/user/systemd-bus-driverd.service.in
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user