Forking Win32 process?

Igor Peshansky pechtcha@cs.nyu.edu
Mon Jan 28 01:00:00 GMT 2008


On Sun, 27 Jan 2008, Christopher Faylor wrote:

> On Sun, Jan 27, 2008 at 04:36:49PM -0500, Igor Peshansky wrote:
> >On Sun, 27 Jan 2008, Dmitry Bely wrote:
> >
> >> On Jan 27, 2008 5:15 PM, Christopher Faylor
> >> <cgf-use-the-mailinglist-please@cygwin.com> wrote:
> >> > On Sun, Jan 27, 2008 at 01:43:13PM +0300, Dmitry Bely wrote:
> >> > >Ah, is it up-to-date info and fork() really doesn't work with the
> >> > >current cygwin? If so, why this is not mentioned in the docs or
> >> > >somewhere?
> >> >
> >> > Because of our motto: http://cygwin.com/acronyms/#WJM.
> >>
> >> OK, do you think that updating the FAQ for this specific issue is a
> >> bad idea? Who could do that?
> >
> >You can.  Just send a documentation patch against the latest sources to
> >cygwin-patches, and it will be reviewed and (hopefully) accepted.
>
> I don't see why not.

I just didn't want to make any definite statements on your behalf.

> >> > >Is it really impossible from the technical point of view?
> >> >
> >> > Of course it is not impossible.  I doubt that anyone would be interested
> >> > in implementing this however.  The main focus of the project is to make
> >> > things work for the standard case of linking cygwin1.dll into a program
> >> > and creating a "cygwin program".  Getting things like fork() working
> >> > with MSVC or MinGW programs is not something that anyone really wants to
> >> > do.
> >>
> >> Sometimes it's needed (as in my case :) but your point is taken. BTW,
> >> I have seen in the archives that several years ago someone tried to
> >> implement the native fork() via NT kernel call
> >> NtCreateProcess()/ZwCreateProcess(). Did these efforts succeeded in
> >> any way? Is there any working solution (performance is not a
> >> question)?
> >
> >FYI, nothing prevents you from invoking CreateProcess from within the code
> >even now.  The call will not understand POSIX paths, and the resulting
> >process may not show up in the Cygwin process table, *and* you will not be
> >able to wait() for it in quite the same way, but pure Win32 calls are
> >always accessible from Cygwin programs.  Unless you need the full POSIX
> >fork functionality, the MinGW fork implementation should do just as well.
>
> He was talking about NtCreateProcess which is a different beast.  There
> has been no successful implementation using NtCreateProcess.

Fair enough.  But my point remains the same -- nothing prevents him from
using NtCreateProcess from his code, but it won't be equivalent to the
Cygiwn fork() call.  The reference to the MinGW implementation was
intended to be just an example of a Win32 call.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"That which is hateful to you, do not do to your neighbor.  That is the whole
Torah; the rest is commentary.  Go and study it." -- Rabbi Hillel



More information about the Cygwin-developers mailing list