Subject: XP 64 bit : 32 bit emulation : fork problem : Cygwin 1.3.5
From: Basant Kukreja <[email-masked]>
To: [email-masked]
Date: Mon, 03 Dec 2001 12:03:11 -0800

Hi,
    I tried to run Cygwin on Microsoft XP on 64 bit machine on itanium
processor.
I thought that 32 bit intel emulation should work. I installed on the
itanium machine.

I found that fork doesn't work. I downloaded the cygwin1 dll put few
printfs to find
out that fork is failing on alloc_stack_hard_way function during call of
VirtualAlloc
at the time of reserving stack. ( file name dcrt0.cc).

  if (!VirtualAlloc (newbase, newlen, MEM_RESERVE, PAGE_NOACCESS))
    api_fatal ("fork: can't reserve memory for stack %p - %p,  %p-%p \n
base = %p allocbase = %p - regionsize= %p , %E",
        ci->stacktop, ci->stackbottom, newbase, newlen, sm.BaseAddress,
sm.AllocationBase, sm.RegionSize);

The program failed by saying :
fork : can't reserve memory for stack.

I tried to find out difference between memory space while running on NT
and while emulating on Win64. I could not figure it out the reasons. I
can
put the address space if you want.  I saw that the place it was trying
to
reserve was already reserved. When I commented this line and allow
it to run futher it ran fine until
user_data->main(...)

I could not figure it out what this main points to so I could not debug
futher.

Regards,
Basant.

Cygwin 1.3.5 Dll was used.

The test program is very simple.

main()
{
        cout << "Parent Pid = " << getpid() << "\n";
        int n = fork();
        if( n == 0 )
        {
                cout << "My Pid = "<< getpid() << "\n";
                // sleep (60);
                cout << "Child Proc\n";
                func();
        }
        else
        {
                wait(0);
                cout<< "Parent Proc\n";
        }
        return 0;
}

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/