From f81c8f7c7117d38a0d47535e07c30744cec867f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 30 May 2017 16:37:53 +0200 Subject: [PATCH] Implement question 6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- TD1/{ => part_one}/Makefile | 0 TD1/{ => part_one}/exo.c | 9 +++++++++ 2 files changed, 9 insertions(+) rename TD1/{ => part_one}/Makefile (100%) rename TD1/{ => part_one}/exo.c (65%) 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; -- 2.34.1