]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Drop busname unit type
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 23 Jul 2017 13:24:39 +0000 (09:24 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 23 Jul 2017 13:29:02 +0000 (09:29 -0400)
Since busname units are only useful with kdbus, they weren't actively
used. This was dead code, only compile-tested. If busname units are
ever added back, it'll be cleaner to start from scratch (possibly reverting
parts of this patch).

28 files changed:
man/sd_bus_negotiate_fds.xml
shell-completion/zsh/_sd_unit_files
src/basic/special.h
src/basic/unit-name.c
src/basic/unit-name.h
src/core/busname.c [deleted file]
src/core/busname.h [deleted file]
src/core/dbus-busname.c [deleted file]
src/core/dbus-busname.h [deleted file]
src/core/load-fragment-gperf.gperf.m4
src/core/load-fragment.c
src/core/load-fragment.h
src/core/meson.build
src/core/unit.c
src/core/unit.h
src/systemctl/systemctl.c
src/test/test-tables.c
units/org.freedesktop.hostname1.busname [deleted file]
units/org.freedesktop.import1.busname [deleted file]
units/org.freedesktop.locale1.busname [deleted file]
units/org.freedesktop.login1.busname [deleted file]
units/org.freedesktop.machine1.busname [deleted file]
units/org.freedesktop.network1.busname [deleted file]
units/org.freedesktop.resolve1.busname [deleted file]
units/org.freedesktop.systemd1.busname [deleted file]
units/org.freedesktop.timedate1.busname [deleted file]
units/systemd-networkd.service.m4.in
units/systemd-resolved.service.m4.in

index 1501e1427d81b071bfc402f3e396c9798dd42a05..e91269ba3117c25cee085267d11b89652454d46e 100644 (file)
     default, file descriptor passing is negotiated for all
     connections.</para>
 
-    <para>Note that when bus activation is used, it is highly
-    recommended to set the <option>AcceptFileDescriptors=</option>
-    setting in the <filename>.busname</filename> unit file to the same
-    setting as negotiated by the program ultimately activated. By
-    default, file descriptor passing is enabled for both.</para>
-
     <para><function>sd_bus_negotiate_timestamp()</function> controls whether implicit sender
     timestamps shall be attached automatically to all incoming messages. Takes a bus object and a
     boolean, which, when true, enables timestamping, and, when false, disables it.  Use
       <citerefentry><refentrytitle>sd_bus_message_get_monotonic_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
       <citerefentry><refentrytitle>sd_bus_message_get_realtime_usec</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
       <citerefentry><refentrytitle>sd_bus_message_get_seqnum</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
-      <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
-      <citerefentry><refentrytitle>systemd.busname</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+      <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>
     </para>
   </refsect1>
 
index 3e7a4ee803db5ccddedcaea7d67e95f01d84f837..5e90ea23c52b0c9b386fc7d99bde6d9b8cc63764 100644 (file)
@@ -5,5 +5,5 @@ _sd_unit_files() {
     files=( '*:files:->files' )
 
     _description files expl 'unit file'
-    _files "$expl[@]" -g '*.(automount|busname|device|mount|path|service|socket|swap|target|timer)'
+    _files "$expl[@]" -g '*.(automount|device|mount|path|service|socket|swap|target|timer)'
 }
index feb8e5fe21eddfa09347cdf6c43ebeb69b20dc23..ddd4e840194c20c466d4fb44f3f8c511501ef3d6 100644 (file)
@@ -46,7 +46,6 @@
 /* Early boot targets */
 #define SPECIAL_SYSINIT_TARGET "sysinit.target"
 #define SPECIAL_SOCKETS_TARGET "sockets.target"
-#define SPECIAL_BUSNAMES_TARGET "busnames.target"
 #define SPECIAL_TIMERS_TARGET "timers.target"
 #define SPECIAL_PATHS_TARGET "paths.target"
 #define SPECIAL_LOCAL_FS_TARGET "local-fs.target"
index 920ca0d9f511fb8cc3c1aad4a23fce66e816cb14..08db164aa9893bfb7ed6ae073f2ad0e424ffb8d6 100644 (file)
@@ -608,7 +608,6 @@ const char* unit_dbus_interface_from_type(UnitType t) {
         static const char *const table[_UNIT_TYPE_MAX] = {
                 [UNIT_SERVICE] = "org.freedesktop.systemd1.Service",
                 [UNIT_SOCKET] = "org.freedesktop.systemd1.Socket",
-                [UNIT_BUSNAME] = "org.freedesktop.systemd1.BusName",
                 [UNIT_TARGET] = "org.freedesktop.systemd1.Target",
                 [UNIT_DEVICE] = "org.freedesktop.systemd1.Device",
                 [UNIT_MOUNT] = "org.freedesktop.systemd1.Mount",
@@ -839,7 +838,6 @@ bool slice_name_is_valid(const char *name) {
 static const char* const unit_type_table[_UNIT_TYPE_MAX] = {
         [UNIT_SERVICE] = "service",
         [UNIT_SOCKET] = "socket",
-        [UNIT_BUSNAME] = "busname",
         [UNIT_TARGET] = "target",
         [UNIT_DEVICE] = "device",
         [UNIT_MOUNT] = "mount",
@@ -884,19 +882,6 @@ static const char* const automount_state_table[_AUTOMOUNT_STATE_MAX] = {
 
 DEFINE_STRING_TABLE_LOOKUP(automount_state, AutomountState);
 
-static const char* const busname_state_table[_BUSNAME_STATE_MAX] = {
-        [BUSNAME_DEAD] = "dead",
-        [BUSNAME_MAKING] = "making",
-        [BUSNAME_REGISTERED] = "registered",
-        [BUSNAME_LISTENING] = "listening",
-        [BUSNAME_RUNNING] = "running",
-        [BUSNAME_SIGTERM] = "sigterm",
-        [BUSNAME_SIGKILL] = "sigkill",
-        [BUSNAME_FAILED] = "failed",
-};
-
-DEFINE_STRING_TABLE_LOOKUP(busname_state, BusNameState);
-
 static const char* const device_state_table[_DEVICE_STATE_MAX] = {
         [DEVICE_DEAD] = "dead",
         [DEVICE_TENTATIVE] = "tentative",
index 0f164a6aa96f11f4e1b731f9789f4479fb37530e..f40fff3fe18c884646c92bc8a2303bee1fd6dd41 100644 (file)
@@ -28,7 +28,6 @@
 typedef enum UnitType {
         UNIT_SERVICE = 0,
         UNIT_SOCKET,
-        UNIT_BUSNAME,
         UNIT_TARGET,
         UNIT_DEVICE,
         UNIT_MOUNT,
@@ -73,19 +72,6 @@ typedef enum AutomountState {
         _AUTOMOUNT_STATE_INVALID = -1
 } AutomountState;
 
-typedef enum BusNameState {
-        BUSNAME_DEAD,
-        BUSNAME_MAKING,
-        BUSNAME_REGISTERED,
-        BUSNAME_LISTENING,
-        BUSNAME_RUNNING,
-        BUSNAME_SIGTERM,
-        BUSNAME_SIGKILL,
-        BUSNAME_FAILED,
-        _BUSNAME_STATE_MAX,
-        _BUSNAME_STATE_INVALID = -1
-} BusNameState;
-
 /* We simply watch devices, we cannot plug/unplug them. That
  * simplifies the state engine greatly */
 typedef enum DeviceState {
@@ -339,9 +325,6 @@ UnitActiveState unit_active_state_from_string(const char *s) _pure_;
 const char* automount_state_to_string(AutomountState i) _const_;
 AutomountState automount_state_from_string(const char *s) _pure_;
 
-const char* busname_state_to_string(BusNameState i) _const_;
-BusNameState busname_state_from_string(const char *s) _pure_;
-
 const char* device_state_to_string(DeviceState i) _const_;
 DeviceState device_state_from_string(const char *s) _pure_;
 
diff --git a/src/core/busname.c b/src/core/busname.c
deleted file mode 100644 (file)
index 955f6f8..0000000
+++ /dev/null
@@ -1,1081 +0,0 @@
-/***
-  This file is part of systemd.
-
-  Copyright 2013 Lennart Poettering
-
-  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.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <sys/mman.h>
-
-#include "alloc-util.h"
-#include "bus-internal.h"
-#include "bus-kernel.h"
-#include "bus-policy.h"
-#include "bus-util.h"
-#include "busname.h"
-#include "dbus-busname.h"
-#include "fd-util.h"
-#include "format-util.h"
-#include "kdbus.h"
-#include "parse-util.h"
-#include "process-util.h"
-#include "service.h"
-#include "signal-util.h"
-#include "special.h"
-#include "string-table.h"
-#include "string-util.h"
-
-static const UnitActiveState state_translation_table[_BUSNAME_STATE_MAX] = {
-        [BUSNAME_DEAD] = UNIT_INACTIVE,
-        [BUSNAME_MAKING] = UNIT_ACTIVATING,
-        [BUSNAME_REGISTERED] = UNIT_ACTIVE,
-        [BUSNAME_LISTENING] = UNIT_ACTIVE,
-        [BUSNAME_RUNNING] = UNIT_ACTIVE,
-        [BUSNAME_SIGTERM] = UNIT_DEACTIVATING,
-        [BUSNAME_SIGKILL] = UNIT_DEACTIVATING,
-        [BUSNAME_FAILED] = UNIT_FAILED
-};
-
-static int busname_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata);
-static int busname_dispatch_timer(sd_event_source *source, usec_t usec, void *userdata);
-
-static void busname_init(Unit *u) {
-        BusName *n = BUSNAME(u);
-
-        assert(u);
-        assert(u->load_state == UNIT_STUB);
-
-        n->starter_fd = -1;
-        n->accept_fd = true;
-        n->activating = true;
-
-        n->timeout_usec = u->manager->default_timeout_start_usec;
-}
-
-static void busname_unwatch_control_pid(BusName *n) {
-        assert(n);
-
-        if (n->control_pid <= 0)
-                return;
-
-        unit_unwatch_pid(UNIT(n), n->control_pid);
-        n->control_pid = 0;
-}
-
-static void busname_free_policy(BusName *n) {
-        BusNamePolicy *p;
-
-        assert(n);
-
-        while ((p = n->policy)) {
-                LIST_REMOVE(policy, n->policy, p);
-
-                free(p->name);
-                free(p);
-        }
-}
-
-static void busname_close_fd(BusName *n) {
-        assert(n);
-
-        n->starter_event_source = sd_event_source_unref(n->starter_event_source);
-        n->starter_fd = safe_close(n->starter_fd);
-}
-
-static void busname_done(Unit *u) {
-        BusName *n = BUSNAME(u);
-
-        assert(n);
-
-        n->name = mfree(n->name);
-
-        busname_free_policy(n);
-        busname_unwatch_control_pid(n);
-        busname_close_fd(n);
-
-        unit_ref_unset(&n->service);
-
-        n->timer_event_source = sd_event_source_unref(n->timer_event_source);
-}
-
-static int busname_arm_timer(BusName *n, usec_t usec) {
-        int r;
-
-        assert(n);
-
-        if (n->timer_event_source) {
-                r = sd_event_source_set_time(n->timer_event_source, usec);
-                if (r < 0)
-                        return r;
-
-                return sd_event_source_set_enabled(n->timer_event_source, SD_EVENT_ONESHOT);
-        }
-
-        if (usec == USEC_INFINITY)
-                return 0;
-
-        r = sd_event_add_time(
-                        UNIT(n)->manager->event,
-                        &n->timer_event_source,
-                        CLOCK_MONOTONIC,
-                        usec, 0,
-                        busname_dispatch_timer, n);
-        if (r < 0)
-                return r;
-
-        (void) sd_event_source_set_description(n->timer_event_source, "busname-timer");
-
-        return 0;
-}
-
-static int busname_add_default_default_dependencies(BusName *n) {
-        int r;
-
-        assert(n);
-
-        r = unit_add_dependency_by_name(UNIT(n), UNIT_BEFORE, SPECIAL_BUSNAMES_TARGET, NULL, true);
-        if (r < 0)
-                return r;
-
-        if (MANAGER_IS_SYSTEM(UNIT(n)->manager)) {
-                r = unit_add_two_dependencies_by_name(UNIT(n), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SYSINIT_TARGET, NULL, true);
-                if (r < 0)
-                        return r;
-        }
-
-        return unit_add_two_dependencies_by_name(UNIT(n), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
-}
-
-static int busname_add_extras(BusName *n) {
-        Unit *u = UNIT(n);
-        int r;
-
-        assert(n);
-
-        if (!n->name) {
-                r = unit_name_to_prefix(u->id, &n->name);
-                if (r < 0)
-                        return r;
-        }
-
-        if (!u->description) {
-                r = unit_set_description(u, n->name);
-                if (r < 0)
-                        return r;
-        }
-
-        if (n->activating) {
-                if (!UNIT_DEREF(n->service)) {
-                        Unit *x;
-
-                        r = unit_load_related_unit(u, ".service", &x);
-                        if (r < 0)
-                                return r;
-
-                        unit_ref_set(&n->service, x);
-                }
-
-                r = unit_add_two_dependencies(u, UNIT_BEFORE, UNIT_TRIGGERS, UNIT_DEREF(n->service), true);
-                if (r < 0)
-                        return r;
-        }
-
-        if (u->default_dependencies) {
-                r = busname_add_default_default_dependencies(n);
-                if (r < 0)
-                        return r;
-        }
-
-        return 0;
-}
-
-static int busname_verify(BusName *n) {
-        char *e;
-
-        assert(n);
-
-        if (UNIT(n)->load_state != UNIT_LOADED)
-                return 0;
-
-        if (!service_name_is_valid(n->name)) {
-                log_unit_error(UNIT(n), "Name= setting is not a valid service name Refusing.");
-                return -EINVAL;
-        }
-
-        e = strjoina(n->name, ".busname");
-        if (!unit_has_name(UNIT(n), e)) {
-                log_unit_error(UNIT(n), "Name= setting doesn't match unit name. Refusing.");
-                return -EINVAL;
-        }
-
-        return 0;
-}
-
-static int busname_load(Unit *u) {
-        BusName *n = BUSNAME(u);
-        int r;
-
-        assert(u);
-        assert(u->load_state == UNIT_STUB);
-
-        r = unit_load_fragment_and_dropin(u);
-        if (r < 0)
-                return r;
-
-        if (u->load_state == UNIT_LOADED) {
-                /* This is a new unit? Then let's add in some extras */
-                r = busname_add_extras(n);
-                if (r < 0)
-                        return r;
-        }
-
-        return busname_verify(n);
-}
-
-static void busname_dump(Unit *u, FILE *f, const char *prefix) {
-        BusName *n = BUSNAME(u);
-
-        assert(n);
-        assert(f);
-
-        fprintf(f,
-                "%sBus Name State: %s\n"
-                "%sResult: %s\n"
-                "%sName: %s\n"
-                "%sActivating: %s\n"
-                "%sAccept FD: %s\n",
-                prefix, busname_state_to_string(n->state),
-                prefix, busname_result_to_string(n->result),
-                prefix, n->name,
-                prefix, yes_no(n->activating),
-                prefix, yes_no(n->accept_fd));
-
-        if (n->control_pid > 0)
-                fprintf(f,
-                        "%sControl PID: "PID_FMT"\n",
-                        prefix, n->control_pid);
-}
-
-static void busname_unwatch_fd(BusName *n) {
-        int r;
-
-        assert(n);
-
-        if (!n->starter_event_source)
-                return;
-
-        r = sd_event_source_set_enabled(n->starter_event_source, SD_EVENT_OFF);
-        if (r < 0)
-                log_unit_debug_errno(UNIT(n), r, "Failed to disable event source: %m");
-}
-
-static int busname_watch_fd(BusName *n) {
-        int r;
-
-        assert(n);
-
-        if (n->starter_fd < 0)
-                return 0;
-
-        if (n->starter_event_source) {
-                r = sd_event_source_set_enabled(n->starter_event_source, SD_EVENT_ON);
-                if (r < 0)
-                        goto fail;
-        } else {
-                r = sd_event_add_io(UNIT(n)->manager->event, &n->starter_event_source, n->starter_fd, EPOLLIN, busname_dispatch_io, n);
-                if (r < 0)
-                        goto fail;
-
-                (void) sd_event_source_set_description(n->starter_event_source, "busname-starter");
-        }
-
-        return 0;
-
-fail:
-        log_unit_warning_errno(UNIT(n), r, "Failed to watch starter fd: %m");
-        busname_unwatch_fd(n);
-        return r;
-}
-
-static int busname_open_fd(BusName *n) {
-        _cleanup_free_ char *path = NULL;
-        const char *mode;
-
-        assert(n);
-
-        if (n->starter_fd >= 0)
-                return 0;
-
-        mode = MANAGER_IS_SYSTEM(UNIT(n)->manager) ? "system" : "user";
-        n->starter_fd = bus_kernel_open_bus_fd(mode, &path);
-        if (n->starter_fd < 0)
-                return log_unit_warning_errno(UNIT(n), n->starter_fd, "Failed to open %s: %m", path ?: "kdbus");
-
-        return 0;
-}
-
-static void busname_set_state(BusName *n, BusNameState state) {
-        BusNameState old_state;
-        assert(n);
-
-        old_state = n->state;
-        n->state = state;
-
-        if (!IN_SET(state, BUSNAME_MAKING, BUSNAME_SIGTERM, BUSNAME_SIGKILL)) {
-                n->timer_event_source = sd_event_source_unref(n->timer_event_source);
-                busname_unwatch_control_pid(n);
-        }
-
-        if (state != BUSNAME_LISTENING)
-                busname_unwatch_fd(n);
-
-        if (!IN_SET(state, BUSNAME_LISTENING, BUSNAME_MAKING, BUSNAME_REGISTERED, BUSNAME_RUNNING))
-                busname_close_fd(n);
-
-        if (state != old_state)
-                log_unit_debug(UNIT(n), "Changed %s -> %s", busname_state_to_string(old_state), busname_state_to_string(state));
-
-        unit_notify(UNIT(n), state_translation_table[old_state], state_translation_table[state], true);
-}
-
-static int busname_coldplug(Unit *u) {
-        BusName *n = BUSNAME(u);
-        int r;
-
-        assert(n);
-        assert(n->state == BUSNAME_DEAD);
-
-        if (n->deserialized_state == n->state)
-                return 0;
-
-        if (n->control_pid > 0 &&
-            pid_is_unwaited(n->control_pid) &&
-            IN_SET(n->deserialized_state, BUSNAME_MAKING, BUSNAME_SIGTERM, BUSNAME_SIGKILL)) {
-
-                r = unit_watch_pid(UNIT(n), n->control_pid);
-                if (r < 0)
-                        return r;
-
-                r = busname_arm_timer(n, usec_add(u->state_change_timestamp.monotonic, n->timeout_usec));
-                if (r < 0)
-                        return r;
-        }
-
-        if (IN_SET(n->deserialized_state, BUSNAME_MAKING, BUSNAME_LISTENING, BUSNAME_REGISTERED, BUSNAME_RUNNING)) {
-                r = busname_open_fd(n);
-                if (r < 0)
-                        return r;
-        }
-
-        if (n->deserialized_state == BUSNAME_LISTENING) {
-                r = busname_watch_fd(n);
-                if (r < 0)
-                        return r;
-        }
-
-        busname_set_state(n, n->deserialized_state);
-        return 0;
-}
-
-static int busname_make_starter(BusName *n, pid_t *_pid) {
-        pid_t pid;
-        int r;
-
-        r = busname_arm_timer(n, usec_add(now(CLOCK_MONOTONIC), n->timeout_usec));
-        if (r < 0)
-                goto fail;
-
-        /* We have to resolve the user/group names out-of-process,
-         * hence let's fork here. It's messy, but well, what can we
-         * do? */
-
-        pid = fork();
-        if (pid < 0)
-                return -errno;
-
-        if (pid == 0) {
-                int ret;
-
-                (void) default_signals(SIGNALS_CRASH_HANDLER, SIGNALS_IGNORE, -1);
-                (void) ignore_signals(SIGPIPE, -1);
-                log_forget_fds();
-
-                r = bus_kernel_make_starter(n->starter_fd, n->name, n->activating, n->accept_fd, n->policy, n->policy_world);
-                if (r < 0) {
-                        ret = EXIT_MAKE_STARTER;
-                        goto fail_child;
-                }
-
-                _exit(0);
-
-        fail_child:
-                log_open();
-                log_error_errno(r, "Failed to create starter connection at step %s: %m", exit_status_to_string(ret, EXIT_STATUS_SYSTEMD));
-
-                _exit(ret);
-        }
-
-        r = unit_watch_pid(UNIT(n), pid);
-        if (r < 0)
-                goto fail;
-
-        *_pid = pid;
-        return 0;
-
-fail:
-        n->timer_event_source = sd_event_source_unref(n->timer_event_source);
-        return r;
-}
-
-static void busname_enter_dead(BusName *n, BusNameResult f) {
-        assert(n);
-
-        if (n->result == BUSNAME_SUCCESS)
-                n->result = f;
-
-        busname_set_state(n, n->result != BUSNAME_SUCCESS ? BUSNAME_FAILED : BUSNAME_DEAD);
-}
-
-static void busname_enter_signal(BusName *n, BusNameState state, BusNameResult f) {
-        KillContext kill_context = {};
-        int r;
-
-        assert(n);
-
-        if (n->result == BUSNAME_SUCCESS)
-                n->result = f;
-
-        kill_context_init(&kill_context);
-
-        r = unit_kill_context(UNIT(n),
-                              &kill_context,
-                              state != BUSNAME_SIGTERM ? KILL_KILL : KILL_TERMINATE,
-                              -1,
-                              n->control_pid,
-                              false);
-        if (r < 0) {
-                log_unit_warning_errno(UNIT(n), r, "Failed to kill control process: %m");
-                goto fail;
-        }
-
-        if (r > 0) {
-                r = busname_arm_timer(n, usec_add(now(CLOCK_MONOTONIC), n->timeout_usec));
-                if (r < 0) {
-                        log_unit_warning_errno(UNIT(n), r, "Failed to arm timer: %m");
-                        goto fail;
-                }
-
-                busname_set_state(n, state);
-        } else if (state == BUSNAME_SIGTERM)
-                busname_enter_signal(n, BUSNAME_SIGKILL, BUSNAME_SUCCESS);
-        else
-                busname_enter_dead(n, BUSNAME_SUCCESS);
-
-        return;
-
-fail:
-        busname_enter_dead(n, BUSNAME_FAILURE_RESOURCES);
-}
-
-static void busname_enter_listening(BusName *n) {
-        int r;
-
-        assert(n);
-
-        if (n->activating) {
-                r = busname_watch_fd(n);
-                if (r < 0) {
-                        log_unit_warning_errno(UNIT(n), r, "Failed to watch names: %m");
-                        goto fail;
-                }
-
-                busname_set_state(n, BUSNAME_LISTENING);
-        } else
-                busname_set_state(n, BUSNAME_REGISTERED);
-
-        return;
-
-fail:
-        busname_enter_signal(n, BUSNAME_SIGTERM, BUSNAME_FAILURE_RESOURCES);
-}
-
-static void busname_enter_making(BusName *n) {
-        int r;
-
-        assert(n);
-
-        r = busname_open_fd(n);
-        if (r < 0)
-                goto fail;
-
-        if (n->policy) {
-                /* If there is a policy, we need to resolve user/group
-                 * names, which we can't do from PID1, hence let's
-                 * fork. */
-                busname_unwatch_control_pid(n);
-
-                r = busname_make_starter(n, &n->control_pid);
-                if (r < 0) {
-                        log_unit_warning_errno(UNIT(n), r, "Failed to fork 'making' task: %m");
-                        goto fail;
-                }
-
-                busname_set_state(n, BUSNAME_MAKING);
-        } else {
-                /* If there is no policy, we can do everything
-                 * directly from PID 1, hence do so. */
-
-                r = bus_kernel_make_starter(n->starter_fd, n->name, n->activating, n->accept_fd, NULL, n->policy_world);
-                if (r < 0) {
-                        log_unit_warning_errno(UNIT(n), r, "Failed to make starter: %m");
-                        goto fail;
-                }
-
-                busname_enter_listening(n);
-        }
-
-        return;
-
-fail:
-        busname_enter_dead(n, BUSNAME_FAILURE_RESOURCES);
-}
-
-static void busname_enter_running(BusName *n) {
-        _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
-        bool pending = false;
-        Unit *other;
-        Iterator i;
-        int r;
-
-        assert(n);
-
-        if (!n->activating)
-                return;
-
-        /* We don't take connections anymore if we are supposed to
-         * shut down anyway */
-
-        if (unit_stop_pending(UNIT(n))) {
-                log_unit_debug(UNIT(n), "Suppressing activation request since unit stop is scheduled.");
-
-                /* Flush all queued activation reqeuest by closing and reopening the connection */
-                bus_kernel_drop_one(n->starter_fd);
-
-                busname_enter_listening(n);
-                return;
-        }
-
-        /* If there's already a start pending don't bother to do
-         * anything */
-        SET_FOREACH(other, UNIT(n)->dependencies[UNIT_TRIGGERS], i)
-                if (unit_active_or_pending(other)) {
-                        pending = true;
-                        break;
-                }
-
-        if (!pending) {
-                if (!UNIT_ISSET(n->service)) {
-                        log_unit_error(UNIT(n), "Service to activate vanished, refusing activation.");
-                        r = -ENOENT;
-                        goto fail;
-                }
-
-                r = manager_add_job(UNIT(n)->manager, JOB_START, UNIT_DEREF(n->service), JOB_REPLACE, &error, NULL);
-                if (r < 0)
-                        goto fail;
-        }
-
-        busname_set_state(n, BUSNAME_RUNNING);
-        return;
-
-fail:
-        log_unit_warning(UNIT(n), "Failed to queue service startup job: %s", bus_error_message(&error, r));
-        busname_enter_dead(n, BUSNAME_FAILURE_RESOURCES);
-}
-
-static int busname_start(Unit *u) {
-        BusName *n = BUSNAME(u);
-        int r;
-
-        assert(n);
-
-        /* We cannot fulfill this request right now, try again later
-         * please! */
-        if (IN_SET(n->state, BUSNAME_SIGTERM, BUSNAME_SIGKILL))
-                return -EAGAIN;
-
-        /* Already on it! */
-        if (n->state == BUSNAME_MAKING)
-                return 0;
-
-        if (n->activating && UNIT_ISSET(n->service)) {
-                Service *service;
-
-                service = SERVICE(UNIT_DEREF(n->service));
-
-                if (UNIT(service)->load_state != UNIT_LOADED) {
-                        log_unit_error(u, "Bus service %s not loaded, refusing.", UNIT(service)->id);
-                        return -ENOENT;
-                }
-        }
-
-        assert(IN_SET(n->state, BUSNAME_DEAD, BUSNAME_FAILED));
-
-        r = unit_start_limit_test(u);
-        if (r < 0) {
-                busname_enter_dead(n, BUSNAME_FAILURE_START_LIMIT_HIT);
-                return r;
-        }
-
-        r = unit_acquire_invocation_id(u);
-        if (r < 0)
-                return r;
-
-        n->result = BUSNAME_SUCCESS;
-        busname_enter_making(n);
-
-        return 1;
-}
-
-static int busname_stop(Unit *u) {
-        BusName *n = BUSNAME(u);
-
-        assert(n);
-
-        /* Already on it */
-        if (IN_SET(n->state, BUSNAME_SIGTERM, BUSNAME_SIGKILL))
-                return 0;
-
-        /* If there's already something running, we go directly into
-         * kill mode. */
-
-        if (n->state == BUSNAME_MAKING) {
-                busname_enter_signal(n, BUSNAME_SIGTERM, BUSNAME_SUCCESS);
-                return -EAGAIN;
-        }
-
-        assert(IN_SET(n->state, BUSNAME_REGISTERED, BUSNAME_LISTENING, BUSNAME_RUNNING));
-
-        busname_enter_dead(n, BUSNAME_SUCCESS);
-        return 1;
-}
-
-static int busname_serialize(Unit *u, FILE *f, FDSet *fds) {
-        BusName *n = BUSNAME(u);
-        int r;
-
-        assert(n);
-        assert(f);
-        assert(fds);
-
-        unit_serialize_item(u, f, "state", busname_state_to_string(n->state));
-        unit_serialize_item(u, f, "result", busname_result_to_string(n->result));
-
-        if (n->control_pid > 0)
-                unit_serialize_item_format(u, f, "control-pid", PID_FMT, n->control_pid);
-
-        r = unit_serialize_item_fd(u, f, fds, "starter-fd", n->starter_fd);
-        if (r < 0)
-                return r;
-
-        return 0;
-}
-
-static int busname_deserialize_item(Unit *u, const char *key, const char *value, FDSet *fds) {
-        BusName *n = BUSNAME(u);
-
-        assert(n);
-        assert(key);
-        assert(value);
-
-        if (streq(key, "state")) {
-                BusNameState state;
-
-                state = busname_state_from_string(value);
-                if (state < 0)
-                        log_unit_debug(u, "Failed to parse state value: %s", value);
-                else
-                        n->deserialized_state = state;
-
-        } else if (streq(key, "result")) {
-                BusNameResult f;
-
-                f = busname_result_from_string(value);
-                if (f < 0)
-                        log_unit_debug(u, "Failed to parse result value: %s", value);
-                else if (f != BUSNAME_SUCCESS)
-                        n->result = f;
-
-        } else if (streq(key, "control-pid")) {
-                pid_t pid;
-
-                if (parse_pid(value, &pid) < 0)
-                        log_unit_debug(u, "Failed to parse control-pid value: %s", value);
-                else
-                        n->control_pid = pid;
-        } else if (streq(key, "starter-fd")) {
-                int fd;
-
-                if (safe_atoi(value, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
-                        log_unit_debug(u, "Failed to parse starter fd value: %s", value);
-                else {
-                        safe_close(n->starter_fd);
-                        n->starter_fd = fdset_remove(fds, fd);
-                }
-        } else
-                log_unit_debug(u, "Unknown serialization key: %s", key);
-
-        return 0;
-}
-
-_pure_ static UnitActiveState busname_active_state(Unit *u) {
-        assert(u);
-
-        return state_translation_table[BUSNAME(u)->state];
-}
-
-_pure_ static const char *busname_sub_state_to_string(Unit *u) {
-        assert(u);
-
-        return busname_state_to_string(BUSNAME(u)->state);
-}
-
-static int busname_peek_message(BusName *n) {
-        struct kdbus_cmd_recv cmd_recv = {
-                .size = sizeof(cmd_recv),
-                .flags = KDBUS_RECV_PEEK,
-        };
-        struct kdbus_cmd_free cmd_free = {
-                .size = sizeof(cmd_free),
-        };
-        const char *comm = NULL;
-        struct kdbus_item *d;
-        struct kdbus_msg *k;
-        size_t start, ps, sz, delta;
-        void *p = MAP_FAILED;
-        pid_t pid = 0;
-        int r;
-
-        /* Generate a friendly debug log message about which process
-         * caused triggering of this bus name. This simply peeks the
-         * metadata of the first queued message and logs it. */
-
-        assert(n);
-
-        /* Let's shortcut things a bit, if debug logging is turned off
-         * anyway. */
-
-        if (log_get_max_level() < LOG_DEBUG)
-                return 0;
-
-        r = ioctl(n->starter_fd, KDBUS_CMD_RECV, &cmd_recv);
-        if (r < 0) {
-                if (errno == EINTR || errno == EAGAIN)
-                        return 0;
-
-                return log_unit_error_errno(UNIT(n), errno, "Failed to query activation message: %m");
-        }
-
-        /* We map as late as possible, and unmap imemdiately after
-         * use. On 32bit address space is scarce and we want to be
-         * able to handle a lot of activator connections at the same
-         * time, and hence shouldn't keep the mmap()s around for
-         * longer than necessary. */
-
-        ps = page_size();
-        start = (cmd_recv.msg.offset / ps) * ps;
-        delta = cmd_recv.msg.offset - start;
-        sz = PAGE_ALIGN(delta + cmd_recv.msg.msg_size);
-
-        p = mmap(NULL, sz, PROT_READ, MAP_SHARED, n->starter_fd, start);
-        if (p == MAP_FAILED) {
-                r = log_unit_error_errno(UNIT(n), errno, "Failed to map activation message: %m");
-                goto finish;
-        }
-
-        k = (struct kdbus_msg *) ((uint8_t *) p + delta);
-        KDBUS_ITEM_FOREACH(d, k, items) {
-                switch (d->type) {
-
-                case KDBUS_ITEM_PIDS:
-                        pid = d->pids.pid;
-                        break;
-
-                case KDBUS_ITEM_PID_COMM:
-                        comm = d->str;
-                        break;
-                }
-        }
-
-        if (pid > 0)
-                log_unit_debug(UNIT(n), "Activation triggered by process " PID_FMT " (%s)", pid, strna(comm));
-
-        r = 0;
-
-finish:
-        if (p != MAP_FAILED)
-                (void) munmap(p, sz);
-
-        cmd_free.offset = cmd_recv.msg.offset;
-        if (ioctl(n->starter_fd, KDBUS_CMD_FREE, &cmd_free) < 0)
-                log_unit_warning(UNIT(n), "Failed to free peeked message, ignoring: %m");
-
-        return r;
-}
-
-static int busname_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
-        BusName *n = userdata;
-
-        assert(n);
-        assert(fd >= 0);
-
-        if (n->state != BUSNAME_LISTENING)
-                return 0;
-
-        log_unit_debug(UNIT(n), "Activation request");
-
-        if (revents != EPOLLIN) {
-                log_unit_error(UNIT(n), "Got unexpected poll event (0x%x) on starter fd.", revents);
-                goto fail;
-        }
-
-        busname_peek_message(n);
-        busname_enter_running(n);
-        return 0;
-fail:
-
-        busname_enter_dead(n, BUSNAME_FAILURE_RESOURCES);
-        return 0;
-}
-
-static void busname_sigchld_event(Unit *u, pid_t pid, int code, int status) {
-        BusName *n = BUSNAME(u);
-        BusNameResult f;
-
-        assert(n);
-        assert(pid >= 0);
-
-        if (pid != n->control_pid)
-                return;
-
-        n->control_pid = 0;
-
-        if (is_clean_exit(code, status, EXIT_CLEAN_COMMAND, NULL))
-                f = BUSNAME_SUCCESS;
-        else if (code == CLD_EXITED)
-                f = BUSNAME_FAILURE_EXIT_CODE;
-        else if (code == CLD_KILLED)
-                f = BUSNAME_FAILURE_SIGNAL;
-        else if (code == CLD_DUMPED)
-                f = BUSNAME_FAILURE_CORE_DUMP;
-        else
-                assert_not_reached("Unknown sigchld code");
-
-        log_unit_full(u, f == BUSNAME_SUCCESS ? LOG_DEBUG : LOG_NOTICE, 0,
-                      "Control process exited, code=%s status=%i", sigchld_code_to_string(code), status);
-
-        if (n->result == BUSNAME_SUCCESS)
-                n->result = f;
-
-        switch (n->state) {
-
-        case BUSNAME_MAKING:
-                if (f == BUSNAME_SUCCESS)
-                        busname_enter_listening(n);
-                else
-                        busname_enter_signal(n, BUSNAME_SIGTERM, f);
-                break;
-
-        case BUSNAME_SIGTERM:
-        case BUSNAME_SIGKILL:
-                busname_enter_dead(n, f);
-                break;
-
-        default:
-                assert_not_reached("Uh, control process died at wrong time.");
-        }
-
-        /* Notify clients about changed exit status */
-        unit_add_to_dbus_queue(u);
-}
-
-static int busname_dispatch_timer(sd_event_source *source, usec_t usec, void *userdata) {
-        BusName *n = BUSNAME(userdata);
-
-        assert(n);
-        assert(n->timer_event_source == source);
-
-        switch (n->state) {
-
-        case BUSNAME_MAKING:
-                log_unit_warning(UNIT(n), "Making timed out. Terminating.");
-                busname_enter_signal(n, BUSNAME_SIGTERM, BUSNAME_FAILURE_TIMEOUT);
-                break;
-
-        case BUSNAME_SIGTERM:
-                log_unit_warning(UNIT(n), "Stopping timed out. Killing.");
-                busname_enter_signal(n, BUSNAME_SIGKILL, BUSNAME_FAILURE_TIMEOUT);
-                break;
-
-        case BUSNAME_SIGKILL:
-                log_unit_warning(UNIT(n), "Processes still around after SIGKILL. Ignoring.");
-                busname_enter_dead(n, BUSNAME_FAILURE_TIMEOUT);
-                break;
-
-        default:
-                assert_not_reached("Timeout at wrong time.");
-        }
-
-        return 0;
-}
-
-static void busname_reset_failed(Unit *u) {
-        BusName *n = BUSNAME(u);
-
-        assert(n);
-
-        if (n->state == BUSNAME_FAILED)
-                busname_set_state(n, BUSNAME_DEAD);
-
-        n->result = BUSNAME_SUCCESS;
-}
-
-static void busname_trigger_notify(Unit *u, Unit *other) {
-        BusName *n = BUSNAME(u);
-
-        assert(n);
-        assert(other);
-
-        if (!IN_SET(n->state, BUSNAME_RUNNING, BUSNAME_LISTENING))
-                return;
-
-        if (other->start_limit_hit) {
-                busname_enter_dead(n, BUSNAME_FAILURE_SERVICE_START_LIMIT_HIT);
-                return;
-        }
-
-        if (other->load_state != UNIT_LOADED || other->type != UNIT_SERVICE)
-                return;
-
-        if (IN_SET(SERVICE(other)->state,
-                   SERVICE_DEAD, SERVICE_FAILED,
-                   SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL,
-                   SERVICE_AUTO_RESTART))
-                busname_enter_listening(n);
-
-        if (SERVICE(other)->state == SERVICE_RUNNING)
-                busname_set_state(n, BUSNAME_RUNNING);
-}
-
-static int busname_kill(Unit *u, KillWho who, int signo, sd_bus_error *error) {
-        return unit_kill_common(u, who, signo, -1, BUSNAME(u)->control_pid, error);
-}
-
-static int busname_get_timeout(Unit *u, usec_t *timeout) {
-        BusName *n = BUSNAME(u);
-        usec_t t;
-        int r;
-
-        if (!n->timer_event_source)
-                return 0;
-
-        r = sd_event_source_get_time(n->timer_event_source, &t);
-        if (r < 0)
-                return r;
-        if (t == USEC_INFINITY)
-                return 0;
-
-        *timeout = t;
-        return 1;
-}
-
-static bool busname_supported(void) {
-        return false;
-}
-
-static int busname_control_pid(Unit *u) {
-        BusName *n = BUSNAME(u);
-
-        assert(n);
-
-        return n->control_pid;
-}
-
-static const char* const busname_result_table[_BUSNAME_RESULT_MAX] = {
-        [BUSNAME_SUCCESS] = "success",
-        [BUSNAME_FAILURE_RESOURCES] = "resources",
-        [BUSNAME_FAILURE_TIMEOUT] = "timeout",
-        [BUSNAME_FAILURE_EXIT_CODE] = "exit-code",
-        [BUSNAME_FAILURE_SIGNAL] = "signal",
-        [BUSNAME_FAILURE_CORE_DUMP] = "core-dump",
-        [BUSNAME_FAILURE_START_LIMIT_HIT] = "start-limit-hit",
-        [BUSNAME_FAILURE_SERVICE_START_LIMIT_HIT] = "service-start-limit-hit",
-};
-
-DEFINE_STRING_TABLE_LOOKUP(busname_result, BusNameResult);
-
-const UnitVTable busname_vtable = {
-        .object_size = sizeof(BusName),
-
-        .sections =
-                "Unit\0"
-                "BusName\0"
-                "Install\0",
-        .private_section = "BusName",
-
-        .init = busname_init,
-        .done = busname_done,
-        .load = busname_load,
-
-        .coldplug = busname_coldplug,
-
-        .dump = busname_dump,
-
-        .start = busname_start,
-        .stop = busname_stop,
-
-        .kill = busname_kill,
-
-        .get_timeout = busname_get_timeout,
-
-        .serialize = busname_serialize,
-        .deserialize_item = busname_deserialize_item,
-
-        .active_state = busname_active_state,
-        .sub_state_to_string = busname_sub_state_to_string,
-
-        .sigchld_event = busname_sigchld_event,
-
-        .trigger_notify = busname_trigger_notify,
-
-        .reset_failed = busname_reset_failed,
-
-        .supported = busname_supported,
-
-        .control_pid = busname_control_pid,
-
-        .bus_vtable = bus_busname_vtable,
-
-        .status_message_formats = {
-                .finished_start_job = {
-                        [JOB_DONE]       = "Listening on %s.",
-                        [JOB_FAILED]     = "Failed to listen on %s.",
-                },
-                .finished_stop_job = {
-                        [JOB_DONE]       = "Closed %s.",
-                        [JOB_FAILED]     = "Failed stopping %s.",
-                },
-        },
-};
diff --git a/src/core/busname.h b/src/core/busname.h
deleted file mode 100644 (file)
index a8562db..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-
-/***
-  This file is part of systemd.
-
-  Copyright 2013 Lennart Poettering
-
-  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.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-typedef struct BusName BusName;
-typedef struct BusNamePolicy BusNamePolicy;
-
-#include "unit.h"
-#include "bus-policy.h"
-
-typedef enum BusNameResult {
-        BUSNAME_SUCCESS,
-        BUSNAME_FAILURE_RESOURCES,
-        BUSNAME_FAILURE_TIMEOUT,
-        BUSNAME_FAILURE_EXIT_CODE,
-        BUSNAME_FAILURE_SIGNAL,
-        BUSNAME_FAILURE_CORE_DUMP,
-        BUSNAME_FAILURE_START_LIMIT_HIT,
-        BUSNAME_FAILURE_SERVICE_START_LIMIT_HIT,
-        _BUSNAME_RESULT_MAX,
-        _BUSNAME_RESULT_INVALID = -1
-} BusNameResult;
-
-struct BusName {
-        Unit meta;
-
-        char *name;
-        int starter_fd;
-
-        bool activating;
-        bool accept_fd;
-
-        UnitRef service;
-
-        BusNameState state, deserialized_state;
-        BusNameResult result;
-
-        usec_t timeout_usec;
-
-        sd_event_source *starter_event_source;
-        sd_event_source *timer_event_source;
-
-        pid_t control_pid;
-
-        LIST_HEAD(BusNamePolicy, policy);
-        BusPolicyAccess policy_world;
-};
-
-extern const UnitVTable busname_vtable;
-
-const char* busname_result_to_string(BusNameResult i) _const_;
-BusNameResult busname_result_from_string(const char *s) _pure_;
diff --git a/src/core/dbus-busname.c b/src/core/dbus-busname.c
deleted file mode 100644 (file)
index cf816ba..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/***
-  This file is part of systemd.
-
-  Copyright 2013 Lennart Poettering
-
-  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.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include "bus-util.h"
-#include "busname.h"
-#include "dbus-busname.h"
-#include "string-util.h"
-#include "unit.h"
-
-static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, busname_result, BusNameResult);
-
-const sd_bus_vtable bus_busname_vtable[] = {
-        SD_BUS_VTABLE_START(0),
-        SD_BUS_PROPERTY("Name", "s", NULL, offsetof(BusName, name), SD_BUS_VTABLE_PROPERTY_CONST),
-        SD_BUS_PROPERTY("TimeoutUSec", "t", bus_property_get_usec, offsetof(BusName, timeout_usec), SD_BUS_VTABLE_PROPERTY_CONST),
-        SD_BUS_PROPERTY("ControlPID", "u", bus_property_get_pid, offsetof(BusName, control_pid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
-        SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(BusName, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
-        SD_BUS_PROPERTY("Activating", "b", bus_property_get_bool, offsetof(BusName, activating), SD_BUS_VTABLE_PROPERTY_CONST),
-        SD_BUS_PROPERTY("AcceptFileDescriptors", "b", bus_property_get_bool, offsetof(BusName, accept_fd), SD_BUS_VTABLE_PROPERTY_CONST),
-        SD_BUS_VTABLE_END
-};
diff --git a/src/core/dbus-busname.h b/src/core/dbus-busname.h
deleted file mode 100644 (file)
index 8643d1a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-
-/***
-  This file is part of systemd.
-
-  Copyright 2013 Lennart Poettering
-
-  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.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-
-extern const sd_bus_vtable bus_busname_vtable[];
index f8eb2c09a5e354de77c623ab3594ce96c257e3fc..9a87f0acd3d1fea978977d65007a7469ff601e23 100644 (file)
@@ -363,15 +363,6 @@ EXEC_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl
 CGROUP_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl
 KILL_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl
 m4_dnl
-BusName.Name,                    config_parse_string,                0,                             offsetof(BusName, name)
-BusName.Activating,              config_parse_bool,                  0,                             offsetof(BusName, activating)
-BusName.Service,                 config_parse_busname_service,       0,                             0
-BusName.AllowUser,               config_parse_bus_policy,            0,                             0
-BusName.AllowGroup,              config_parse_bus_policy,            0,                             0
-BusName.AllowWorld,              config_parse_bus_policy_world,      0,                             offsetof(BusName, policy_world)
-BusName.SELinuxContext,          config_parse_exec_selinux_context,  0,                             0
-BusName.AcceptFileDescriptors,   config_parse_bool,                  0,                             offsetof(BusName, accept_fd)
-m4_dnl
 Mount.What,                      config_parse_unit_string_printf,    0,                             offsetof(Mount, parameters_fragment.what)
 Mount.Where,                     config_parse_path,                  0,                             offsetof(Mount, where)
 Mount.Options,                   config_parse_unit_string_printf,    0,                             offsetof(Mount, parameters_fragment.options)
index 8cb8023bea13d8d44a40ea6944dfca75ea0a9e5c..95742dd8c7bbebef19f1b9d0bbcf91768bc86ecf 100644 (file)
@@ -2019,115 +2019,6 @@ int config_parse_user_group_strv(
         return 0;
 }
 
-int config_parse_busname_service(
-                const char *unit,
-                const char *filename,
-                unsigned line,
-                const char *section,
-                unsigned section_line,
-                const char *lvalue,
-                int ltype,
-                const char *rvalue,
-                void *data,
-                void *userdata) {
-
-        _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
-        BusName *n = data;
-        int r;
-        Unit *x;
-        _cleanup_free_ char *p = NULL;
-
-        assert(filename);
-        assert(lvalue);
-        assert(rvalue);
-        assert(data);
-
-        r = unit_name_printf(UNIT(n), rvalue, &p);
-        if (r < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %s", rvalue);
-                return 0;
-        }
-
-        if (!endswith(p, ".service")) {
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service, ignoring: %s", rvalue);
-                return 0;
-        }
-
-        r = manager_load_unit(UNIT(n)->manager, p, NULL, &error, &x);
-        if (r < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s, ignoring: %s", rvalue, bus_error_message(&error, r));
-                return 0;
-        }
-
-        unit_ref_set(&n->service, x);
-
-        return 0;
-}
-
-DEFINE_CONFIG_PARSE_ENUM(config_parse_bus_policy_world, bus_policy_access, BusPolicyAccess, "Failed to parse bus name policy access");
-
-int config_parse_bus_policy(
-                const char *unit,
-                const char *filename,
-                unsigned line,
-                const char *section,
-                unsigned section_line,
-                const char *lvalue,
-                int ltype,
-                const char *rvalue,
-                void *data,
-                void *userdata) {
-
-        _cleanup_free_ BusNamePolicy *p = NULL;
-        _cleanup_free_ char *id_str = NULL;
-        BusName *busname = data;
-        char *access_str;
-
-        assert(filename);
-        assert(lvalue);
-        assert(rvalue);
-        assert(data);
-
-        p = new0(BusNamePolicy, 1);
-        if (!p)
-                return log_oom();
-
-        if (streq(lvalue, "AllowUser"))
-                p->type = BUSNAME_POLICY_TYPE_USER;
-        else if (streq(lvalue, "AllowGroup"))
-                p->type = BUSNAME_POLICY_TYPE_GROUP;
-        else
-                assert_not_reached("Unknown lvalue");
-
-        id_str = strdup(rvalue);
-        if (!id_str)
-                return log_oom();
-
-        access_str = strpbrk(id_str, WHITESPACE);
-        if (!access_str) {
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid busname policy value '%s'", rvalue);
-                return 0;
-        }
-
-        *access_str = '\0';
-        access_str++;
-        access_str += strspn(access_str, WHITESPACE);
-
-        p->access = bus_policy_access_from_string(access_str);
-        if (p->access < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid busname policy access type '%s'", access_str);
-                return 0;
-        }
-
-        p->name = id_str;
-        id_str = NULL;
-
-        LIST_PREPEND(policy, busname->policy, p);
-        p = NULL;
-
-        return 0;
-}
-
 int config_parse_working_directory(
                 const char *unit,
                 const char *filename,
index 400393bcb60ff1f17a4fca61a991e8d5dfc7e9c5..ec338ccb9a3f65767e85a5bb59a2da6a239eb5dc 100644 (file)
@@ -65,9 +65,6 @@ int config_parse_trigger_unit(const char *unit, const char *filename, unsigned l
 int config_parse_path_spec(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_socket_service(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_service_sockets(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_busname_service(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_bus_policy(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_bus_policy_world(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_unit_env_file(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_ip_tos(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
 int config_parse_unit_condition_path(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
index fb8f9dc36b89bb80338c3ac96e9c0b361ad44b7b..eb9d74b6496f162f5daaa4e0027baee20818f2a6 100644 (file)
@@ -15,8 +15,6 @@ libcore_la_sources = '''
         service.h
         socket.c
         socket.h
-        busname.c
-        busname.h
         bus-policy.c
         bus-policy.h
         target.c
@@ -57,8 +55,6 @@ libcore_la_sources = '''
         dbus-service.h
         dbus-socket.c
         dbus-socket.h
-        dbus-busname.c
-        dbus-busname.h
         dbus-target.c
         dbus-target.h
         dbus-device.c
index b28eeb2262ff69dfe314f8b889db56301d8f55ca..0961dc8ca26633cbc4dd4276780957fb94a1f29c 100644 (file)
@@ -63,7 +63,6 @@
 const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
         [UNIT_SERVICE] = &service_vtable,
         [UNIT_SOCKET] = &socket_vtable,
-        [UNIT_BUSNAME] = &busname_vtable,
         [UNIT_TARGET] = &target_vtable,
         [UNIT_DEVICE] = &device_vtable,
         [UNIT_MOUNT] = &mount_vtable,
index cf21b37e22d77d67e61d0c8c844964c317874263..5ecaba11e90fb544c5e9d8928fe6625200cda4ee 100644 (file)
@@ -276,7 +276,6 @@ typedef enum UnitSetPropertiesMode {
 } UnitSetPropertiesMode;
 
 #include "automount.h"
-#include "busname.h"
 #include "device.h"
 #include "path.h"
 #include "scope.h"
@@ -471,7 +470,6 @@ extern const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX];
 
 DEFINE_CAST(SERVICE, Service);
 DEFINE_CAST(SOCKET, Socket);
-DEFINE_CAST(BUSNAME, BusName);
 DEFINE_CAST(TARGET, Target);
 DEFINE_CAST(DEVICE, Device);
 DEFINE_CAST(MOUNT, Mount);
index 83ed9ef9f71e0f134f8a2c08d068389a00521a14..55fce6248000b69c94577119b6f9d83cbaf586a2 100644 (file)
@@ -7258,11 +7258,6 @@ static void help_states(void) {
         for (i = 0; i < _AUTOMOUNT_STATE_MAX; i++)
                 puts(automount_state_to_string(i));
 
-        if (!arg_no_legend)
-                puts("\nAvailable busname unit substates:");
-        for (i = 0; i < _BUSNAME_STATE_MAX; i++)
-                puts(busname_state_to_string(i));
-
         if (!arg_no_legend)
                 puts("\nAvailable device unit substates:");
         for (i = 0; i < _DEVICE_STATE_MAX; i++)
index 294d219869f8df516be257cba342f20673ff1d4f..a16b04dbd2fb3688db0dd2ef5b20c54098921de2 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "architecture.h"
 #include "automount.h"
-#include "busname.h"
 #include "cgroup.h"
 #include "compress.h"
 #include "condition.h"
@@ -54,9 +53,6 @@ int main(int argc, char **argv) {
         test_table(architecture, ARCHITECTURE);
         test_table(automount_result, AUTOMOUNT_RESULT);
         test_table(automount_state, AUTOMOUNT_STATE);
-        test_table(bus_policy_access, BUS_POLICY_ACCESS);
-        test_table(busname_result, BUSNAME_RESULT);
-        test_table(busname_state, BUSNAME_STATE);
         test_table(cgroup_device_policy, CGROUP_DEVICE_POLICY);
         test_table(condition_type, CONDITION_TYPE);
         test_table(assert_type, CONDITION_TYPE);
diff --git a/units/org.freedesktop.hostname1.busname b/units/org.freedesktop.hostname1.busname
deleted file mode 100644 (file)
index f7b4133..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#  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=Hostname Service Bus Name
-Documentation=man:systemd-hostnamed.service(8) man:hostname(5) man:machine-info(5)
-Documentation=https://www.freedesktop.org/wiki/Software/systemd/hostnamed
-
-[BusName]
-Service=systemd-hostnamed.service
-AllowWorld=talk
diff --git a/units/org.freedesktop.import1.busname b/units/org.freedesktop.import1.busname
deleted file mode 100644 (file)
index ca6dcef..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#  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=Virtual Machine and Container Download Service Bus Name
-Documentation=man:systemd-importd.service(8)
-
-[BusName]
-Service=systemd-importd.service
-AllowWorld=talk
diff --git a/units/org.freedesktop.locale1.busname b/units/org.freedesktop.locale1.busname
deleted file mode 100644 (file)
index e0c498e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#  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=Locale Service Bus Name
-Documentation=man:systemd-localed.service(8) man:locale.conf(5) man:vconsole.conf(5)
-Documentation=https://www.freedesktop.org/wiki/Software/systemd/localed
-
-[BusName]
-Service=systemd-localed.service
-AllowWorld=talk
diff --git a/units/org.freedesktop.login1.busname b/units/org.freedesktop.login1.busname
deleted file mode 100644 (file)
index b169720..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#  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=Login Service Bus Name
-Documentation=man:systemd-logind.service(8) man:logind.conf(5)
-Documentation=https://www.freedesktop.org/wiki/Software/systemd/logind
-Documentation=https://www.freedesktop.org/wiki/Software/systemd/multiseat
-
-[BusName]
-Service=systemd-logind.service
-AllowWorld=talk
diff --git a/units/org.freedesktop.machine1.busname b/units/org.freedesktop.machine1.busname
deleted file mode 100644 (file)
index a1f0154..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#  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=Virtual Machine and Container Registration Service Bus Name
-Documentation=man:systemd-machined.service(8)
-Documentation=https://www.freedesktop.org/wiki/Software/systemd/machined
-
-[BusName]
-Service=systemd-machined.service
-AllowWorld=talk
diff --git a/units/org.freedesktop.network1.busname b/units/org.freedesktop.network1.busname
deleted file mode 100644 (file)
index 3a0e118..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#  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=Network Service Bus Name
-Documentation=man:systemd-networkd.service(8)
-
-# This is pulled in by systemd-networkd.service, since it cannot run
-# without its policy set. However, let's conditionalize this unit on
-# non-kdbus system.
-ConditionPathExists=/sys/fs/kdbus/0-system/
-
-[BusName]
-Service=systemd-networkd.service
-AllowWorld=talk
-AllowUser=systemd-network own
diff --git a/units/org.freedesktop.resolve1.busname b/units/org.freedesktop.resolve1.busname
deleted file mode 100644 (file)
index 28c8f97..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#  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=Network Name Resolution Service Bus Name
-Documentation=man:systemd-resolved.service(8)
-Documentation=https://www.freedesktop.org/wiki/Software/systemd/resolved
-
-# This is pulled in by systemd-resolved.service, since it cannot run
-# without its policy set. However, let's conditionalize this unit on
-# non-kdbus system.
-ConditionPathExists=/sys/fs/kdbus/0-system/
-
-[BusName]
-Service=systemd-resolved.service
-AllowWorld=talk
-AllowUser=systemd-resolve own
diff --git a/units/org.freedesktop.systemd1.busname b/units/org.freedesktop.systemd1.busname
deleted file mode 100644 (file)
index f9f41cb..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#  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=System and Service Manager Bus Name
-Documentation=man:systemd(1)
-Documentation=https://www.freedesktop.org/wiki/Software/systemd
-
-[BusName]
-Activating=no
-AllowWorld=talk
diff --git a/units/org.freedesktop.timedate1.busname b/units/org.freedesktop.timedate1.busname
deleted file mode 100644 (file)
index 1c962b5..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#  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=Time & Date Service Bus Name
-Documentation=man:systemd-timedated.service(8) man:localtime(5)
-Documentation=https://www.freedesktop.org/wiki/Software/systemd/timedated
-
-[BusName]
-Service=systemd-timedated.service
-AllowWorld=talk
index 15e6ad99d8a7e6bf191789e6f433b4b0e4742280..218e5c4d3fdaa9bf2b798a1bb805ba6ea78342a1 100644 (file)
@@ -16,11 +16,6 @@ Before=network.target multi-user.target shutdown.target
 Conflicts=shutdown.target
 Wants=network.target
 
-# On kdbus systems we pull in the busname explicitly, because it
-# carries policy that allows the daemon to acquire its name.
-Wants=org.freedesktop.network1.busname
-After=org.freedesktop.network1.busname
-
 [Service]
 Type=notify
 Restart=on-failure
index 931156a861778536f53a18b7eecaee824fb86cce..9821e1cfee7f14003a72d974f117bab68c3f4563 100644 (file)
@@ -15,11 +15,6 @@ After=systemd-networkd.service network.target
 Before=network-online.target nss-lookup.target
 Wants=nss-lookup.target
 
-# On kdbus systems we pull in the busname explicitly, because it
-# carries policy that allows the daemon to acquire its name.
-Wants=org.freedesktop.resolve1.busname
-After=org.freedesktop.resolve1.busname
-
 [Service]
 Type=notify
 Restart=always