From: Jérôme Benoit Date: Tue, 30 May 2017 14:37:53 +0000 (+0200) Subject: Implement question 6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f81c8f7c7117d38a0d47535e07c30744cec867f4;p=TD_IML.git Implement question 6 Signed-off-by: Jérôme Benoit --- diff --git a/TD1/Makefile b/TD1/part_one/Makefile similarity index 100% rename from TD1/Makefile rename to TD1/part_one/Makefile diff --git a/TD1/exo.c b/TD1/part_one/exo.c similarity index 65% rename from TD1/exo.c rename to TD1/part_one/exo.c index 237c2d6..3eeb4c4 100644 --- a/TD1/exo.c +++ b/TD1/part_one/exo.c @@ -32,6 +32,15 @@ int main() { show_proc_pids(); pid_t rtw = wait(&status); system("ps aux"); + if (WIFEXITED(status)) { + printf("Fils termine, status=%d\n", WEXITSTATUS(status)); + } else if (WIFSIGNALED(status)) { + printf("Fils tue par un signal %d\n", WTERMSIG(status)); + } else if (WIFSTOPPED(status)) { + printf("Fils stoppe par un signal %d\n", WSTOPSIG(status)); + } else if (WIFCONTINUED(status)) { + printf("Fils continue\n"); + } } return EXIT_SUCCESS;