From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d66c9f9cb6b86f72 X-Google-Attributes: gid103376,public From: mario@klebsch.de (Mario Klebsch) Subject: Re: fork; execve --> defunct process. Date: 2000/01/19 Message-ID: <887568.3hg.ln@ds9.klebsch.de>#1/1 X-Deja-AN: 574990599 References: <388414AD.E4D4C00D@mail.utexas.edu> Organization: IRD InterNet Services GmbH Newsgroups: comp.lang.ada Date: 2000-01-19T00:00:00+00:00 List-Id: "Bobby D. Bryant" 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 ] 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