diff options
| author | Colin Cross <ccross@android.com> | 2013-06-24 15:24:57 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-06-24 15:24:57 -0700 |
| commit | 39021a48a0e0687c654423acd5a4c99a1d79440d (patch) | |
| tree | a125c2a2d51ae9c5416a6a516dcbff8cc4085587 /init/signal_handler.c | |
| parent | a44c31cc91bce7124e896adb072a10f2740a96b4 (diff) | |
| parent | 83ada447aed69dfcd0a88e952eced8db1e4d6584 (diff) | |
| download | system_core-39021a48a0e0687c654423acd5a4c99a1d79440d.zip system_core-39021a48a0e0687c654423acd5a4c99a1d79440d.tar.gz system_core-39021a48a0e0687c654423acd5a4c99a1d79440d.tar.bz2 | |
am 83ada447: Merge changes Ib54f39fd,I7e36edd8
* commit '83ada447aed69dfcd0a88e952eced8db1e4d6584':
init: Retain traditional restart behavior for critical and oneshot services.
init: Safely restart services to avoid race conditions.
Diffstat (limited to 'init/signal_handler.c')
| -rw-r--r-- | init/signal_handler.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/init/signal_handler.c b/init/signal_handler.c index abccb40..d31ad63 100644 --- a/init/signal_handler.c +++ b/init/signal_handler.c @@ -63,7 +63,7 @@ static int wait_for_one_process(int block) NOTICE("process '%s', pid %d exited\n", svc->name, pid); - if (!(svc->flags & SVC_ONESHOT)) { + if (!(svc->flags & SVC_ONESHOT) || (svc->flags & SVC_RESTART)) { kill(-pid, SIGKILL); NOTICE("process '%s' killing any children in process group\n", svc->name); } @@ -78,8 +78,9 @@ static int wait_for_one_process(int block) svc->pid = 0; svc->flags &= (~SVC_RUNNING); - /* oneshot processes go into the disabled state on exit */ - if (svc->flags & SVC_ONESHOT) { + /* oneshot processes go into the disabled state on exit, + * except when manually restarted. */ + if ((svc->flags & SVC_ONESHOT) && !(svc->flags & SVC_RESTART)) { svc->flags |= SVC_DISABLED; } @@ -90,7 +91,7 @@ static int wait_for_one_process(int block) } now = gettime(); - if (svc->flags & SVC_CRITICAL) { + if ((svc->flags & SVC_CRITICAL) && !(svc->flags & SVC_RESTART)) { if (svc->time_crashed + CRITICAL_CRASH_WINDOW >= now) { if (++svc->nr_crashed > CRITICAL_CRASH_THRESHOLD) { ERROR("critical process '%s' exited %d times in %d minutes; " @@ -105,6 +106,7 @@ static int wait_for_one_process(int block) } } + svc->flags &= (~SVC_RESTART); svc->flags |= SVC_RESTARTING; /* Execute all onrestart commands for this service. */ |
