From 70e46dcd4bd0e7b762557febc1f7c1a813bc0cfc Mon Sep 17 00:00:00 2001 From: Tomoki Shirasawa Date: Fri, 26 Jul 2013 13:14:39 +0900 Subject: [PATCH] mcexec print signum or exit status --- executer/user/mcexec.c | 8 ++++++++ kernel/syscall.c | 1 + 2 files changed, 9 insertions(+) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 4b297101..c0ff8cc9 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -610,6 +610,14 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock) __dprintf("__NR_exit/__NR_exit_group: %ld (cpu_id: %d)\n", w.sr.args[0], cpu); + if(w.sr.number == __NR_exit_group){ + int sig = w.sr.args[0] & 0x7f; + int term = (w.sr.args[0] & 0xff00) >> 8; + if(sig) + fprintf(stderr, "Terminate by signal %d\n", sig); + else if(term) + fprintf(stderr, "Exit status: %d\n", term); + } #ifdef USE_SYSCALL_MOD_CALL #ifdef CMD_DCFA diff --git a/kernel/syscall.c b/kernel/syscall.c index b213d017..68b2d5cb 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -154,6 +154,7 @@ terminate(int rc, int sig, ihk_mc_user_context_t *ctx) struct process *proc = cpu_local_var(current); request.number = __NR_exit_group; + request.args[0] = ((rc & 0x00ff) << 8) | (sig & 0x7f); #ifdef DCFA_KMOD do_mod_exit(rc);