* child_info.h (child_proc_info): Declare as base class.
(spawn_info): Declare as alias of child_proc_info to aid debugging. (fork_info): Ditto. * cygheap.cc (cygheap_fixup_in_child): Use child_proc_info global rather than parameter. * cygheap.h (cygheap_fixup_in_child): Reflect above change in declaration. * dcrt0.cc (_dll_crt0): Move 'si' definition here. Assign child_proc_info. (dll_crt0_1): Accommodate cygheap_fixup_in_child and *_info changes. * environ.cc (spenv::retrieve): Make regparm. * environ.h (environ_init): Ditto. (win_env::add_cache): Ditto. (build_env): Ditto. (getwinenv): Ditto. * fork.cc (sync_with_parent): Use fork_info global. (fork_child): Ditto.
This commit is contained in:
@ -196,11 +196,11 @@ sync_with_parent(const char *s, bool hang_self)
|
||||
{
|
||||
debug_printf ("signalling parent: %s", s);
|
||||
/* Tell our parent we're waiting. */
|
||||
if (!SetEvent (child_proc_info->subproc_ready))
|
||||
if (!SetEvent (fork_info->subproc_ready))
|
||||
api_fatal ("fork child - SetEvent for %s failed, %E", s);
|
||||
if (hang_self)
|
||||
{
|
||||
HANDLE h = child_proc_info->forker_finished;
|
||||
HANDLE h = fork_info->forker_finished;
|
||||
/* Wait for the parent to fill in our stack and heap.
|
||||
Don't wait forever here. If our parent dies we don't want to clog
|
||||
the system. If the wait fails, we really can't continue so exit. */
|
||||
@ -213,10 +213,10 @@ sync_with_parent(const char *s, bool hang_self)
|
||||
break;
|
||||
case WAIT_FAILED:
|
||||
if (GetLastError () == ERROR_INVALID_HANDLE &&
|
||||
WaitForSingleObject (child_proc_info->forker_finished, 1) != WAIT_FAILED)
|
||||
WaitForSingleObject (fork_info->forker_finished, 1) != WAIT_FAILED)
|
||||
break;
|
||||
api_fatal ("WFSO failed for %s, fork_finished %p, %E", s,
|
||||
child_proc_info->forker_finished);
|
||||
fork_info->forker_finished);
|
||||
break;
|
||||
default:
|
||||
debug_printf ("no problems");
|
||||
@ -265,10 +265,10 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
|
||||
fork() was invoked from other than the main thread. Make sure that
|
||||
when the "main" thread exits it calls do_exit, like a normal process.
|
||||
Exit with a status code of 0. */
|
||||
if (child_proc_info->stacksize)
|
||||
if (fork_info->stacksize)
|
||||
{
|
||||
((DWORD *)child_proc_info->stackbottom)[-17] = (DWORD)do_exit;
|
||||
((DWORD *)child_proc_info->stackbottom)[-15] = (DWORD)0;
|
||||
((DWORD *)fork_info->stackbottom)[-17] = (DWORD)do_exit;
|
||||
((DWORD *)fork_info->stackbottom)[-15] = (DWORD)0;
|
||||
}
|
||||
|
||||
set_file_api_mode (current_codepage);
|
||||
@ -298,8 +298,8 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
|
||||
}
|
||||
|
||||
ForceCloseHandle (hParent);
|
||||
(void) ForceCloseHandle (child_proc_info->subproc_ready);
|
||||
(void) ForceCloseHandle (child_proc_info->forker_finished);
|
||||
(void) ForceCloseHandle (fork_info->subproc_ready);
|
||||
(void) ForceCloseHandle (fork_info->forker_finished);
|
||||
|
||||
if (fixup_shms_after_fork ())
|
||||
api_fatal ("recreate_shm areas after fork failed");
|
||||
|
Reference in New Issue
Block a user