comp.lang.ada
 help / color / mirror / Atom feed
From: mario@klebsch.de (Mario Klebsch)
Subject: Re: fork; execve --> defunct process.
Date: 2000/01/19
Date: 2000-01-19T00:00:00+00:00	[thread overview]
Message-ID: <887568.3hg.ln@ds9.klebsch.de> (raw)
In-Reply-To: 388414AD.E4D4C00D@mail.utexas.edu

"Bobby D. Bryant" <bdbryant@mail.utexas.edu> writes:

>I am trying to get a program to start a second job.  I import fork() and
>execve() from C, and the calls apparently work OK (i.e., the fork
>returns a legitimate PID, and the execve returns a non-negative status).

>However, the child process immediately(?) goes into "defunct" status.
>For example, if I try to run the testgtk program, the program's GUI
>never pops up, and a ps x shows:

>    29765 pts/6    ZN     0:00 [testgtk <defunct>]

It looks like your child process is dying immediately after
execve()ing it. In such situations, I often do change the roles
child&parent. In C there is some code that looks like:

	if ((pid=fork()<0))
	  ErrorHandling();
	if (pid==0)
	  Child();
	else
	  Parent();	

When I change the pid==0 to pid!=0, the parent code is executing in
child context. Not I can start the program using my favourite debugger
and see, where the child is dying.

Since your child process is a separate programm, you could try to
start is manually on the command line. It probably will fail, too. If
not, you probably pass a changed environment to if (different
enviroment variables, different descriptors open, ...).

73, Mario
-- 
Mario Klebsch						mario@klebsch.de




      parent reply	other threads:[~2000-01-19  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-18  0:00 fork; execve --> defunct process Bobby D. Bryant
2000-01-18  0:00 ` Mats Weber
2000-01-18  0:00   ` Bobby D. Bryant
2000-01-19  0:00     ` Mats Weber
2000-01-21  0:00     ` Robert A Duff
2000-01-22  0:00       ` Bobby D. Bryant
2000-01-18  0:00 ` Mats Weber
2000-01-19  0:00 ` Mario Klebsch [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox