[systemd-commits] 6 commits - fixme src/automount.c src/dbus.c src/dbus-execute.c src/dbus-execute.h src/dbus-mount.c src/dbus-service.c src/dbus-socket.c src/dbus-unit.c src/dbus-unit.h src/execute.c src/execute.h src/load-fragment.c src/manager.c src/manager.h src/mount.c src/mount.h src/service.c src/service.h src/snapshot.c src/socket.c src/socket.h src/unit.c src/unit.h src/util.c src/util.h units/arch units/fedora units/gentoo units/session units/suse
Lennart Poettering
lennart at kemper.freedesktop.org
Fri Jul 9 19:53:20 PDT 2010
fixme | 2 --
src/automount.c | 3 ++-
src/dbus-execute.c | 2 ++
src/dbus-execute.h | 9 +++++++--
src/dbus-mount.c | 2 --
src/dbus-service.c | 2 --
src/dbus-socket.c | 2 --
src/dbus-unit.c | 2 --
src/dbus-unit.h | 1 -
src/dbus.c | 31 +++++++++++++++++++------------
src/execute.c | 7 +++++++
src/execute.h | 13 +++++++++++++
src/load-fragment.c | 38 ++++++++++++++++++++++++++++++++++----
src/manager.c | 28 +++++++++++++++++++++-------
src/manager.h | 2 ++
src/mount.c | 38 +++++++++++++++++++-------------------
src/mount.h | 2 --
src/service.c | 41 ++++++++++++++++++++++-------------------
src/service.h | 2 --
src/snapshot.c | 2 +-
src/socket.c | 28 ++++++++++++++--------------
src/socket.h | 2 --
src/unit.c | 3 +++
src/unit.h | 9 ---------
src/util.c | 36 ++++++++++++++++++++++++++++++++++++
src/util.h | 3 +++
units/arch/halt.service | 2 +-
units/arch/poweroff.service | 2 +-
units/arch/reboot.service | 2 +-
units/fedora/halt.service | 2 +-
units/fedora/poweroff.service | 2 +-
units/fedora/reboot.service | 2 +-
units/gentoo/halt.service | 2 +-
units/gentoo/poweroff.service | 2 +-
units/gentoo/reboot.service | 2 +-
units/session/exit.service.in | 2 +-
units/suse/halt.service | 2 +-
units/suse/poweroff.service | 2 +-
units/suse/reboot.service | 2 +-
39 files changed, 218 insertions(+), 118 deletions(-)
New commits:
commit b827a9f97dcc88f4b9e23d656d7325455eb33848
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 10 04:52:31 2010 +0200
units: turn shutdown dependencies from Requires into Wants to make things a bit more robust
diff --git a/units/arch/halt.service b/units/arch/halt.service
index 87224e3..190e4fe 100644
--- a/units/arch/halt.service
+++ b/units/arch/halt.service
@@ -8,7 +8,7 @@
[Unit]
Description=Halt
DefaultDependencies=no
-Requires=shutdown.target
+Wants=shutdown.target
After=shutdown.target
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/arch/poweroff.service b/units/arch/poweroff.service
index ffa592c..0b1ee89 100644
--- a/units/arch/poweroff.service
+++ b/units/arch/poweroff.service
@@ -8,7 +8,7 @@
[Unit]
Description=Power-Off
DefaultDependencies=no
-Requires=shutdown.target
+Wants=shutdown.target
After=shutdown.target
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/arch/reboot.service b/units/arch/reboot.service
index 934903d..274f407 100644
--- a/units/arch/reboot.service
+++ b/units/arch/reboot.service
@@ -8,7 +8,7 @@
[Unit]
Description=Reboot
DefaultDependencies=no
-Requires=shutdown.target
+Wants=shutdown.target
After=shutdown.target
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/fedora/halt.service b/units/fedora/halt.service
index b957a3f..0c0fa5f 100644
--- a/units/fedora/halt.service
+++ b/units/fedora/halt.service
@@ -8,7 +8,7 @@
[Unit]
Description=Halt
DefaultDependencies=no
-Requires=shutdown.target killall.service
+Wants=shutdown.target killall.service
After=shutdown.target killall.service
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/fedora/poweroff.service b/units/fedora/poweroff.service
index 76d030c..913edc4 100644
--- a/units/fedora/poweroff.service
+++ b/units/fedora/poweroff.service
@@ -8,7 +8,7 @@
[Unit]
Description=Power-Off
DefaultDependencies=no
-Requires=shutdown.target killall.service
+Wants=shutdown.target killall.service
After=shutdown.target killall.service
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/fedora/reboot.service b/units/fedora/reboot.service
index 6a93c0b..c81b13e 100644
--- a/units/fedora/reboot.service
+++ b/units/fedora/reboot.service
@@ -8,7 +8,7 @@
[Unit]
Description=Reboot
DefaultDependencies=no
-Requires=shutdown.target killall.service
+Wants=shutdown.target killall.service
After=shutdown.target killall.service
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/gentoo/halt.service b/units/gentoo/halt.service
index 19ead8a..28db813 100644
--- a/units/gentoo/halt.service
+++ b/units/gentoo/halt.service
@@ -8,7 +8,7 @@
[Unit]
Description=Halt
DefaultDependencies=no
-Requires=shutdown.target killall.service
+Wants=shutdown.target killall.service
After=shutdown.target killall.service
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/gentoo/poweroff.service b/units/gentoo/poweroff.service
index 9ceb205..da6f48f 100644
--- a/units/gentoo/poweroff.service
+++ b/units/gentoo/poweroff.service
@@ -8,7 +8,7 @@
[Unit]
Description=Power-Off
DefaultDependencies=no
-Requires=shutdown.target killall.service
+Wants=shutdown.target killall.service
After=shutdown.target killall.service
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/gentoo/reboot.service b/units/gentoo/reboot.service
index c223e6c..a0f3575 100644
--- a/units/gentoo/reboot.service
+++ b/units/gentoo/reboot.service
@@ -8,7 +8,7 @@
[Unit]
Description=Reboot
DefaultDependencies=no
-Requires=shutdown.target killall.service
+Wants=shutdown.target killall.service
After=shutdown.target killall.service
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/session/exit.service.in b/units/session/exit.service.in
index 1f515a7..3e5b5bf 100644
--- a/units/session/exit.service.in
+++ b/units/session/exit.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Exit
DefaultDependencies=no
-Requires=shutdown.target
+Wants=shutdown.target
After=shutdown.target
[Service]
diff --git a/units/suse/halt.service b/units/suse/halt.service
index 5f42ac6..00bbfa9 100644
--- a/units/suse/halt.service
+++ b/units/suse/halt.service
@@ -8,7 +8,7 @@
[Unit]
Description=Halt
DefaultDependencies=no
-Requires=shutdown.target
+Wants=shutdown.target
After=shutdown.target
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/suse/poweroff.service b/units/suse/poweroff.service
index 93a9da5..e9aff27 100644
--- a/units/suse/poweroff.service
+++ b/units/suse/poweroff.service
@@ -8,7 +8,7 @@
[Unit]
Description=Power-Off
DefaultDependencies=no
-Requires=shutdown.target
+Wants=shutdown.target
After=shutdown.target
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
diff --git a/units/suse/reboot.service b/units/suse/reboot.service
index c3526b3..e9b76b6 100644
--- a/units/suse/reboot.service
+++ b/units/suse/reboot.service
@@ -8,7 +8,7 @@
[Unit]
Description=Reboot
DefaultDependencies=no
-Requires=shutdown.target
+Wants=shutdown.target
After=shutdown.target
Conflicts=dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount sys-kernel-security.automount
commit 3f6c78dcebdc0904d3b614da07e9ec8d84de2532
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 10 04:52:00 2010 +0200
service: allow immediate stopping while starting
diff --git a/src/mount.c b/src/mount.c
index bff956e..30390de 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -806,23 +806,20 @@ static int mount_stop(Unit *u) {
assert(m);
- /* Cann't do this right now. */
- if (m->state == MOUNT_MOUNTING ||
- m->state == MOUNT_MOUNTING_DONE ||
- m->state == MOUNT_MOUNTING_SIGTERM ||
- m->state == MOUNT_MOUNTING_SIGKILL ||
- m->state == MOUNT_REMOUNTING ||
- m->state == MOUNT_REMOUNTING_SIGTERM ||
- m->state == MOUNT_REMOUNTING_SIGKILL)
- return -EAGAIN;
-
/* Already on it */
if (m->state == MOUNT_UNMOUNTING ||
m->state == MOUNT_UNMOUNTING_SIGKILL ||
m->state == MOUNT_UNMOUNTING_SIGTERM)
return 0;
- assert(m->state == MOUNT_MOUNTED);
+ assert(m->state == MOUNT_MOUNTING ||
+ m->state == MOUNT_MOUNTING_DONE ||
+ m->state == MOUNT_MOUNTED ||
+ m->state == MOUNT_MOUNTING_SIGTERM ||
+ m->state == MOUNT_MOUNTING_SIGKILL ||
+ m->state == MOUNT_REMOUNTING ||
+ m->state == MOUNT_REMOUNTING_SIGTERM ||
+ m->state == MOUNT_REMOUNTING_SIGKILL);
mount_enter_unmounting(m, true);
return 0;
diff --git a/src/service.c b/src/service.c
index fc773d2..b837cb8 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1902,12 +1902,9 @@ static int service_stop(Unit *u) {
assert(s);
- /* Cannot do this now */
- if (s->state == SERVICE_START_PRE ||
- s->state == SERVICE_START ||
- s->state == SERVICE_START_POST ||
- s->state == SERVICE_RELOAD)
- return -EAGAIN;
+ /* This is a user request, so don't do restarts on this
+ * shutdown. */
+ s->allow_restart = false;
/* Already on it */
if (s->state == SERVICE_STOP ||
@@ -1918,16 +1915,24 @@ static int service_stop(Unit *u) {
s->state == SERVICE_FINAL_SIGKILL)
return 0;
+ /* Don't allow a restart */
if (s->state == SERVICE_AUTO_RESTART) {
service_set_state(s, SERVICE_DEAD);
return 0;
}
- assert(s->state == SERVICE_RUNNING || s->state == SERVICE_EXITED);
+ /* If there's already something running we go directly into
+ * kill mode. */
+ if (s->state == SERVICE_START_PRE ||
+ s->state == SERVICE_START ||
+ s->state == SERVICE_START_POST ||
+ s->state == SERVICE_RELOAD) {
+ service_enter_signal(s, SERVICE_STOP_SIGTERM, true);
+ return 0;
+ }
- /* This is a user request, so don't do restarts on this
- * shutdown. */
- s->allow_restart = false;
+ assert(s->state == SERVICE_RUNNING ||
+ s->state == SERVICE_EXITED);
service_enter_stop(s, true);
return 0;
diff --git a/src/socket.c b/src/socket.c
index 6cbb141..7ff2927 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1166,21 +1166,23 @@ static int socket_stop(Unit *u) {
assert(s);
- /* We cannot fulfill this request right now, try again later
- * please! */
- if (s->state == SOCKET_START_PRE ||
- s->state == SOCKET_START_POST)
- return -EAGAIN;
-
/* Already on it */
if (s->state == SOCKET_STOP_PRE ||
s->state == SOCKET_STOP_PRE_SIGTERM ||
s->state == SOCKET_STOP_PRE_SIGKILL ||
s->state == SOCKET_STOP_POST ||
s->state == SOCKET_FINAL_SIGTERM ||
- s->state == SOCKET_FINAL_SIGTERM)
+ s->state == SOCKET_FINAL_SIGKILL)
return 0;
+ /* If there's already something running we go directly into
+ * kill mode. */
+ if (s->state == SOCKET_START_PRE ||
+ s->state == SOCKET_START_POST) {
+ socket_enter_signal(s, SOCKET_STOP_PRE_SIGTERM, true);
+ return -EAGAIN;
+ }
+
assert(s->state == SOCKET_LISTENING || s->state == SOCKET_RUNNING);
socket_enter_stop_pre(s, true);
commit 82c64bf578623f0678b4de1ac08c6bd8e5d95662
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 10 04:51:03 2010 +0200
snapshot: fix deserialization
diff --git a/src/manager.c b/src/manager.c
index a643263..bd4f465 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2279,6 +2279,8 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
log_debug("Deserializing state...");
+ m->deserializing = true;
+
for (;;) {
Unit *u;
char name[UNIT_NAME_MAX+2];
@@ -2288,22 +2290,30 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
if (feof(f))
break;
- return -errno;
+ r = -errno;
+ goto finish;
}
char_array_0(name);
if ((r = manager_load_unit(m, strstrip(name), NULL, NULL, &u)) < 0)
- return r;
+ goto finish;
if ((r = unit_deserialize(u, f, fds)) < 0)
- return r;
+ goto finish;
}
- if (ferror(f))
- return -EIO;
+ if (ferror(f)) {
+ r = -EIO;
+ goto finish;
+ }
- return 0;
+ r = 0;
+
+finish:
+ m->deserializing = false;
+
+ return r;
}
int manager_reload(Manager *m) {
diff --git a/src/manager.h b/src/manager.h
index e5cf3a1..b44ffe2 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -193,6 +193,8 @@ struct Manager {
bool utmp_reboot_written:1;
+ bool deserializing:1;
+
bool show_status;
bool confirm_spawn;
};
diff --git a/src/snapshot.c b/src/snapshot.c
index fe8a43d..11e7c3e 100644
--- a/src/snapshot.c
+++ b/src/snapshot.c
@@ -56,7 +56,7 @@ static int snapshot_load(Unit *u) {
/* Make sure that only snapshots created via snapshot_create()
* can be loaded */
- if (!s->by_snapshot_create)
+ if (!s->by_snapshot_create && !s->meta.manager->deserializing)
return -ENOENT;
u->meta.load_state = UNIT_LOADED;
commit 1e001f52d20a4685c9e8cf3cfa690021ca05c9e7
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 10 04:50:19 2010 +0200
main: add a few more useful diagnostic log messages
diff --git a/src/dbus.c b/src/dbus.c
index 1620469..7f8b6a0 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -338,10 +338,12 @@ static DBusHandlerResult api_bus_message_filter(DBusConnection *connection, DBus
dbus_error_init(&error);
- log_debug("Got D-Bus request: %s.%s() on %s",
- dbus_message_get_interface(message),
- dbus_message_get_member(message),
- dbus_message_get_path(message));
+ if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL ||
+ dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL)
+ log_debug("Got D-Bus request: %s.%s() on %s",
+ dbus_message_get_interface(message),
+ dbus_message_get_member(message),
+ dbus_message_get_path(message));
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
log_error("Warning! API D-Bus connection terminated.");
@@ -443,10 +445,13 @@ static DBusHandlerResult system_bus_message_filter(DBusConnection *connection, D
dbus_error_init(&error);
- log_debug("Got D-Bus request: %s.%s() on %s",
- dbus_message_get_interface(message),
- dbus_message_get_member(message),
- dbus_message_get_path(message));
+ if (m->api_bus != m->system_bus &&
+ (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL ||
+ dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL))
+ log_debug("Got D-Bus request on system bus: %s.%s() on %s",
+ dbus_message_get_interface(message),
+ dbus_message_get_member(message),
+ dbus_message_get_path(message));
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
log_error("Warning! System D-Bus connection terminated.");
@@ -474,10 +479,12 @@ static DBusHandlerResult private_bus_message_filter(DBusConnection *connection,
assert(message);
assert(m);
- log_debug("Got D-Bus request: %s.%s() on %s",
- dbus_message_get_interface(message),
- dbus_message_get_member(message),
- dbus_message_get_path(message));
+ if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL ||
+ dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL)
+ log_debug("Got D-Bus request: %s.%s() on %s",
+ dbus_message_get_interface(message),
+ dbus_message_get_member(message),
+ dbus_message_get_path(message));
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected"))
shutdown_connection(m, connection);
diff --git a/src/manager.c b/src/manager.c
index 638ef2f..a643263 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1768,6 +1768,8 @@ static int manager_start_target(Manager *m, const char *name, JobMode mode) {
dbus_error_init(&error);
+ log_info("Activating special unit %s", name);
+
if ((r = manager_add_job_by_name(m, JOB_START, name, mode, true, &error, NULL)) < 0)
log_error("Failed to enqueue %s job: %s", name, bus_error(&error, r));
@@ -1795,6 +1797,8 @@ static int manager_process_signal_fd(Manager *m) {
return -errno;
}
+ log_debug("Received SIG%s", strna(signal_to_string(sfsi.ssi_signo)));
+
switch (sfsi.ssi_signo) {
case SIGCHLD:
@@ -1905,7 +1909,7 @@ static int manager_process_signal_fd(Manager *m) {
break;
}
- log_info("Got unhandled signal <%s>.", strsignal(sfsi.ssi_signo));
+ log_warning("Got unhandled signal <%s>.", strna(signal_to_string(sfsi.ssi_signo)));
}
}
}
diff --git a/src/unit.c b/src/unit.c
index a5f8712..c287310 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -970,6 +970,9 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
else if (UNIT_IS_ACTIVE_OR_RELOADING(os) && !UNIT_IS_ACTIVE_OR_RELOADING(ns))
u->meta.active_exit_timestamp = ts;
+ if (ns != os && ns == UNIT_MAINTENANCE)
+ log_notice("Unit %s entered maintenance state.", u->meta.id);
+
timer_unit_notify(u, ns);
path_unit_notify(u, ns);
commit 2e22afe909cd5fa003347aa91ad15f0516e5047f
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 10 04:49:37 2010 +0200
execute: add ability to configure the kill signal
diff --git a/fixme b/fixme
index 3b3d0f7..1426700 100644
--- a/fixme
+++ b/fixme
@@ -35,8 +35,6 @@
* selinux
-* pull in umount.target and shutdown.target from emergency.service (?)
-
* Show exit status auf auxiliary programs in systemctl status
External:
diff --git a/src/dbus-execute.c b/src/dbus-execute.c
index d37bd55..1ef6f25 100644
--- a/src/dbus-execute.c
+++ b/src/dbus-execute.c
@@ -28,6 +28,8 @@
#include "ioprio.h"
#include "strv.h"
+DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_execute_append_kill_mode, kill_mode, KillMode);
+
DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_execute_append_input, exec_input, ExecInput);
DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_execute_append_output, exec_output, ExecOutput);
diff --git a/src/dbus-execute.h b/src/dbus-execute.h
index 32d58d6..85c390b 100644
--- a/src/dbus-execute.h
+++ b/src/dbus-execute.h
@@ -83,7 +83,9 @@
" <property name=\"InaccessibleDirectories\" type=\"as\" access=\"read\"/>\n" \
" <property name=\"MountFlags\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"PrivateTmp\" type=\"b\" access=\"read\"/>\n" \
- " <property name=\"SameProcessGroup\" type=\"b\" access=\"read\"/>\n"
+ " <property name=\"SameProcessGroup\" type=\"b\" access=\"read\"/>\n" \
+ " <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n" \
+ " <property name=\"KillSignal\" type=\"i\" access=\"read\"/>\n"
#define BUS_EXEC_COMMAND_INTERFACE(name) \
" <property name=\"" name "\" type=\"a(sasttuii)\" access=\"read\"/>\n"
@@ -138,7 +140,9 @@
{ interface, "InaccessibleDirectories", bus_property_append_strv, "as", (context).inaccessible_dirs }, \
{ interface, "MountFlags", bus_property_append_ul, "t", &(context).mount_flags }, \
{ interface, "PrivateTmp", bus_property_append_bool, "b", &(context).private_tmp }, \
- { interface, "SameProcessGroup", bus_property_append_bool, "b", &(context).same_pgrp }
+ { interface, "SameProcessGroup", bus_property_append_bool, "b", &(context).same_pgrp }, \
+ { interface, "KillMode", bus_execute_append_kill_mode, "s", &(context).kill_mode }, \
+ { interface, "KillSignal", bus_property_append_int, "i", &(context).kill_signal }
#define BUS_EXEC_STATUS_PROPERTIES(interface, estatus, prefix) \
{ interface, prefix "StartTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \
@@ -162,5 +166,6 @@ int bus_execute_append_timer_slack_nsec(Manager *m, DBusMessageIter *i, const ch
int bus_execute_append_capabilities(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_execute_append_rlimits(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_execute_append_command(Manager *m, DBusMessageIter *u, const char *property, void *data);
+int bus_execute_append_kill_mode(Manager *m, DBusMessageIter *i, const char *property, void *data);
#endif
diff --git a/src/dbus-mount.c b/src/dbus-mount.c
index 76a010b..1cc844a 100644
--- a/src/dbus-mount.c
+++ b/src/dbus-mount.c
@@ -36,7 +36,6 @@
BUS_EXEC_COMMAND_INTERFACE("ExecUnmount") \
BUS_EXEC_COMMAND_INTERFACE("ExecRemount") \
BUS_EXEC_CONTEXT_INTERFACE \
- " <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"DirectoryMode\" type=\"u\" access=\"read\"/>\n" \
" </interface>\n"
@@ -136,7 +135,6 @@ DBusHandlerResult bus_mount_message_handler(Unit *u, DBusConnection *c, DBusMess
BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Mount", u->mount.exec_command+MOUNT_EXEC_UNMOUNT, "ExecUnmount"),
BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Mount", u->mount.exec_command+MOUNT_EXEC_REMOUNT, "ExecRemount"),
BUS_EXEC_CONTEXT_PROPERTIES("org.freedesktop.systemd1.Mount", u->mount.exec_context),
- { "org.freedesktop.systemd1.Mount", "KillMode", bus_unit_append_kill_mode, "s", &u->mount.kill_mode },
{ "org.freedesktop.systemd1.Mount", "ControlPID", bus_property_append_pid, "u", &u->mount.control_pid },
{ "org.freedesktop.systemd1.Mount", "DirectoryMode", bus_property_append_mode, "u", &u->mount.directory_mode },
{ NULL, NULL, NULL, NULL, NULL }
diff --git a/src/dbus-service.c b/src/dbus-service.c
index 46a6ff1..f4a4002 100644
--- a/src/dbus-service.c
+++ b/src/dbus-service.c
@@ -43,7 +43,6 @@
" <property name=\"PermissionsStartOnly\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"RootDirectoryStartOnly\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"ValidNoProcess\" type=\"b\" access=\"read\"/>\n" \
- " <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n" \
BUS_EXEC_STATUS_INTERFACE("ExecMain") \
" <property name=\"MainPID\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
@@ -88,7 +87,6 @@ DBusHandlerResult bus_service_message_handler(Unit *u, DBusConnection *connectio
{ "org.freedesktop.systemd1.Service", "PermissionsStartOnly", bus_property_append_bool, "b", &u->service.permissions_start_only },
{ "org.freedesktop.systemd1.Service", "RootDirectoryStartOnly", bus_property_append_bool, "b", &u->service.root_directory_start_only },
{ "org.freedesktop.systemd1.Service", "ValidNoProcess", bus_property_append_bool, "b", &u->service.valid_no_process },
- { "org.freedesktop.systemd1.Service", "KillMode", bus_unit_append_kill_mode, "s", &u->service.kill_mode },
BUS_EXEC_STATUS_PROPERTIES("org.freedesktop.systemd1.Service", u->service.main_exec_status, "ExecMain"),
{ "org.freedesktop.systemd1.Service", "MainPID", bus_property_append_pid, "u", &u->service.main_pid },
{ "org.freedesktop.systemd1.Service", "ControlPID", bus_property_append_pid, "u", &u->service.control_pid },
diff --git a/src/dbus-socket.c b/src/dbus-socket.c
index 22a4ce8..07831b5 100644
--- a/src/dbus-socket.c
+++ b/src/dbus-socket.c
@@ -35,7 +35,6 @@
BUS_EXEC_COMMAND_INTERFACE("ExecStopPre") \
BUS_EXEC_COMMAND_INTERFACE("ExecStopPost") \
BUS_EXEC_CONTEXT_INTERFACE \
- " <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"BindToDevice\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"DirectoryMode\" type=\"u\" access=\"read\"/>\n" \
@@ -79,7 +78,6 @@ DBusHandlerResult bus_socket_message_handler(Unit *u, DBusConnection *c, DBusMes
BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Socket", u->service.exec_command[SOCKET_EXEC_STOP_PRE], "ExecStopPre"),
BUS_EXEC_COMMAND_PROPERTY("org.freedesktop.systemd1.Socket", u->service.exec_command[SOCKET_EXEC_STOP_POST], "ExecStopPost"),
BUS_EXEC_CONTEXT_PROPERTIES("org.freedesktop.systemd1.Socket", u->socket.exec_context),
- { "org.freedesktop.systemd1.Socket", "KillMode", bus_unit_append_kill_mode, "s", &u->socket.kill_mode },
{ "org.freedesktop.systemd1.Socket", "ControlPID", bus_property_append_pid, "u", &u->socket.control_pid },
{ "org.freedesktop.systemd1.Socket", "BindToDevice", bus_property_append_string, "s", u->socket.bind_to_device },
{ "org.freedesktop.systemd1.Socket", "DirectoryMode", bus_property_append_mode, "u", &u->socket.directory_mode },
diff --git a/src/dbus-unit.c b/src/dbus-unit.c
index 840eaa5..ad0c193 100644
--- a/src/dbus-unit.c
+++ b/src/dbus-unit.c
@@ -254,8 +254,6 @@ int bus_unit_append_cgroups(Manager *m, DBusMessageIter *i, const char *property
return 0;
}
-DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_unit_append_kill_mode, kill_mode, KillMode);
-
static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusConnection *connection, DBusMessage *message) {
DBusMessage *reply = NULL;
Manager *m = u->meta.manager;
diff --git a/src/dbus-unit.h b/src/dbus-unit.h
index 2067095..17965b6 100644
--- a/src/dbus-unit.h
+++ b/src/dbus-unit.h
@@ -126,7 +126,6 @@ int bus_unit_append_can_reload(Manager *m, DBusMessageIter *i, const char *prope
int bus_unit_append_job(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_unit_append_default_cgroup(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_unit_append_cgroups(Manager *m, DBusMessageIter *i, const char *property, void *data);
-int bus_unit_append_kill_mode(Manager *m, DBusMessageIter *i, const char *property, void *data);
void bus_unit_send_change_signal(Unit *u);
void bus_unit_send_removed_signal(Unit *u);
diff --git a/src/execute.c b/src/execute.c
index 955a3e2..0c2526b 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1308,6 +1308,7 @@ void exec_context_init(ExecContext *c) {
c->syslog_priority = LOG_DAEMON|LOG_INFO;
c->syslog_level_prefix = true;
c->mount_flags = MS_SHARED;
+ c->kill_signal = SIGTERM;
}
void exec_context_done(ExecContext *c) {
@@ -1571,6 +1572,12 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
strv_fprintf(f, c->inaccessible_dirs);
fputs("\n", f);
}
+
+ fprintf(f,
+ "%sKillMode: %s\n"
+ "%sKillSignal: SIG%s\n",
+ prefix, kill_mode_to_string(c->kill_mode),
+ prefix, signal_to_string(c->kill_signal));
}
void exec_status_start(ExecStatus *s, pid_t pid) {
diff --git a/src/execute.h b/src/execute.h
index a9075fe..f93ab7a 100644
--- a/src/execute.h
+++ b/src/execute.h
@@ -45,6 +45,15 @@ struct CGroupBonding;
#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
#define SIGNALS_IGNORE SIGKILL,SIGPIPE
+typedef enum KillMode {
+ KILL_CONTROL_GROUP = 0,
+ KILL_PROCESS_GROUP,
+ KILL_PROCESS,
+ KILL_NONE,
+ _KILL_MODE_MAX,
+ _KILL_MODE_INVALID = -1
+} KillMode;
+
typedef enum ExecInput {
EXEC_INPUT_NULL,
EXEC_INPUT_TTY,
@@ -143,6 +152,10 @@ struct ExecContext {
* that the autofs logic detects that it belongs to us and we
* don't enter a trigger loop. */
bool same_pgrp;
+
+ /* Not relevant for spawning processes, just for killing */
+ KillMode kill_mode;
+ int kill_signal;
};
typedef enum ExitStatus {
diff --git a/src/load-fragment.c b/src/load-fragment.c
index d474c9a..6a71d42 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -969,6 +969,36 @@ static int config_parse_sysv_priority(
static DEFINE_CONFIG_PARSE_ENUM(config_parse_kill_mode, kill_mode, KillMode, "Failed to parse kill mode");
+static int config_parse_kill_signal(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ int *sig = data;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(sig);
+
+ if ((r = signal_from_string(rvalue)) <= 0)
+ if (startswith(rvalue, "SIG"))
+ r = signal_from_string(rvalue+3);
+
+ if (r <= 0) {
+ log_error("[%s:%u] Failed to parse kill signal: %s", filename, line, rvalue);
+ return -EINVAL;
+ }
+
+ *sig = r;
+ return 0;
+}
+
static int config_parse_mount_flags(
const char *filename,
unsigned line,
@@ -1395,6 +1425,7 @@ static void dump_items(FILE *f, const ConfigItem *items) {
{ config_parse_service_restart, "SERVICERESTART" },
{ config_parse_sysv_priority, "SYSVPRIORITY" },
{ config_parse_kill_mode, "KILLMODE" },
+ { config_parse_kill_signal, "SIGNAL" },
{ config_parse_listen, "SOCKET [...]" },
{ config_parse_socket_bind, "SOCKETBIND" },
{ config_parse_bindtodevice, "NETWORKINTERFACE" },
@@ -1504,7 +1535,9 @@ static int load_from_path(Unit *u, const char *path) {
{ "PrivateTmp", config_parse_bool, &(context).private_tmp, section }, \
{ "MountFlags", config_parse_mount_flags, &(context), section }, \
{ "TCPWrapName", config_parse_string_printf, &(context).tcpwrap_name, section }, \
- { "PAMName", config_parse_string_printf, &(context).pam_name, section }
+ { "PAMName", config_parse_string_printf, &(context).pam_name, section }, \
+ { "KillMode", config_parse_kill_mode, &(context).kill_mode, section }, \
+ { "KillSignal", config_parse_kill_signal, &(context).kill_signal, section }
const ConfigItem items[] = {
{ "Names", config_parse_names, u, "Unit" },
@@ -1537,7 +1570,6 @@ static int load_from_path(Unit *u, const char *path) {
{ "RootDirectoryStartOnly", config_parse_bool, &u->service.root_directory_start_only, "Service" },
{ "ValidNoProcess", config_parse_bool, &u->service.valid_no_process, "Service" },
{ "SysVStartPriority", config_parse_sysv_priority, &u->service.sysv_start_priority, "Service" },
- { "KillMode", config_parse_kill_mode, &u->service.kill_mode, "Service" },
{ "NonBlocking", config_parse_bool, &u->service.exec_context.non_blocking, "Service" },
{ "BusName", config_parse_string_printf, &u->service.bus_name, "Service" },
{ "NotifyAccess", config_parse_notify_access, &u->service.notify_access, "Service" },
@@ -1557,7 +1589,6 @@ static int load_from_path(Unit *u, const char *path) {
{ "TimeoutSec", config_parse_usec, &u->socket.timeout_usec, "Socket" },
{ "DirectoryMode", config_parse_mode, &u->socket.directory_mode, "Socket" },
{ "SocketMode", config_parse_mode, &u->socket.socket_mode, "Socket" },
- { "KillMode", config_parse_kill_mode, &u->socket.kill_mode, "Socket" },
{ "Accept", config_parse_bool, &u->socket.accept, "Socket" },
{ "MaxConnections", config_parse_unsigned, &u->socket.max_connections, "Socket" },
{ "KeepAlive", config_parse_bool, &u->socket.keep_alive, "Socket" },
@@ -1576,7 +1607,6 @@ static int load_from_path(Unit *u, const char *path) {
{ "Options", config_parse_string, &u->mount.parameters_fragment.options, "Mount" },
{ "Type", config_parse_string, &u->mount.parameters_fragment.fstype, "Mount" },
{ "TimeoutSec", config_parse_usec, &u->mount.timeout_usec, "Mount" },
- { "KillMode", config_parse_kill_mode, &u->mount.kill_mode, "Mount" },
{ "DirectoryMode", config_parse_mode, &u->mount.directory_mode, "Mount" },
EXEC_CONTEXT_CONFIG_ITEMS(u->mount.exec_context, "Mount"),
diff --git a/src/mount.c b/src/mount.c
index 36caae3..bff956e 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -301,7 +301,7 @@ static int mount_verify(Mount *m) {
return -EBADMSG;
}
- if (m->exec_context.pam_name && m->kill_mode != KILL_CONTROL_GROUP) {
+ if (m->exec_context.pam_name && m->exec_context.kill_mode != KILL_CONTROL_GROUP) {
log_error("%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", m->meta.id);
return -EINVAL;
}
@@ -501,7 +501,6 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) {
"%sFrom /etc/fstab: %s\n"
"%sFrom /proc/self/mountinfo: %s\n"
"%sFrom fragment: %s\n"
- "%sKillMode: %s\n"
"%sDirectoryMode: %04o\n",
prefix, mount_state_to_string(m->state),
prefix, m->where,
@@ -511,7 +510,6 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) {
prefix, yes_no(m->from_etc_fstab),
prefix, yes_no(m->from_proc_self_mountinfo),
prefix, yes_no(m->from_fragment),
- prefix, kill_mode_to_string(m->kill_mode),
prefix, m->directory_mode);
if (m->control_pid > 0)
@@ -587,12 +585,12 @@ static void mount_enter_signal(Mount *m, MountState state, bool success) {
if (!success)
m->failure = true;
- if (m->kill_mode != KILL_NONE) {
+ if (m->exec_context.kill_mode != KILL_NONE) {
int sig = (state == MOUNT_MOUNTING_SIGTERM ||
state == MOUNT_UNMOUNTING_SIGTERM ||
- state == MOUNT_REMOUNTING_SIGTERM) ? SIGTERM : SIGKILL;
+ state == MOUNT_REMOUNTING_SIGTERM) ? m->exec_context.kill_signal : SIGKILL;
- if (m->kill_mode == KILL_CONTROL_GROUP) {
+ if (m->exec_context.kill_mode == KILL_CONTROL_GROUP) {
if ((r = cgroup_bonding_kill_list(m->meta.cgroup_bondings, sig)) < 0) {
if (r != -EAGAIN && r != -ESRCH)
@@ -602,7 +600,10 @@ static void mount_enter_signal(Mount *m, MountState state, bool success) {
}
if (!sent && m->control_pid > 0)
- if (kill(m->kill_mode == KILL_PROCESS ? m->control_pid : -m->control_pid, sig) < 0 && errno != ESRCH) {
+ if (kill(m->exec_context.kill_mode == KILL_PROCESS ?
+ m->control_pid :
+ -m->control_pid, sig) < 0 && errno != ESRCH) {
+
r = -errno;
goto fail;
}
diff --git a/src/mount.h b/src/mount.h
index 4732902..6c60167 100644
--- a/src/mount.h
+++ b/src/mount.h
@@ -88,8 +88,6 @@ struct Mount {
MountState state, deserialized_state;
- KillMode kill_mode;
-
ExecCommand* control_command;
MountExecCommand control_command_id;
pid_t control_pid;
diff --git a/src/service.c b/src/service.c
index f173d8a..fc773d2 100644
--- a/src/service.c
+++ b/src/service.c
@@ -684,9 +684,9 @@ static int service_load_sysv_path(Service *s, const char *path) {
/* Special setting for all SysV services */
s->type = SERVICE_FORKING;
s->valid_no_process = true;
- s->kill_mode = KILL_PROCESS_GROUP;
s->restart = SERVICE_ONCE;
s->exec_context.std_output = EXEC_OUTPUT_TTY;
+ s->exec_context.kill_mode = KILL_PROCESS_GROUP;
u->meta.load_state = UNIT_LOADED;
r = 0;
@@ -821,7 +821,7 @@ static int service_verify(Service *s) {
return -EINVAL;
}
- if (s->exec_context.pam_name && s->kill_mode != KILL_CONTROL_GROUP) {
+ if (s->exec_context.pam_name && s->exec_context.kill_mode != KILL_CONTROL_GROUP) {
log_error("%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", s->meta.id);
return -EINVAL;
}
@@ -928,14 +928,12 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
"%sPermissionsStartOnly: %s\n"
"%sRootDirectoryStartOnly: %s\n"
"%sValidNoProcess: %s\n"
- "%sKillMode: %s\n"
"%sType: %s\n"
"%sNotifyAccess: %s\n",
prefix, service_state_to_string(s->state),
prefix, yes_no(s->permissions_start_only),
prefix, yes_no(s->root_directory_start_only),
prefix, yes_no(s->valid_no_process),
- prefix, kill_mode_to_string(s->kill_mode),
prefix, service_type_to_string(s->type),
prefix, notify_access_to_string(s->notify_access));
@@ -1533,10 +1531,10 @@ static void service_enter_signal(Service *s, ServiceState state, bool success) {
if (!success)
s->failure = true;
- if (s->kill_mode != KILL_NONE) {
- int sig = (state == SERVICE_STOP_SIGTERM || state == SERVICE_FINAL_SIGTERM) ? SIGTERM : SIGKILL;
+ if (s->exec_context.kill_mode != KILL_NONE) {
+ int sig = (state == SERVICE_STOP_SIGTERM || state == SERVICE_FINAL_SIGTERM) ? s->exec_context.kill_signal : SIGKILL;
- if (s->kill_mode == KILL_CONTROL_GROUP) {
+ if (s->exec_context.kill_mode == KILL_CONTROL_GROUP) {
if ((r = cgroup_bonding_kill_list(s->meta.cgroup_bondings, sig)) < 0) {
if (r != -EAGAIN && r != -ESRCH)
@@ -1549,14 +1547,14 @@ static void service_enter_signal(Service *s, ServiceState state, bool success) {
r = 0;
if (s->main_pid > 0) {
- if (kill(s->kill_mode == KILL_PROCESS ? s->main_pid : -s->main_pid, sig) < 0 && errno != ESRCH)
+ if (kill(s->exec_context.kill_mode == KILL_PROCESS ? s->main_pid : -s->main_pid, sig) < 0 && errno != ESRCH)
r = -errno;
else
sent = true;
}
if (s->control_pid > 0) {
- if (kill(s->kill_mode == KILL_PROCESS ? s->control_pid : -s->control_pid, sig) < 0 && errno != ESRCH)
+ if (kill(s->exec_context.kill_mode == KILL_PROCESS ? s->control_pid : -s->control_pid, sig) < 0 && errno != ESRCH)
r = -errno;
else
sent = true;
diff --git a/src/service.h b/src/service.h
index 6c1612d..d254044 100644
--- a/src/service.h
+++ b/src/service.h
@@ -107,8 +107,6 @@ struct Service {
ServiceState state, deserialized_state;
- KillMode kill_mode;
-
ExecStatus main_exec_status;
ExecCommand *control_command;
diff --git a/src/socket.c b/src/socket.c
index 075b519..6cbb141 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -165,7 +165,7 @@ static int socket_verify(Socket *s) {
return -EINVAL;
}
- if (s->exec_context.pam_name && s->kill_mode != KILL_CONTROL_GROUP) {
+ if (s->exec_context.pam_name && s->exec_context.kill_mode != KILL_CONTROL_GROUP) {
log_error("%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", s->meta.id);
return -EINVAL;
}
@@ -326,7 +326,6 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
"%sSocket State: %s\n"
"%sBindIPv6Only: %s\n"
"%sBacklog: %u\n"
- "%sKillMode: %s\n"
"%sSocketMode: %04o\n"
"%sDirectoryMode: %04o\n"
"%sKeepAlive: %s\n"
@@ -334,7 +333,6 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
prefix, socket_state_to_string(s->state),
prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only),
prefix, s->backlog,
- prefix, kill_mode_to_string(s->kill_mode),
prefix, s->socket_mode,
prefix, s->directory_mode,
prefix, yes_no(s->keep_alive),
@@ -891,10 +889,10 @@ static void socket_enter_signal(Socket *s, SocketState state, bool success) {
if (!success)
s->failure = true;
- if (s->kill_mode != KILL_NONE) {
- int sig = (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_FINAL_SIGTERM) ? SIGTERM : SIGKILL;
+ if (s->exec_context.kill_mode != KILL_NONE) {
+ int sig = (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_FINAL_SIGTERM) ? s->exec_context.kill_signal : SIGKILL;
- if (s->kill_mode == KILL_CONTROL_GROUP) {
+ if (s->exec_context.kill_mode == KILL_CONTROL_GROUP) {
if ((r = cgroup_bonding_kill_list(s->meta.cgroup_bondings, sig)) < 0) {
if (r != -EAGAIN && r != -ESRCH)
@@ -904,7 +902,7 @@ static void socket_enter_signal(Socket *s, SocketState state, bool success) {
}
if (!sent && s->control_pid > 0)
- if (kill(s->kill_mode == KILL_PROCESS ? s->control_pid : -s->control_pid, sig) < 0 && errno != ESRCH) {
+ if (kill(s->exec_context.kill_mode == KILL_PROCESS ? s->control_pid : -s->control_pid, sig) < 0 && errno != ESRCH) {
r = -errno;
goto fail;
}
diff --git a/src/socket.h b/src/socket.h
index 0674cd8..8f3cd76 100644
--- a/src/socket.h
+++ b/src/socket.h
@@ -88,8 +88,6 @@ struct Socket {
SocketState state, deserialized_state;
- KillMode kill_mode;
-
ExecCommand* control_command;
SocketExecCommand control_command_id;
pid_t control_pid;
diff --git a/src/unit.h b/src/unit.h
index abd97f9..c9fd4a5 100644
--- a/src/unit.h
+++ b/src/unit.h
@@ -43,15 +43,6 @@ typedef enum UnitDependency UnitDependency;
#define DEFAULT_TIMEOUT_USEC (60*USEC_PER_SEC)
#define DEFAULT_RESTART_USEC (100*USEC_PER_MSEC)
-typedef enum KillMode {
- KILL_CONTROL_GROUP = 0,
- KILL_PROCESS_GROUP,
- KILL_PROCESS,
- KILL_NONE,
- _KILL_MODE_MAX,
- _KILL_MODE_INVALID = -1
-} KillMode;
-
enum UnitType {
UNIT_SERVICE = 0,
UNIT_SOCKET,
diff --git a/src/util.c b/src/util.c
index 7f5fa05..fa3969b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2941,3 +2941,39 @@ static const char* const ip_tos_table[] = {
};
DEFINE_STRING_TABLE_LOOKUP(ip_tos, int);
+
+static const char *const signal_table[] = {
+ [SIGHUP] = "HUP",
+ [SIGINT] = "INT",
+ [SIGQUIT] = "QUIT",
+ [SIGILL] = "ILL",
+ [SIGTRAP] = "TRAP",
+ [SIGABRT] = "ABRT",
+ [SIGBUS] = "BUS",
+ [SIGFPE] = "FPE",
+ [SIGKILL] = "KILL",
+ [SIGUSR1] = "USR1",
+ [SIGSEGV] = "SEGV",
+ [SIGUSR2] = "USR2",
+ [SIGPIPE] = "PIPE",
+ [SIGALRM] = "ALRM",
+ [SIGTERM] = "TERM",
+ [SIGSTKFLT] = "STKFLT",
+ [SIGCHLD] = "CHLD",
+ [SIGCONT] = "CONT",
+ [SIGSTOP] = "STOP",
+ [SIGTSTP] = "TSTP",
+ [SIGTTIN] = "TTIN",
+ [SIGTTOU] = "TTOU",
+ [SIGURG] = "URG",
+ [SIGXCPU] = "XCPU",
+ [SIGXFSZ] = "XFSZ",
+ [SIGVTALRM] = "VTALRM",
+ [SIGPROF] = "PROF",
+ [SIGWINCH] = "WINCH",
+ [SIGIO] = "IO",
+ [SIGPWR] = "PWR",
+ [SIGSYS] = "SYS"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(signal, int);
diff --git a/src/util.h b/src/util.h
index 1a4c440..f1cd080 100644
--- a/src/util.h
+++ b/src/util.h
@@ -353,4 +353,7 @@ int rlimit_from_string(const char *s);
const char *ip_tos_to_string(int i);
int ip_tos_from_string(const char *s);
+const char *signal_to_string(int i);
+int signal_from_string(const char *s);
+
#endif
commit 73c33e7f225f81e6066386fba997e8ea2ba361b3
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 10 04:46:58 2010 +0200
mount: add implicit umount.target conflicts only in system mode
diff --git a/src/automount.c b/src/automount.c
index 26fec45..934aa5f 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -201,7 +201,8 @@ static int automount_load(Unit *u) {
if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0)
return r;
- if (a->meta.default_dependencies)
+ if (a->meta.default_dependencies &&
+ a->meta.manager->running_as == MANAGER_SYSTEM)
if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
return r;
}
diff --git a/src/mount.c b/src/mount.c
index 57c258f..36caae3 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -368,7 +368,9 @@ static int mount_load(Unit *u) {
if ((r = unit_add_default_cgroup(u)) < 0)
return r;
- if (m->meta.default_dependencies && !path_equal(m->where, "/"))
+ if (m->meta.default_dependencies &&
+ m->meta.manager->running_as == MANAGER_SYSTEM &&
+ !path_equal(m->where, "/"))
if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
return r;
}
More information about the systemd-commits
mailing list