service: use the right timeout for stop processes we fork
This commit is contained in:
parent
f461c8073d
commit
21b2ce39d4
|
@ -862,7 +862,7 @@ fail:
|
||||||
static int service_spawn(
|
static int service_spawn(
|
||||||
Service *s,
|
Service *s,
|
||||||
ExecCommand *c,
|
ExecCommand *c,
|
||||||
bool timeout,
|
usec_t timeout,
|
||||||
bool pass_fds,
|
bool pass_fds,
|
||||||
bool apply_permissions,
|
bool apply_permissions,
|
||||||
bool apply_chroot,
|
bool apply_chroot,
|
||||||
|
@ -907,8 +907,8 @@ static int service_spawn(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout && s->timeout_start_usec > 0) {
|
if (timeout > 0) {
|
||||||
r = service_arm_timer(s, s->timeout_start_usec);
|
r = service_arm_timer(s, timeout);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
} else
|
} else
|
||||||
|
@ -1108,7 +1108,7 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
|
||||||
|
|
||||||
r = service_spawn(s,
|
r = service_spawn(s,
|
||||||
s->control_command,
|
s->control_command,
|
||||||
true,
|
s->timeout_stop_usec,
|
||||||
false,
|
false,
|
||||||
!s->permissions_start_only,
|
!s->permissions_start_only,
|
||||||
!s->root_directory_start_only,
|
!s->root_directory_start_only,
|
||||||
|
@ -1207,7 +1207,7 @@ static void service_enter_stop(Service *s, ServiceResult f) {
|
||||||
|
|
||||||
r = service_spawn(s,
|
r = service_spawn(s,
|
||||||
s->control_command,
|
s->control_command,
|
||||||
true,
|
s->timeout_stop_usec,
|
||||||
false,
|
false,
|
||||||
!s->permissions_start_only,
|
!s->permissions_start_only,
|
||||||
!s->root_directory_start_only,
|
!s->root_directory_start_only,
|
||||||
|
@ -1270,7 +1270,7 @@ static void service_enter_start_post(Service *s) {
|
||||||
|
|
||||||
r = service_spawn(s,
|
r = service_spawn(s,
|
||||||
s->control_command,
|
s->control_command,
|
||||||
true,
|
s->timeout_start_usec,
|
||||||
false,
|
false,
|
||||||
!s->permissions_start_only,
|
!s->permissions_start_only,
|
||||||
!s->root_directory_start_only,
|
!s->root_directory_start_only,
|
||||||
|
@ -1334,8 +1334,7 @@ static void service_enter_start(Service *s) {
|
||||||
|
|
||||||
r = service_spawn(s,
|
r = service_spawn(s,
|
||||||
c,
|
c,
|
||||||
s->type == SERVICE_FORKING || s->type == SERVICE_DBUS ||
|
IN_SET(s->type, SERVICE_FORKING, SERVICE_DBUS, SERVICE_NOTIFY, SERVICE_ONESHOT) ? s->timeout_start_usec : 0,
|
||||||
s->type == SERVICE_NOTIFY || s->type == SERVICE_ONESHOT,
|
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
@ -1401,7 +1400,7 @@ static void service_enter_start_pre(Service *s) {
|
||||||
|
|
||||||
r = service_spawn(s,
|
r = service_spawn(s,
|
||||||
s->control_command,
|
s->control_command,
|
||||||
true,
|
s->timeout_start_usec,
|
||||||
false,
|
false,
|
||||||
!s->permissions_start_only,
|
!s->permissions_start_only,
|
||||||
!s->root_directory_start_only,
|
!s->root_directory_start_only,
|
||||||
|
@ -1482,7 +1481,7 @@ static void service_enter_reload(Service *s) {
|
||||||
|
|
||||||
r = service_spawn(s,
|
r = service_spawn(s,
|
||||||
s->control_command,
|
s->control_command,
|
||||||
true,
|
s->timeout_start_usec,
|
||||||
false,
|
false,
|
||||||
!s->permissions_start_only,
|
!s->permissions_start_only,
|
||||||
!s->root_directory_start_only,
|
!s->root_directory_start_only,
|
||||||
|
@ -1519,7 +1518,7 @@ static void service_run_next_control(Service *s) {
|
||||||
|
|
||||||
r = service_spawn(s,
|
r = service_spawn(s,
|
||||||
s->control_command,
|
s->control_command,
|
||||||
true,
|
IN_SET(s->state, SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD) ? s->timeout_start_usec : s->timeout_stop_usec,
|
||||||
false,
|
false,
|
||||||
!s->permissions_start_only,
|
!s->permissions_start_only,
|
||||||
!s->root_directory_start_only,
|
!s->root_directory_start_only,
|
||||||
|
@ -1563,7 +1562,7 @@ static void service_run_next_main(Service *s) {
|
||||||
|
|
||||||
r = service_spawn(s,
|
r = service_spawn(s,
|
||||||
s->main_command,
|
s->main_command,
|
||||||
true,
|
s->timeout_start_usec,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
|
Loading…
Reference in a new issue