X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fservice.c;h=d11de79a50de2f4024ce22eaf307c32ca66c1a08;hb=eb9da376d76b48585b3b63b4f91903b54f7abd36;hp=67920248d3b10cb7ff04c2d52b6e7455cacc6902;hpb=7400b9d2e99938d17b281d7df43680eade18666e;p=elogind.git diff --git a/src/core/service.c b/src/core/service.c index 67920248d..d11de79a5 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -124,9 +124,9 @@ static void service_init(Unit *u) { assert(u); assert(u->load_state == UNIT_STUB); - s->timeout_start_usec = DEFAULT_TIMEOUT_USEC; - s->timeout_stop_usec = DEFAULT_TIMEOUT_USEC; - s->restart_usec = DEFAULT_RESTART_USEC; + s->timeout_start_usec = u->manager->default_timeout_start_usec; + s->timeout_stop_usec = u->manager->default_timeout_stop_usec; + s->restart_usec = u->manager->default_restart_usec; s->type = _SERVICE_TYPE_INVALID; watch_init(&s->watchdog_watch); @@ -1056,48 +1056,6 @@ static int service_load_sysv(Service *s) { } #endif -static int fsck_fix_order(Service *s) { - Unit *other; - int r; - - assert(s); - - if (s->fsck_passno <= 0) - return 0; - - /* For each pair of services where both have an fsck priority - * we order things based on it. */ - - LIST_FOREACH(units_by_type, other, UNIT(s)->manager->units_by_type[UNIT_SERVICE]) { - Service *t; - UnitDependency d; - - t = SERVICE(other); - - if (s == t) - continue; - - if (UNIT(t)->load_state != UNIT_LOADED) - continue; - - if (t->fsck_passno <= 0) - continue; - - if (t->fsck_passno < s->fsck_passno) - d = UNIT_AFTER; - else if (t->fsck_passno > s->fsck_passno) - d = UNIT_BEFORE; - else - continue; - - r = unit_add_dependency(UNIT(s), d, UNIT(t), true); - if (r < 0) - return r; - } - - return 0; -} - static int service_verify(Service *s) { assert(s); @@ -1254,10 +1212,6 @@ static int service_load(Unit *u) { return r; #endif - r = fsck_fix_order(s); - if (r < 0) - return r; - if (s->bus_name) if ((r = unit_watch_bus_name(u, s->bus_name)) < 0) return r; @@ -1381,11 +1335,6 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) { prefix, s->sysv_runlevels); #endif - if (s->fsck_passno > 0) - fprintf(f, - "%sFsckPassNo: %i\n", - prefix, s->fsck_passno); - if (s->status_text) fprintf(f, "%sStatus Text: %s\n", prefix, s->status_text); @@ -2651,6 +2600,9 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) { if (s->exec_context.var_tmp_dir) unit_serialize_item(u, f, "var-tmp-dir", s->exec_context.var_tmp_dir); + if (s->forbid_restart) + unit_serialize_item(u, f, "forbid-restart", yes_no(s->forbid_restart)); + return 0; } @@ -2787,6 +2739,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value, return log_oom(); s->exec_context.var_tmp_dir = t; + } else if (streq(key, "forbid-restart")) { + int b; + + b = parse_boolean(value); + if (b < 0) + log_debug_unit(u->id, "Failed to parse forbid-restart value %s", value); + else + s->forbid_restart = b; } else log_debug_unit(u->id, "Unknown serialization key '%s'", key);