X-Git-Url: https://git.piment-noir.org/?p=TD_IML.git;a=blobdiff_plain;f=TD1%2Fpart_one%2Fexo.c;fp=TD1%2Fexo.c;h=3eeb4c4bfd73d62519f672161db66df9463b8fc0;hp=237c2d6c29086f2a0c1e9ae5d8c588629cb6b342;hb=f81c8f7c7117d38a0d47535e07c30744cec867f4;hpb=9a6251d3c0f454f46a1444e4bab375ab2210b986 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;