Next: Redirecting the Standard Input,
Up: Pipes
Previous: Pipes
Contents
- A call to pipe creates file descriptors, which are valid only within that process and its children.
- A process's file descriptors cannot be passed to unrelated processes; however, when the process calls fork, file descriptors are copied to the new child process. Thus, pipes can connect only related processes.
- In the following http://siber.cankaya.edu.tr/SystemsProgramming/cfiles/pipe.cprogram, (see Fig. 6.4.1) a fork spawns a child process. The child inherits the pipe file descriptors. The parent writes a string to the pipe, and the child reads it out.
Figure 6.8:
Using a Pipe to Communicate with a Child Process
|
Cem Ozdogan
2007-05-16