repositories
/
TD_IML.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Give more explicit name to PID variables
[TD_IML.git]
/
TD1
/
part_one
/
exo.c
diff --git
a/TD1/part_one/exo.c
b/TD1/part_one/exo.c
index 3eeb4c4bfd73d62519f672161db66df9463b8fc0..2ace704e3db23f3a9cccee1f5da3fd97c2e9ca1d 100644
(file)
--- a/
TD1/part_one/exo.c
+++ b/
TD1/part_one/exo.c
@@
-18,19
+18,20
@@
int main() {
printf("Courant:\n");
show_proc_pids();
printf("Courant:\n");
show_proc_pids();
- pid_t
rtf
= fork();
+ pid_t
cpid
= fork();
- if (
rtf
== -1) {
+ if (
cpid
== -1) {
printf("Erreur de clonage\n");
exit(EXIT_FAILURE);
printf("Erreur de clonage\n");
exit(EXIT_FAILURE);
- } else if (
rtf
== 0) {
+ } else if (
cpid
== 0) {
printf("Fils:\n");
show_proc_pids();
exit(EXIT_FAILURE);
} else {
printf("Parent:\n");
show_proc_pids();
printf("Fils:\n");
show_proc_pids();
exit(EXIT_FAILURE);
} else {
printf("Parent:\n");
show_proc_pids();
- pid_t rtw = wait(&status);
+ pid_t wpid = wait(&status);
+ printf("Fin du PID: %d\n", wpid);
system("ps aux");
if (WIFEXITED(status)) {
printf("Fils termine, status=%d\n", WEXITSTATUS(status));
system("ps aux");
if (WIFEXITED(status)) {
printf("Fils termine, status=%d\n", WEXITSTATUS(status));