X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fservice.c;h=a5d1ebd84b6d780a41cecb0936b9e2da80d544ef;hp=f8b4ff6a246d5c9c5044d2be243513f81f8fa191;hb=92abbefbefb0adafb6714c8d8f9d25bc8280a2f7;hpb=b708e7cea941538bfd5e20ce0a723c19b7da7d1d diff --git a/src/service.c b/src/service.c index f8b4ff6a2..a5d1ebd84 100644 --- a/src/service.c +++ b/src/service.c @@ -1179,6 +1179,11 @@ static void service_set_state(Service *s, ServiceState state) { service_connection_unref(s); } + /* For the inactive states unit_notify() will trim the cgroup, + * but for exit we have to do that ourselves... */ + if (state == SERVICE_EXITED) + cgroup_bonding_trim_list(s->meta.cgroup_bondings, true); + if (old_state != state) log_debug("%s changed %s -> %s", s->meta.id, service_state_to_string(old_state), service_state_to_string(state)); @@ -1841,7 +1846,8 @@ static void service_run_next(Service *s, bool success) { false, !s->permissions_start_only, !s->root_directory_start_only, - false, + s->control_command_id == SERVICE_EXEC_START_PRE || + s->control_command_id == SERVICE_EXEC_STOP_POST, false, &s->control_pid)) < 0) goto fail; @@ -1890,6 +1896,14 @@ static int service_start(Unit *u) { return -ECANCELED; } + if ((s->exec_context.std_input == EXEC_INPUT_SOCKET || + s->exec_context.std_output == EXEC_OUTPUT_SOCKET || + s->exec_context.std_error == EXEC_OUTPUT_SOCKET) && + s->socket_fd < 0) { + log_warning("%s can only be started with a per-connection socket.", u->meta.id); + return -EINVAL; + } + s->failure = false; s->main_pid_known = false; s->allow_restart = true; @@ -2185,7 +2199,8 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { success = true; } - log_debug("%s: main process exited, code=%s, status=%i", u->meta.id, sigchld_code_to_string(code), status); + log_full(success ? LOG_DEBUG : LOG_NOTICE, + "%s: main process exited, code=%s, status=%i", u->meta.id, sigchld_code_to_string(code), status); s->failure = s->failure || !success; /* The service exited, so the service is officially @@ -2242,7 +2257,8 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { s->control_pid = 0; - log_debug("%s: control process exited, code=%s status=%i", u->meta.id, sigchld_code_to_string(code), status); + log_full(success ? LOG_DEBUG : LOG_NOTICE, + "%s: control process exited, code=%s status=%i", u->meta.id, sigchld_code_to_string(code), status); s->failure = s->failure || !success; /* If we are shutting things down anyway we @@ -2462,7 +2478,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) { s->state == SERVICE_RELOAD)) { if (parse_pid(e + 8, &pid) < 0) - log_warning("Failed to parse %s", e); + log_warning("Failed to parse notification message %s", e); else { log_debug("%s: got %s", u->meta.id, e); service_set_main_pid(s, pid);