Guest_imported
New member
- Jan 1, 1970
- 0
I am new to C programming. I have two questions.
I am writing a program which is forked at some pont. Before the fork was included in the program, I was able to see the program running by issuing a "ps ax -l" in my linux system. Since I have included the fork in the program I am not able to list it running, only able to get the PID by using the "pidof ..." command. Why?
Also how can I kill the Forks after they finished, so only one PID is shown when "pidof programname" entered?
This is the Fork part:
switch (pid = fork()) {
case -1:
perror("Fork Failed"
;
break;
case 0:
/* program */
}
close(sock1);
_exit(0);
I am writing a program which is forked at some pont. Before the fork was included in the program, I was able to see the program running by issuing a "ps ax -l" in my linux system. Since I have included the fork in the program I am not able to list it running, only able to get the PID by using the "pidof ..." command. Why?
Also how can I kill the Forks after they finished, so only one PID is shown when "pidof programname" entered?
This is the Fork part:
switch (pid = fork()) {
case -1:
perror("Fork Failed"
break;
case 0:
/* program */
}
close(sock1);
_exit(0);