Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-15-2009, 04:46 PM   #1
LQ Newbie
Registered: Sep 2009
Posts: 8

Rep: Reputation: 0
Kill child process problem. No matter what i try cant stop pid becoming a zombie??

I am trying to Kill a child task and i can not do it without it becomming a zombie.

This is on an embedded platform and the Child process is running MPG321 with the execvp() command.

I tryed everything i could find on the net with no luck. If you could help with this problem and my understanding of why this is occuring that would be most appreciated. Have been stuck with this problem for some months now..

when killing task i get the error number 10 which i think is #define ECHILD 10 /* No child processes */ But i have checked that i am sending kill the correct PID number.??

this is the calling task

				/* Create the pipe. */
				if (pipe(inst->_info_pipe))
					//__SERVERDBG("MP3: Pipe failed");

				/* Create the child process. */

				frk_pid = fork ();

				if (frk_pid == (pid_t) 0)
					/* This is the child process. */
					inst->_SongLen = 0;

					/* set the group (session) id to this process for future killing */



//parent reading from pipe
	inst->_main_thread = frk_pid;

					inst->_info_pipe[1] = -1;

					inst->_current_state = PLAYING;

					int retrys = 0;

					while(inst->_current_state == PLAYING) // wont return from here till song is finished
						char Tmp[50];

						int r = read(inst->_info_pipe[0], Tmp,50);

						if(r > 0)
							retrys = 0;
							inst->ParseOutput(Tmp, r);
							if(retrys == 2)
								//inst->_current_state = STOPPED;

							if(inst->_current_state != PLAYING)
								__SERVERDBG("No longer playing");


//Kill function
void MP3Controller::StopPlayerApp()
	pid_t t = 0;

	if(_main_thread == -1) // not thread running

	//Stop player

	/*if (killpg(_main_thread, SIGINT) == -1)
	//	os::sleep(100);
		//kill(-_main_thread, 2);

	int killReturn = killpg(_main_thread, SIGINT) ;

	if( killReturn == ESRCH)      // pid does not exist
		__SERVERDBG("Group does not exist!");
	else if( killReturn == EPERM) // No permission to send signal
		  __SERVERDBG("No permission to send signal!");
		__SERVERDBG("No problem sending sig!");

	int childExitStatus;

	t = waitpid (_main_thread, &childExitStatus, WNOHANG);

	if (t != _main_thread)
		__SERVERDBG("error %i" , errno);
	//	waitpid (_main_thread, NULL, 0);

	_main_thread = -1;

	// Close pipes
    close(_info_pipe[0]); // shut pipe from MP3 app
    _info_pipe[0] = -1;


Last edited by ajb181; 11-15-2009 at 04:51 PM. Reason: more info
Old 11-15-2009, 05:36 PM   #2
Registered: Oct 2009
Location: Michigan
Distribution: SlackWare 13.37, Android, Slax, Centos 5.9 Final, Centos 6
Posts: 187

Rep: Reputation: 31
What version of linux is this? Is there a way you can change your keyboard layout so that when you press ctrl+alt+del it give you all the running processes so you can make sure you are calling and killing the right pid?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to kill zombie process bharatlalgupta Red Hat 1 06-18-2009 10:17 AM
How to get the PID of the process giving kill signal to a process? hariprd Programming 2 11-27-2008 03:10 AM
How to kill a Child and all its subsequent child process in C shayer009 Programming 3 12-04-2007 12:40 AM
how to kill zombie process mokku Linux - Server 5 10-25-2007 09:21 PM
get the PID of a separate process (no parent-child relationship) arunj Linux - Software 6 02-03-2006 01:50 AM

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration