Implement question 6
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 30 May 2017 14:37:53 +0000 (16:37 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 30 May 2017 14:37:53 +0000 (16:37 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TD1/part_one/Makefile [moved from TD1/Makefile with 100% similarity]
TD1/part_one/exo.c [moved from TD1/exo.c with 65% similarity]

similarity index 100%
rename from TD1/Makefile
rename to TD1/part_one/Makefile
similarity index 65%
rename from TD1/exo.c
rename to TD1/part_one/exo.c
index 237c2d6c29086f2a0c1e9ae5d8c588629cb6b342..3eeb4c4bfd73d62519f672161db66df9463b8fc0 100644 (file)
--- a/TD1/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;