From 1d8b11e0fa656b0ee86177b7cd756f5d55e9b4d5 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 9 Jun 2014 02:12:41 +0200 Subject: kernel: put process name in quotes and print exit status and termination signal on crashed processes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mds.c b/src/mds.c index ffe7023..5a204f6 100644 --- a/src/mds.c +++ b/src/mds.c @@ -347,20 +347,25 @@ int spawn_and_respawn_server(int fd) /* Get the current time. (End of child process.) */ time_error |= (monotone(&time_end) < 0); + if (WIFEXITED(status)) + eprintf("`%s' exited with code %i.", master_server, WEXITSTATUS(status)); + else + eprintf("`%s' died by signal %i.", master_server, WTERMSIG(status)); + /* Do not respawn if we could not read the time. */ if (time_error) { perror(*argv); - eprintf("%s died abnormally, not respawning because we could not read the time.", master_server); + eprintf("`%s' died abnormally, not respawning because we could not read the time.", master_server); goto fail; } /* Respawn if the server did not die too fast. */ if (time_end.tv_sec - time_start.tv_sec >= RESPAWN_TIME_LIMIT_SECONDS) - eprintf("%s died abnormally, respawning.", master_server); + eprintf("`%s' died abnormally, respawning.", master_server); else { - eprintf("%s died abnormally, died too fast, not respawning.", master_server); + eprintf("`%s' died abnormally, died too fast, not respawning.", master_server); goto fail; } -- cgit v1.2.3-70-g09d2