X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Fservice.c;h=cf084853743550244ae88e711ecf2d35c67bc086;hp=7f9a53af46413762bd1e73a1b282c1ac85c60e19;hb=e4f44e734c4f397ee5e7ba3270e014a8ae0043dd;hpb=37e2941d144f362c0585974939cf12ad01aa0258 diff --git a/src/core/service.c b/src/core/service.c index 7f9a53af4..cf0848537 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -390,12 +390,6 @@ static int sysv_translate_facility(const char *name, const char *filename, char "mail-transport-agent", SPECIAL_MAIL_TRANSFER_AGENT_TARGET, #endif -#ifdef TARGET_FEDORA - "MTA", SPECIAL_MAIL_TRANSFER_AGENT_TARGET, - "smtpdaemon", SPECIAL_MAIL_TRANSFER_AGENT_TARGET, - "httpd", SPECIAL_HTTP_DAEMON_TARGET, -#endif - #ifdef TARGET_SUSE "smtp", SPECIAL_MAIL_TRANSFER_AGENT_TARGET, #endif @@ -1614,7 +1608,12 @@ static void service_set_state(Service *s, ServiceState state) { cgroup_bonding_trim_list(UNIT(s)->cgroup_bondings, true); if (old_state != state) - log_debug("%s changed %s -> %s", UNIT(s)->id, service_state_to_string(old_state), service_state_to_string(state)); + log_struct(LOG_DEBUG, + "UNIT=%s", UNIT(s)->id, + "MESSAGE=%s changed %s -> %s", UNIT(s)->id, + service_state_to_string(old_state), + service_state_to_string(state), + NULL); unit_notify(UNIT(s), table[old_state], table[state], s->reload_result == SERVICE_SUCCESS); s->reload_result = SERVICE_SUCCESS; @@ -1801,7 +1800,8 @@ static int service_spawn( goto fail; } - if (!(our_env = new0(char*, 4))) { + our_env = new0(char*, 5); + if (!our_env) { r = -ENOMEM; goto fail; } @@ -1824,10 +1824,14 @@ static int service_spawn( goto fail; } - if (!(final_env = strv_env_merge(2, - UNIT(s)->manager->environment, - our_env, - NULL))) { + if (s->meta.manager->running_as != SYSTEMD_SYSTEM) + if (asprintf(our_env + n_env++, "MANAGERPID=%lu", (unsigned long) getpid()) < 0) { + r = -ENOMEM; + goto fail; + } + + final_env = strv_env_merge(2, UNIT(s)->manager->environment, our_env, NULL); + if (!final_env) { r = -ENOMEM; goto fail; } @@ -2943,8 +2947,16 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { f = SERVICE_SUCCESS; } - log_full(f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE, - "%s: main process exited, code=%s, status=%i", u->id, sigchld_code_to_string(code), status); + log_struct(f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE, + "MESSAGE=%s: main process exited, code=%s, status=%i/%s", + u->id, sigchld_code_to_string(code), status, + strna(code == CLD_EXITED + ? exit_status_to_string(status, EXIT_STATUS_FULL) + : signal_to_string(status)), + "UNIT=%s", u->id, + "EXIT_CODE=%s", sigchld_code_to_string(code), + "EXIT_STATUS=%i", status, + NULL); if (f != SERVICE_SUCCESS) s->result = f;