![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| zombie processes and hung process termination | ukndoit | Shell Programming and Scripting | 2 | 03-13-2008 10:53 PM |
| NOTICE:u79n:Abnormal interrupt! int_status=FC67C0D0 | fadil | Filesystems, Disks and Memory | 1 | 04-10-2007 07:53 AM |
| Abnormal Inact Memory | jipznet1981 | Filesystems, Disks and Memory | 0 | 06-22-2006 12:01 PM |
| Inter Process File Handling Problem | saurabhjain | HP-UX | 4 | 05-12-2005 08:49 AM |
| Abnormal Termination errors | bialsibub | UNIX for Dummies Questions & Answers | 2 | 11-14-2001 07:21 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
handling abnormal process termination
hi
i m writin a program in which i keep track of all the child processes the program has generated and if a child process has an abnormal termination i need to do certain task related to that child process. for handlin child process i used waitpid: temp_cpid=waitpid(-1,&stat,WUNTRACED); during normal termination temp_cpid return the pid of the terminated child process but in case of abnormal termination it returns -1 so hoe to determine the pid of the abnormally terminated process? ny help will b appreciated thanx |
| Forum Sponsor | ||
|
|
|
|||
|
Try This
Hi,
Thanks for the ftp C reply, May be you could try this to track all the child process #include<signal.h> static void handle_child_process(int sig) { /* this will print all the child proccess status code termination values */ int stat; printf("%d",wait(&stat)); } int main() { struct sigaction child_signal; memset(&chld_signal, 0, sizeof(struct sigaction)); child_signal.sa_handler = &handle_child_process; sigaction(SIGCHLD, &child_signal, 0); /* your code here wahtever it is */ exit(EXIT_SUCCESS); } /* do something like this */ |
|
||||
|
Hi Mridula,
basically SIGCHLD is the signal that is generated as a result of termination of the child process. so you should bt looking to handle that i got this nice info after some google. http://www.wlug.org.nz/SIGCHLD not sure if it applies to your ux version. but good info tho
__________________
War doesnt determine who is right, it determines who is left |
|
|||
|
Quote:
only the PIDS of the child process that are terminated and not the exit status of the child process. Code:
int stat;
printf("%d",wait(&stat));
printf("%d",stat);
|
|||
| Google The UNIX and Linux Forums |