Parent and child processes and files

Howard Siegel 4-2390 x4064 hsiegel at cvbnet.UUCP
Sun Dec 24 11:03:24 AEST 1989


Howdy, folks.

Here's a problem I'm trying to lick in SunOS 4.0.3.

I have a situation in which a parent process spawns children at
request.  Obviously, any file open at the time a child is spawned is
shared between parent and child.  After spawning a child, the parent
waits until the child dies before resuming activity.

However, suppose that the child process opens or closes a file on
behalf of its parent.  For reasons unhelpful to elaborate, it is
necessary for the parent to know the files that particular child
opened or closed, in order to provide them to other children.

The only feasible solution I've come up with so far is to equip the
file opening and closing routines with wrappers which will store the
names, open mode, status, and file descriptors for all files opened and
closed in a table in shared memory that the parent shares with all its
children.  When a child dies, the parent then scans the table, opening
and closing files appropriately.

I believe this scheme to be workable but baroque.  Among the problems I
envision is having to provide other wrappers around the read/write (etc)
functions as well, to keep track of the current access point in the
files.

I hope someone out there in netland is able to suggest a simpler and
more elegant solution.  Failing that, I'd appreciate suggestions as to
points I may have overlooked in my sketched solution above.

As always, thanks in advance.  If people express interest, I'll post a
summary of whatever responses I may get.


Howard Siegel                   hsiegel at piano.prime.com
Prime/Computervision            hsiegel at primerd.prime.com
Bedford, Mass.                  hsiegel%piano.prime.com at RELAY.CS.NET
(617) 275-1800 x4064            cvbnet!hsiegel at primerd.prime.com



More information about the Comp.unix.wizards mailing list