In Figure19.16, explain why it is necessary to check that the values of pipe[0] and pipe[1] arenot equal to STDIN_FILENO or STDOUT_FILENO beforeclosing the ?le descriptor.
What will be an ideal response?
If either pipe[0] or pipe[1] had the value STDIN_FILENO or STDOUT_FILENO,then one of the calls to dup2(2) would have no effect. In this case, closing the pipe ?le descriptor would close either the standardinput or the standardoutput. Defensive programming dictates that we prevent this from happening, since the do_driver function might be called with standardinput or standardoutput already closed.
You might also like to view...
One generic Stack class could be the basis for creating many Stack classes, e.g., Stack
a. subclasses. b. generic subclasses. c. concrete classes. d. parameterized classes.
Optional arguments in Excel functions are shown in parentheses
Indicate whether the statement is true or false
When beginning a new presentation, ________ a template thumbnail opens a preview window of the template
Fill in the blank(s) with correct word
What operation does the following algorithm describe?Algorithm aHeapAlgorithm (heap, newNode) if (newNode not the root) set parent to parent of newNode if (newNode key > parent key) exchange newNode and parent) aHeapAlgorithm (heap, parent) end if end ifend aHeapAlgorithm
A. build heap B. insert heap C. reheap up D. reheap down