Re: XForms: forking a child

Tristan Savatier (tristan@bok.net)
Thu, 28 May 1998 19:30:34 -0700

# To subscribers of the xforms list from Tristan Savatier <tristan@bok.net> :

AMIT BHATNAGAR wrote:
>
> # To subscribers of the xforms list from AMIT BHATNAGAR <amit@cs.dal.ca> :
>
> On Thu, 28 May 1998, Tristan Savatier wrote:
>
> > # To subscribers of the xforms list from Tristan Savatier <tristan@bok.net> :
> >
> > Another similar example is the MpegTV Player (mtv/mtvp).
>
> > The front-end (mtv) implements the GUI with Xforms.
> > The actual work of playing the MPEG stream is done by
>
> I have the source... but I can't seem to find where you actually fork()
> and exec mtvp. I have looked in mtv.c.... I figured thats where you would
> make the calls..
>
> or am I a dummy and just can't see? ;)

The fork is done in the call g2a_init().

The code of g2a_init() is provided only in object format,
but it contains something like:

int
g2a_init(
[...]
)
{
pid_t player_pid; /* pid of player process */

/* first, open the communication pipes */
[...]

/* second, fork a child process */
player_pid = fork();

if (player_pid == -1) {
return -1;
}

if (player_pid == 0) { /* this is the child (forked) process */

/*
* here the child process does an execvp() of mtvp
* with the right options. this will becomes the mtvp process...
*/
[...]

/* of course, the end of this block is never reached because
of the execvp() */

}

/* this is the mtv process... */
return 0;
}

--Tristan
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/