Results 1 to 2 of 2
hello
i need some help with my program. here is the code i can't figure out:
Code:
int main() {
...
if ((pid[1] = fork()) == 0) {
printf("Running...");
system("<run ...
- 07-26-2008 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 2
child process
hello
i need some help with my program. here is the code i can't figure out:
child doesn't seem to end with kill(). at the end of program i get this on output:Code:int main() { ... if ((pid[1] = fork()) == 0) { printf("Running..."); system("<run some infinite program>"); exit(0); } ... kill(pid[1], 9); wait(NULL); return 0; }
what i don't understand is how to run infinite program as a child process and then end it clean with parent without any messages? thanks for your help.Code:... some program output... sh: line 1: <pid> Terminated <child program>
btw, im using arch. on ubuntu, the "Terminated" message doesn't show up.
- 07-28-2008 #2Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Make the child process fork() again and get it to write its PID into a known file. The parent can reap its child and kill the grandchild but sending the signal to the PID read from the file.


Reply With Quote