Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!gatech!bloom-beacon!oberon!castor.usc.edu!blarson
From: blarson@castor.usc.edu (Bob Larson)
Newsgroups: comp.unix.questions
Subject: Re: Fork and Join, Pipe in C
Message-ID: <3257@oberon.USC.EDU>
Date: Tue, 7-Jul-87 17:32:43 EDT
Article-I.D.: oberon.3257
Posted: Tue Jul  7 17:32:43 1987
Date-Received: Sat, 11-Jul-87 00:41:29 EDT
References: <7737@brl-adm.ARPA> <1186@ius2.cs.cmu.edu>
Sender: nobody@oberon.USC.EDU
Reply-To: blarson@castor.usc.edu (Bob Larson)
Organization: USC AIS, Los Angeles
Lines: 26

In article <4167@teddy.UUCP> jpn@teddy.UUCP (John P. Nelson) writes:
>>On os9, which has the create_process os9fork() call rather than a unix-like
>>fork (error checking omited for simplicity):
[...]
>But this leaves extra file descriptors open in the child task!  By my
>calculation, extra descriptors in the child task are "pipe", and
>"temp".  You really want to CLOSE those descriptors in the child task,
>but not in the parent task.

No it doesn't.  Os9fork only passes file descriptors 0, 1 and 2.
There is an os9forkc call that allows passing a specified number of
file descriptors.

>Obviously, there can be workarounds:  CLOSE_ON_EXEC information on a
>per-descriptor basis, or a convention in all tasks to close all
>descriptors above 2 before calling main().  The fundamental point is
>unchanged, however, and that is that there is often a need to do some
>extra operations between the logical "fork" into two processes, and
>the "exec" of a new program image.

I have not found such a NEED on os9.  It would make converting unix
programs easier.  (It would require extra hardware to implement a
unix-style fork call.)
Bob Larson		Arpa: Blarson@Ecla.Usc.Edu
Uucp: {sdcrdcf,seismo!cit-vax}!oberon!castor!blarson
"How well do we use our freedom to choose the illusions we create?" -- Timbuk3