www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/06/01/11:58:26

Date: Tue, 1 Jun 93 11:00:05 EDT
From: engdahl AT brutus DOT aa DOT ab DOT com (Jon Engdahl)
To: jon%amito DOT halsp DOT hitachi DOT com AT hitachi DOT hitachi DOT com
Subject: Re: page fault handler problem
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

> From jon%amito DOT halsp DOT hitachi DOT com AT hitachi DOT hitachi DOT com Fri May 28 20:47:23 1993
... 
> >For anyone who is curious as to what I am doing, I have added "spawn*"
> >to GO32, and have written a "stubs.c" that implements enough of fork,
> >exec*, wait, and exit to allow GNU make to run. The trick is that, in
> >many programs, the child process doesn't do much besides call exec,
> >which allows me to implement fork as "create thread". You have to be
> >me know.
...
> 
> This command was implemented for BSD Unix under the name vfork and still
> exists in BSDxx, SunOs, etc.  You may want to use the same name.  I
> believe the code is available in various places -- try searching the
> uunet archive at ftp.uu.net.

I am not an Unix expert - I didn't know what vfork was until I read the
man page you sent me (I tend to guess lest I have to read). In fact,
after reading the man page, I think I still don't know what vfork is. I
do recall that make-3.65 calls vfork rather than fork. At the moment, I
have selected the option in config.h that maps vfork to fork, and I have
implemented my plastic fork named as "fork". Perhaps it would be more
accurate to call it vfork, although a "plastic fork" it will remain no
matter what it is called.

What I have implemented so far uses jmpbufs as process save areas, uses
setjump to save context, and longjump to load context. (I think I got
the idea from Phil Karn's KA9Q tcpip package). When I fork, I malloc a
new stack of 4K, copy some of the old stack to the new stack, fix up
the frame pointers, push the parent process onto a stack of preempted
processes, and run the child.  What you wind up with is shared code and
shared global data, but separate auto data. The child also inherits a
copy of the first 16 words of the parents arglist. As long as the child
behaves itself, the parent survives.

So you tell me, is it vfork, or is it something else again?

I would contend that if vfork works the same as the plastic fork, in
that the child can blow away the global and static variables of the
parent, then make-3.65 is broken, because I had to modify some "make"
code to get this to work as much as it has, due the the child
clobbering things.

DJ, am I allowed to look at BSD code if I intend to give this to you to
include in future releases, or will I become "unclean"?

Jonathan Engdahl, Sr. Project Engineer | engdahl AT aa DOT ab DOT com N8XVY 313-998-2450
Allen-Bradley Co.                      | A Rockwell International Company
555 Briarwood Circle,                  | Industrial Communication Networks
Ann Arbor, Michigan, 48108, USA        | system design, software, ASICs

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019