This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fork() under win32




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
Alistair.McEwan@comlab.ox.ac.uk  +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
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]