bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VMS port - Advice wanted for not having a fork() call.


From: Chet Ramey
Subject: Re: VMS port - Advice wanted for not having a fork() call.
Date: Thu, 07 Jun 2012 13:04:53 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120601 Thunderbird/13.0

On 6/6/12 8:22 AM, John E. Malmberg wrote:
> The existing port of Bash for VMS claims to be 1.4.8, which as near as I
> can tell must be based on 1.4.7, as I do not see a 1.4.8 in the download
> section.
> 
> What they did to work around that VMS does not have a fork() call, is to:
> 
>     Make a copy of several global variables and structures.
>     Set the global variables to point to the copy.
>     set a stack local structure to point to the original values.
> 
> And then at a later point where the child processes has exited:
>     Set the global variables to point to the original structures
>     Dispose of the copy.
> 
> Since then, the structure of Bash and the global variables has changed a bit.
> 
> So what I am trying to find is where in Bash 4.2 that I should be putting
> the save/restore, what variables need to be copied/saved/restored, and what
> the best routines to do that.

Their approach was to define `shell state', and save and restore it.
That's not a bad approach, but the semantics of fork require that you save
and restore everything that a child shell could possibly touch or modify,
since the definition of fork() requires that the child process not be able
to modify anything in its parent's address sapce.  That's pretty daunting.

It might be worth spending some time to figure out how VMS creates
processes and whether or not one of those primitives could be adapted to
create a fork() function.

> And where I can just set a flag to avoid the fork() operation all together.

You can't.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]