J'ai un processus enfant qui tourne en avant-plan et son père est déjà sorti.
le site proc/$pid/stat
le fichier ne contient plus le pid du parent si le parent est déjà sorti et il affiche 1 au lieu du pid du parent d'origine
linux$cat /proc/6267/stat
6267 (test3.sh) S 1 6265 ......
# ^
# |
# I expected to get the origin parent pid but I get 1
Pour reproduire rapidement ce comportement, nous pouvons utiliser les scripts suivants
test2.sh
#!/bin/sh
echo "test2=$$"
./test3.sh &
test3.sh
#!/bin/sh
echo "test3=$$"
sleep 1000
exécution :
linux$ ./test2.sh
test2=6318
test3=6319
linux$ ps aux | grep test
6319 root 1484 S {test3.sh} /bin/sh ./test3.sh
linux$ cat /proc/6319/stat
6319 (test3.sh) S 1 6318 2138 34816 6.......