if (get_parent_of_pid(pid, &ppid) >= 0 && ppid != getpid()) {
log_warning("%s: Supervising process %lu which is not our child. We'll most likely not notice when it exits.",
if (get_parent_of_pid(pid, &ppid) >= 0 && ppid != getpid()) {
log_warning("%s: Supervising process %lu which is not our child. We'll most likely not notice when it exits.",
/* For each pair of services where at least one lacks a LSB
* header, we use the start priority value to order things. */
/* For each pair of services where at least one lacks a LSB
* header, we use the start priority value to order things. */
s->exec_context.std_output = EXEC_OUTPUT_JOURNAL_AND_CONSOLE;
s->exec_context.kill_mode = KILL_PROCESS;
s->exec_context.std_output = EXEC_OUTPUT_JOURNAL_AND_CONSOLE;
s->exec_context.kill_mode = KILL_PROCESS;
r = service_load_sysv_path(s, path);
#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU) || defined(TARGET_ANGSTROM)
r = service_load_sysv_path(s, path);
#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU) || defined(TARGET_ANGSTROM)
/* Try Debian style *.sh source'able init scripts */
strcat(path, ".sh");
r = service_load_sysv_path(s, path);
/* Try Debian style *.sh source'able init scripts */
strcat(path, ".sh");
r = service_load_sysv_path(s, path);
/* Try SUSE style boot.* init scripts */
path = join(*p, "/boot.", name, NULL);
/* Try SUSE style boot.* init scripts */
path = join(*p, "/boot.", name, NULL);
/* Try Frugalware style rc.* init scripts */
path = join(*p, "/rc.", name, NULL);
/* Try Frugalware style rc.* init scripts */
path = join(*p, "/rc.", name, NULL);
- if (s->meta.load_state == UNIT_STUB)
- SET_FOREACH(t, s->meta.names, i) {
- if (t == s->meta.id)
+ if (UNIT(s)->load_state == UNIT_STUB)
+ SET_FOREACH(t, UNIT(s)->names, i) {
+ if (t == UNIT(s)->id)
- log_error("%s has more than one ExecStart setting, which is only allowed for Type=oneshot services. Refusing.", s->meta.id);
+ log_error("%s has more than one ExecStart setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
- log_error("%s has an ExecReload setting, which is not allowed for Type=oneshot services. Refusing.", s->meta.id);
+ log_error("%s has an ExecReload setting, which is not allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
* majority of services. */
/* First, pull in base system */
* majority of services. */
/* First, pull in base system */
if ((r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_BASIC_TARGET, NULL, true)) < 0)
return r;
if ((r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_BASIC_TARGET, NULL, true)) < 0)
return r;
if ((r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SOCKETS_TARGET, NULL, true)) < 0)
return r;
if ((r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SOCKETS_TARGET, NULL, true)) < 0)
return r;
if (s->exec_context.std_error == EXEC_OUTPUT_INHERIT &&
s->exec_context.std_output == EXEC_OUTPUT_INHERIT &&
s->exec_context.std_input == EXEC_INPUT_NULL)
if (s->exec_context.std_error == EXEC_OUTPUT_INHERIT &&
s->exec_context.std_output == EXEC_OUTPUT_INHERIT &&
s->exec_context.std_input == EXEC_INPUT_NULL)
if (s->exec_context.std_output == EXEC_OUTPUT_INHERIT &&
s->exec_context.std_input == EXEC_INPUT_NULL)
if (s->exec_context.std_output == EXEC_OUTPUT_INHERIT &&
s->exec_context.std_input == EXEC_INPUT_NULL)
if ((r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true)) < 0)
return r;
if ((r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true)) < 0)
return r;
path_spec_unwatch(s->pid_file_pathspec, UNIT(s));
path_spec_done(s->pid_file_pathspec);
free(s->pid_file_pathspec);
path_spec_unwatch(s->pid_file_pathspec, UNIT(s));
path_spec_done(s->pid_file_pathspec);
free(s->pid_file_pathspec);
state != SERVICE_STOP_POST &&
state != SERVICE_FINAL_SIGTERM &&
state != SERVICE_FINAL_SIGKILL &&
state != SERVICE_STOP_POST &&
state != SERVICE_FINAL_SIGTERM &&
state != SERVICE_FINAL_SIGKILL &&
service_close_socket_fd(s);
service_connection_unref(s);
}
/* For the inactive states unit_notify() will trim the cgroup,
* but for exit we have to do that ourselves... */
service_close_socket_fd(s);
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 && s->meta.manager->n_reloading <= 0)
- cgroup_bonding_trim_list(s->meta.cgroup_bondings, true);
+ if (state == SERVICE_EXITED && UNIT(s)->manager->n_reloading <= 0)
+ cgroup_bonding_trim_list(UNIT(s)->cgroup_bondings, true);
- log_debug("%s changed %s -> %s", s->meta.id, service_state_to_string(old_state), service_state_to_string(state));
+ log_debug("%s changed %s -> %s", UNIT(s)->id, service_state_to_string(old_state), service_state_to_string(state));
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], !s->reload_failure);
s->reload_failure = false;
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], !s->reload_failure);
s->reload_failure = false;
- s->meta.manager->confirm_spawn,
- s->meta.cgroup_bondings,
- s->meta.cgroup_attributes,
+ UNIT(s)->manager->confirm_spawn,
+ UNIT(s)->cgroup_bondings,
+ UNIT(s)->cgroup_attributes,
- if ((r = cgroup_bonding_kill_list(s->meta.cgroup_bondings, sig, true, pid_set)) < 0) {
+ if ((r = cgroup_bonding_kill_list(UNIT(s)->cgroup_bondings, sig, true, pid_set)) < 0) {
if (r != -EAGAIN && r != -ESRCH && r != -ENOENT)
log_warning("Failed to kill control group: %s", strerror(-r));
} else if (r > 0)
if (r != -EAGAIN && r != -ESRCH && r != -ENOENT)
log_warning("Failed to kill control group: %s", strerror(-r));
} else if (r > 0)
if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL)
service_enter_stop_post(s, false);
if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL)
service_enter_stop_post(s, false);
/* We want to ensure that nobody leaks processes from
* START_PRE here, so let's go on a killing spree, People
* should not spawn long running processes from START_PRE. */
/* We want to ensure that nobody leaks processes from
* START_PRE here, so let's go on a killing spree, People
* should not spawn long running processes from START_PRE. */
- cgroup_bonding_kill_list(s->meta.cgroup_bondings, SIGKILL, true, NULL);
+ cgroup_bonding_kill_list(UNIT(s)->cgroup_bondings, SIGKILL, true, NULL);
/* Before we start anything, let's clear up what might
* be left from previous runs. */
/* Before we start anything, let's clear up what might
* be left from previous runs. */
- cgroup_bonding_kill_list(s->meta.cgroup_bondings, SIGKILL, true, NULL);
+ cgroup_bonding_kill_list(UNIT(s)->cgroup_bondings, SIGKILL, true, NULL);
log_info("Job pending for unit, delaying automatic restart.");
if ((r = unit_watch_timer(UNIT(s), s->restart_usec, &s->timer_watch)) < 0)
log_info("Job pending for unit, delaying automatic restart.");
if ((r = unit_watch_timer(UNIT(s), s->restart_usec, &s->timer_watch)) < 0)
- if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s), JOB_FAIL, false, &error, NULL)) < 0)
+ if ((r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT(s), JOB_FAIL, false, &error, NULL)) < 0)
- log_warning("%s failed to schedule restart job: %s", s->meta.id, bus_error(&error, -r));
+ log_warning("%s failed to schedule restart job: %s", UNIT(s)->id, bus_error(&error, -r));
s->reload_failure = true;
service_enter_running(s, true);
}
s->reload_failure = true;
service_enter_running(s, true);
}
if (s->state == SERVICE_START_PRE)
service_enter_signal(s, SERVICE_FINAL_SIGTERM, false);
if (s->state == SERVICE_START_PRE)
service_enter_signal(s, SERVICE_FINAL_SIGTERM, false);
success = is_clean_exit_lsb(code, status);
else
success = is_clean_exit(code, status);
success = is_clean_exit_lsb(code, status);
else
success = is_clean_exit(code, status);
/* If we were hoping for the daemon to write its PID file,
* we can give up now. */
if (s->pid_file_pathspec) {
/* If we were hoping for the daemon to write its PID file,
* we can give up now. */
if (s->pid_file_pathspec) {
service_unwatch_pid_file(s);
if (s->state == SERVICE_START)
service_enter_signal(s, SERVICE_FINAL_SIGTERM, false);
service_unwatch_pid_file(s);
if (s->state == SERVICE_START)
service_enter_signal(s, SERVICE_FINAL_SIGTERM, false);
- if ((q = cgroup_bonding_kill_list(s->meta.cgroup_bondings, signo, false, pid_set)) < 0)
+ if ((q = cgroup_bonding_kill_list(UNIT(s)->cgroup_bondings, signo, false, pid_set)) < 0)