2013-04-13 13:09:53 +02:00
|
|
|
From: Frederic Crozat <fcrozat@suse.com>
|
|
|
|
Date: Wed, 7 Dec 2011 15:15:07 +0000
|
|
|
|
Subject: remain_after_exit initscript heuristic and add new LSB headers
|
|
|
|
|
|
|
|
Add remain_after_exit heuristic for initscripts and add LSB headers
|
|
|
|
PIDFile: and X-Systemd-RemainAfterExit to control it.
|
|
|
|
|
|
|
|
(bnc#721426) (bnc#727771)
|
|
|
|
---
|
|
|
|
src/core/service.c | 34 ++++++++++++++++++++++++++++++++--
|
|
|
|
src/core/service.h | 1 +
|
|
|
|
2 files changed, 33 insertions(+), 2 deletions(-)
|
|
|
|
|
2013-09-13 09:25:15 +02:00
|
|
|
--- systemd-206_git201308300826.orig/src/core/service.c
|
|
|
|
+++ systemd-206_git201308300826/src/core/service.c
|
2013-04-13 13:09:53 +02:00
|
|
|
@@ -135,6 +135,7 @@ static void service_init(Unit *u) {
|
2011-12-09 15:44:59 +01:00
|
|
|
#ifdef HAVE_SYSV_COMPAT
|
|
|
|
s->sysv_start_priority = -1;
|
|
|
|
s->sysv_start_priority_from_rcnd = -1;
|
|
|
|
+ s->sysv_remain_after_exit_heuristic = true;
|
|
|
|
#endif
|
|
|
|
s->socket_fd = -1;
|
|
|
|
s->guess_main_pid = true;
|
2013-09-13 09:25:15 +02:00
|
|
|
@@ -879,6 +880,34 @@ static int service_load_sysv_path(Servic
|
2012-05-24 14:06:55 +02:00
|
|
|
free(short_description);
|
|
|
|
short_description = d;
|
2011-12-09 15:44:59 +01:00
|
|
|
|
|
|
|
+ } else if (startswith_no_case(t, "PIDFile:")) {
|
|
|
|
+ char *fn;
|
|
|
|
+
|
|
|
|
+ state = LSB;
|
|
|
|
+
|
|
|
|
+ fn = strstrip(t+8);
|
|
|
|
+ if (!path_is_absolute(fn)) {
|
|
|
|
+ log_warning("[%s:%u] PID file not absolute. Ignoring.", path, line);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!(fn = strdup(fn))) {
|
|
|
|
+ r = -ENOMEM;
|
|
|
|
+ goto finish;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ free(s->pid_file);
|
|
|
|
+ s->pid_file = fn;
|
|
|
|
+ s->sysv_remain_after_exit_heuristic = false;
|
2012-02-09 18:04:56 +01:00
|
|
|
+ s->remain_after_exit = false;
|
2011-12-09 15:44:59 +01:00
|
|
|
+ } else if (startswith_no_case(t, "X-Systemd-RemainAfterExit:")) {
|
|
|
|
+ char *j;
|
|
|
|
+
|
|
|
|
+ state = LSB;
|
2012-02-09 18:04:56 +01:00
|
|
|
+ if ((j = strstrip(t+26)) && *j) {
|
|
|
|
+ s->remain_after_exit = parse_boolean(j);
|
|
|
|
+ s->sysv_remain_after_exit_heuristic = false;
|
|
|
|
+ }
|
2012-05-24 14:06:55 +02:00
|
|
|
} else if (state == LSB_DESCRIPTION) {
|
|
|
|
|
|
|
|
if (startswith(l, "#\t") || startswith(l, "# ")) {
|
2013-09-13 09:25:15 +02:00
|
|
|
@@ -929,7 +958,8 @@ static int service_load_sysv_path(Servic
|
2012-02-09 18:04:56 +01:00
|
|
|
|
|
|
|
/* Special setting for all SysV services */
|
|
|
|
s->type = SERVICE_FORKING;
|
|
|
|
- s->remain_after_exit = !s->pid_file;
|
|
|
|
+ if (s->sysv_remain_after_exit_heuristic)
|
|
|
|
+ s->remain_after_exit = !s->pid_file;
|
|
|
|
s->guess_main_pid = false;
|
|
|
|
s->restart = SERVICE_RESTART_NO;
|
|
|
|
s->exec_context.ignore_sigpipe = false;
|
2013-09-13 09:25:15 +02:00
|
|
|
@@ -2102,7 +2132,7 @@ static void service_enter_running(Servic
|
2011-12-09 15:44:59 +01:00
|
|
|
if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) &&
|
|
|
|
(s->bus_name_good || s->type != SERVICE_DBUS)) {
|
|
|
|
#ifdef HAVE_SYSV_COMPAT
|
|
|
|
- if (s->sysv_enabled && !s->pid_file)
|
|
|
|
+ if (s->sysv_enabled && !s->pid_file && s->sysv_remain_after_exit_heuristic)
|
|
|
|
s->remain_after_exit = false;
|
|
|
|
#endif
|
|
|
|
service_set_state(s, SERVICE_RUNNING);
|
2013-09-13 09:25:15 +02:00
|
|
|
--- systemd-206_git201308300826.orig/src/core/service.h
|
|
|
|
+++ systemd-206_git201308300826/src/core/service.h
|
Accepting request 182204 from home:fcrozat:branches:Base:System
- Update to release 205:
+ two new unit types have been introduced:
- Scope units are very similar to service units, however, are
created out of pre-existing processes -- instead of PID 1
forking off the processes.
- Slice units may be used to partition system resources in an
hierarchial fashion and then assign other units to them. By
default there are now three slices: system.slice (for all
system services), user.slice (for all user sessions),
machine.slice (for VMs and containers).
+ new concept of "transient" units, which are created at runtime
using an API and not based on configuration from disk.
+ logind has been updated to make use of scope and slice units to
manage user sessions. Logind will no longer create cgroups
hierchies itself but will relying on PID 1.
+ A new mini-daemon "systemd-machined" has been added which
may be used by virtualization managers to register local
VMs/containers. machinectl tool has been added to query
meta-data from systemd-machined.
+ Low-level cgroup configuration options ControlGroup=,
ControlGroupModify=, ControlGroupPersistent=,
ControlGroupAttribute= have been removed. High-level attribute
settings or slice units should be used instead?
+ A new bus call SetUnitProperties() has been added to alter
various runtime parameters of a unit, including cgroup
parameters. systemctl gained set-properties command to wrap
this call.
+ A new tool "systemd-run" has been added which can be used to
run arbitrary command lines as transient services or scopes,
while configuring a number of settings via the command
OBS-URL: https://build.opensuse.org/request/show/182204
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=412
2013-07-04 17:28:49 +02:00
|
|
|
@@ -177,6 +177,7 @@ struct Service {
|
2012-10-26 14:34:44 +02:00
|
|
|
bool is_sysv:1;
|
2011-12-09 15:44:59 +01:00
|
|
|
bool sysv_has_lsb:1;
|
|
|
|
bool sysv_enabled:1;
|
|
|
|
+ bool sysv_remain_after_exit_heuristic:1;
|
|
|
|
int sysv_start_priority_from_rcnd;
|
|
|
|
int sysv_start_priority;
|
|
|
|
|