[systemd-commits] 2 commits - src/service.c src/target.c units/halt.target units/poweroff.target units/reboot.target units/shutdown.target

Lennart Poettering lennart at kemper.freedesktop.org
Thu Sep 2 16:43:11 PDT 2010


 src/service.c         |    7 +++++++
 src/target.c          |    3 ++-
 units/halt.target     |    1 +
 units/poweroff.target |    1 +
 units/reboot.target   |    1 +
 units/shutdown.target |    1 +
 6 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit b401e1fb9df7ea8b0fd26e16d886056a5ae7c5d9
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 3 01:42:19 2010 +0200

    target: implicitly shutdown targets on shutdown, so that they are pulled into the final transaction and may be used for synchronization

diff --git a/src/target.c b/src/target.c
index c350d8f..1118693 100644
--- a/src/target.c
+++ b/src/target.c
@@ -75,7 +75,8 @@ static int target_add_default_dependencies(Target *t) {
                         if ((r = unit_add_dependency(UNIT(t), UNIT_AFTER, other, true)) < 0)
                                 return r;
 
-        return 0;
+        /* Make sure targets are unloaded on shutdown */
+        return unit_add_dependency_by_name(UNIT(t), UNIT_CONFLICTED_BY, SPECIAL_SHUTDOWN_TARGET, NULL, true);
 }
 
 static int target_add_getty_dependencies(Target *t) {
diff --git a/units/halt.target b/units/halt.target
index 70e90fe..04b42cd 100644
--- a/units/halt.target
+++ b/units/halt.target
@@ -9,6 +9,7 @@
 
 [Unit]
 Description=Halt
+DefaultDependencies=no
 Requires=halt.service
 After=halt.service
 AllowIsolate=yes
diff --git a/units/poweroff.target b/units/poweroff.target
index cb94606..975b088 100644
--- a/units/poweroff.target
+++ b/units/poweroff.target
@@ -9,6 +9,7 @@
 
 [Unit]
 Description=Power-Off
+DefaultDependencies=no
 Names=runlevel0.target
 Requires=poweroff.service
 After=poweroff.service
diff --git a/units/reboot.target b/units/reboot.target
index 8557513..2cd46a0 100644
--- a/units/reboot.target
+++ b/units/reboot.target
@@ -9,6 +9,7 @@
 
 [Unit]
 Description=Reboot
+DefaultDependencies=no
 Names=runlevel6.target
 Requires=reboot.service
 After=reboot.service
diff --git a/units/shutdown.target b/units/shutdown.target
index 6d1fb6f..4db9f1f 100644
--- a/units/shutdown.target
+++ b/units/shutdown.target
@@ -9,5 +9,6 @@
 
 [Unit]
 Description=Shutdown
+DefaultDependencies=no
 RefuseManualStart=yes
 IgnoreDependencyFailure=yes
commit 7f97f0fee46ae167c27c5be21ee0caddacbc6bf9
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Sep 3 01:41:40 2010 +0200

    service: properly handle if the main process is down and we wait for the cgroup to die, too

diff --git a/src/service.c b/src/service.c
index fabb71c..94f2f37 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2579,6 +2579,13 @@ static void service_cgroup_notify_event(Unit *u) {
 
                 break;
 
+        case SERVICE_FINAL_SIGTERM:
+        case SERVICE_FINAL_SIGKILL:
+                if (main_pid_good(s) <= 0 && !control_pid_good(s))
+                        service_enter_dead(s, true, true);
+
+                break;
+
         default:
                 ;
         }


More information about the systemd-commits mailing list