Visit Our UNIX and Linux User Community

handling abnormal process termination

Thread Tools Search this Thread
Top Forums Programming handling abnormal process termination
# 1  
Old 01-10-2006
handling abnormal process termination


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:


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

# 2  
Old 01-10-2006
The macro

will return the signal the child process handled.
# 3  
Old 01-12-2006
Try This

Thanks for the ftp C reply,
May be you could try this to track all the child process


static void handle_child_process(int sig)
/* this will print all the child proccess status code termination values */
int 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);

it is

do something like this
# 4  
Old 01-13-2006
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.

not sure if it applies to your ux version. but good info tho
# 5  
Old 01-16-2006
Originally Posted by cjediknight
static void handle_child_process(int sig)
/* this will print all the child proccess status code termination values */
int stat;
i am afraid that the above statement would print
only the PIDS of the child process that are terminated and not the exit status of the child process.

int stat;

Previous Thread | Next Thread
Test Your Knowledge in Computers #141
Difficulty: Easy
The original Unix operating system was not written in assembly language.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Is orphan process handling by Solaris os and Linux os same?

In solaris, orphan process is put to sleep mode and does not consume any CPU resources. In Linux, orphan process is kept in running state consuming all CPU and Ram resources. Is it the case? Is there a difference on how these operating systems will handle orphan processes? The route cause of... (10 Replies)
Discussion started by: Belure Pooja B
10 Replies

2. UNIX for Dummies Questions & Answers

Getting rid of abnormal Characters

i'm grepping for words in the /var/adm/messages (sun solaris). but it looks like while my grepping finds the strings, when it outputs them out, the beginning of some lines are chopped off. Jun 13 14:06:02 ufs: NOTICE: alloc: /prod: file system full 3 14:39:19 ufs: NOTICE:... (1 Reply)
Discussion started by: SkySmart
1 Replies

3. Shell Programming and Scripting

Getting rid of abnormal Characters

ok, so i have no clue why this script i wrote spits out these bizarre characters: i cant even copy and paste those characters on here because it just doesn't show up properly. my question is, using sed, how can i get rid of all characters that aren't normal? echo "abnormal characters" |... (4 Replies)
Discussion started by: SkySmart
4 Replies

4. UNIX for Advanced & Expert Users

Abnormal behaviour of Defuncts

Hi, I am facing problems with defunct processes. The problem is, the defuncts are being created and getting dissappeared by themselves. I have a process that calls some scripts through a specified port, when this scripts starts executing, the defuncts also started to appear(lots and lots, will... (1 Reply)
Discussion started by: reddybs
1 Replies

5. Red Hat

Zombie Process Termination Time

Hey, I've got a program that fork's a list of child processes, and keeps their pid's in a list. After the parent finishes it's main business logic, it needs to check which child already finished - and when. Is it possible - using waitpid or any other func\syscall - get this information... (0 Replies)
Discussion started by: sternr
0 Replies

6. HP-UX

abnormal process HPUX

i am using HP-UX and i have this process called HPUX childwrapper taking about 99% cpu.i want to know what the process does? and if i should kill it (4 Replies)
Discussion started by: tomjones
4 Replies

7. Shell Programming and Scripting

zombie processes and hung process termination

Is there a way I can run a command that will run in the kernel or in the memory and automatically kill certain scripts if they get to <defunct> processes, without having to be monitoring the server manually? I have a Perl script which runs for 20k members and normally does not have any problems,... (2 Replies)
Discussion started by: ukndoit
2 Replies

8. Filesystems, Disks and Memory

Abnormal Inact Memory

Hello, have a look my top and ps as below Inact memory reach 1.6G, does it normal ? load averages: 0.07, 0.02, 0.01; up 7+06:48:52 02:58:01 91 processes: 2 running, 89 sleeping CPU states: 0.0% user, 0.0% nice, 0.4% system, 0.0% interrupt, 99.6% idle Memory: 24M... (0 Replies)
Discussion started by: jipznet1981
0 Replies

9. HP-UX

Inter Process File Handling Problem

Hi All, i am running a oracle procedure which writes a file . The same file is picked up by another script which runs in a cron after every 5 minutes. Now the problem is that sometimes my script picks up a file while the procedure is still writing data in the file. is there is any way i... (4 Replies)
Discussion started by: saurabhjain
4 Replies

10. UNIX for Dummies Questions & Answers

Abnormal Termination errors

I'm having trouble with Abnormal Termination errors. What are they, what causes them and how can I prevent them from happening? Are they application specific? (2 Replies)
Discussion started by: bialsibub
2 Replies

Featured Tech Videos