[Info-vax] Looking into C-include files on VMS

John E. Malmberg wb8tyw at qsl.network
Thu Oct 29 09:46:44 EDT 2009


Bob Koehler wrote:
> In article <7krs6vF3af5v3U10 at mid.individual.net>, Bob Eager <rde42 at spamcop.net> writes:
>> You miss the point. They are talking about VMS SPAWN, which is unlike 
>> vfork()+exec(). It is nearer to creating a new (empty) process and 
>> loading a program into it.
> 
>    Doesn't that end up with the same thing?  I would expect vfork() to
>    start a new process and exec() to load a new program into it.

That is not how it works on VMS.

>    In fact, the C RTL does have a pair of routines (or macros in the
>    approriate header file) called vfork() and exec() that end up spawning 
>    a new process running a new program.  Just don't expect the 
>    implementation to look like those in UNIX.

Correct.  vfork() just sets up long jump and returns twice, but until 
the exec() call is made, unlink Unix, it is still in the parent process 
context.

The first return is with a value of 0, which on Unix would be the child 
process, but on VMS is still the parent process.

There are VMS specific decc$* routines needed to be called before the 
exec() to set file descriptors for STDIN, STDOUT, STDERR, and the 
default directory for the new process before exec() is called.

Once the exec() call is made, vfork() returns the pid of the created 
process or an error condition, for the parent to process.

The CRTL passes some context from the parent process to the child, but 
essentially the child is a brand new subprocess starting from scratch.

-John
wb8ytw at qsl.network
Personal Opinion Only



More information about the Info-vax mailing list