Re: How to wait child process termination?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 16, 2005 at 09:15:50PM +0900, Tetsuo Handa wrote:
> I'm trying to create a minimum shell that has almost
> no built-in functions for my kernel patch's demonstration use.
> It doesn't need to handle job controls, redirections etc.
> Just fork(2) and execvp(3) and wait(2) until the execvp'ed
> process terminates.
> 
> The following is a part of the shell program,
> but the wait(2) returns before some program terminates.
> For example,
> (1) invoke /bin/tcsh from this shell
> (2) invoke /bin/ls from tcsh
> (3) exit from tcsh
> returns to this shell after tcsh(1) process terminates, but
> (1) invoke /bin/tcsh from this shell
> (2) invoke /usr/bin/less from tcsh
> returns to this shell before less(1) process terminates.

I don't see why you need tcsh, but anyway...

> I don't want to return to this shell before execvp'ed process terminates.
> Please tell me how to wait(2).

> I don't want to use system(3) nor popen(3), for they needs /bin/sh
> for internal processing.
> 
> I think I need to handle some signal,
> but I can't find an appropriate simple source code.
> Handling only SIGINT SIGQUIT and SIGCHLD are enough?

SIGCHLD should be enough to catch child related signals.

For more information, get "Advanced programming in the Unix
environment" by W. Richard Stevens. Expensive, but worth every
$LOCAL_CURRENCY.


Erik

-- 
Erik Mouw
J.A.K.Mouw@xxxxxxxxxxxxxx  mouw@xxxxxxxxxxxx

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux