Subject: fork() under win32
From: [email-masked] (Alistair McEwan)

26 Jun 1997 00:29:48 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: [email-masked]
Original-Sender: [email-masked]

Hi,

I hope someone can help me!

For various reasons, I have to produce two versions of the application
I am writing - one which uses gnu-win32 and one which doesnt; and uses
only Visual C++ tools.

So my problem is this.  The application is being ported from Unix (we
have it running on a variety of flavours), and it relies _very_
heavily on the behaviour of fork(); ie I need to create a new process
which is an *exact* copy of the calling process.  The reason for this
is that a number of things are set up by the parent which are
necessary for the child to know - this includes shared memory segments
et al.

So essentially I need an exact copy, with all handles being
inheritted, an exact copy of the address space, and execution in the
child beginning at the point of the fork. (Hence I think it is
precisely the behaviour of fork() which I need!)

Although there is a fork in the cygwin library, I have been unable to
find anything under VC++ which does this.  It seems straightforward
enough to launch another instance of the parent process (just relaunch
the application, using CreateProcess()) which will inherit handles,
but this doesnt seem to offer me the address space copy, and naturally
execution begins at main().

Has anyone come across a problem like this before? Can anyone help? I
am getting desperate! (I apologise for the slightly irrelevant nature
of this to the list, but it has some slight relevance to gnbu-win32, I
hope!)

Ali

-- 
________________________________________________
Oxford University Computing Laboratory
[email-masked]  +44 1865 273846
http://www.comlab.ox.ac.uk/oucl/people/alistair.mcewan.html
------------------------------------------------
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".