transferring control of terminal to child

transferring control of terminal to child

Post by Venkata-Rama P. Tamma » Sun, 25 Apr 1993 05:22:25



In my C program, I create a child process which needs to get the control
of the terminal from the parent, and return control to the parent when it
exits.  When I say control what I mean is that I would like the child
process to be able to take input from stdin.  Can someone tell me if it is
possible and if possible how it may be done?

Thank you,

Prasad
--
                                The probability of someone watching you
                                is proportional to the stupidity
                                of your action.

 
 
 

transferring control of terminal to child

Post by Barry Margol » Tue, 27 Apr 1993 07:11:27



Quote:>In my C program, I create a child process which needs to get the control
>of the terminal from the parent, and return control to the parent when it
>exits.  When I say control what I mean is that I would like the child
>process to be able to take input from stdin.  Can someone tell me if it is
>possible and if possible how it may be done?

A child process inherits the open files from its parent, so it can just
start reading.  What you need to do is prevent them from both trying to
read at the same time.  In your case, the parent can do this simply by not
trying to read from stdin until the child exits.  In a more complex
situation, where you want control to go back and forth between the parent
and child, you'll need a separate communication mechanism between the two
processes (e.g. a pair of pipes) so that they can let each other know when
they're done using stdin.
--
Barry Margolin
System Manager, Thinking Machines Corp.



 
 
 

1. Getting a child and child's child process-id

 Why not just have the parent fork twice ??? Saves a lot of trouble ...
--


#  Have you read your Book In Basic Life Education today ? You should !!  #
#  Any views I express are not necessarily those of Brighton Polytechnic  #
###################### "surivorter erutangis a ma I" ######################

2. Two questions about kvm (KDE terminal)

3. 2.4.3-ac{6,7} LVM hang

4. Transferring locks from parent to child

5. Remote access solutions needed

6. How to transfer the varible value from the child process to its parent process

7. X server tcp related errors

8. IPC (Or rather Child -> Parent data transfer).

9. remote controlled child shell

10. Shell (ksh) child control question

11. fcntl system calls, xview control and child processes !

12. how to control stdin in child process?