Child access to parent files opened AFTER fork/exec.

Guy Harris guy at auspex.UUCP
Sat Oct 29 13:55:15 AEST 1988


>Given that a child process inherits the open files of its parent,
>is there any way for the child to access a file opened by the
>parent subsequent to the child being exec'd ?

Yes.  It can reopen those files itself, assuming the files have a file
name, it knows the file name, and opening something with that name gives
it a descriptor for the same file (which needn't be true if the file is
a special file that refers to a "clone" device).

Alternatively, some UNIX IPC mechanisms, namely UNIX-domain sockets in
4.[23]BSD and "stream pipes" in System V Release 3.x, permit a process
to pass file descriptors to another process. 



More information about the Comp.unix.questions mailing list