* child_info.h (child_info): Add pppid_handle for closing the parent's of the
parent handle. * dcrt0.cc (_dll_crt0): Close parent's parent handle when spawned or forked. * debug.cc (add_handle): Correct erroneous reference to handle structure when printing warning. * exceptions.cc (interrupt_now): Always return 1. (interrupt_on_return): Accept a sigthread argument. Check to see if this argument has been trashed prior to setting up the stack return. (call_handler): Add a loop around attempts to dispatch signals to detect case where interrupt_on_return fails. (_sigdelayed): Set up a temporary frame pointer prior to calling stuff that could trigger an interrupt or the stack walking code will be very confused. * fork.cc (fork_parent): Move a lot of the setup of the child process into proc_subproc. * spawn.cc (spawn_guts): Ditto. Use ppid_handle to contact logical parent when reparenting. * pinfo.h (_pinfo): Remember the logical handle of the parent process. * sigproc.cc (proc_subproc): Record most stuff necessary for the _pinfo structure that is inferrable from myself when adding children. (wait_sig): Always set 'pending_signals' flag when about to kick off the signal scanning loop. Reset it only if there are no pending signals.
This commit is contained in:
@ -471,35 +471,12 @@ fork_parent (void *stack_here, HANDLE& hParent, dll *&first_dll, bool& load_dlls
|
||||
system_printf ("couldn't create last_fork_proc, %E");
|
||||
|
||||
/* Fill in fields in the child's process table entry. */
|
||||
forked->ppid = myself->pid;
|
||||
forked->hProcess = pi.hProcess;
|
||||
forked->dwProcessId = pi.dwProcessId;
|
||||
forked->uid = myself->uid;
|
||||
forked->gid = myself->gid;
|
||||
forked->pgid = myself->pgid;
|
||||
forked->sid = myself->sid;
|
||||
forked->ctty = myself->ctty;
|
||||
forked->umask = myself->umask;
|
||||
forked->copysigs(myself);
|
||||
forked->process_state |= PID_INITIALIZING |
|
||||
(myself->process_state & PID_USETTY);
|
||||
memcpy (forked->username, myself->username, MAX_USER_NAME);
|
||||
if (myself->use_psid)
|
||||
{
|
||||
memcpy (forked->psid, myself->psid, MAX_SID_LEN);
|
||||
forked->use_psid = 1;
|
||||
}
|
||||
memcpy (forked->logsrv, myself->logsrv, MAX_HOST_NAME);
|
||||
memcpy (forked->domain, myself->domain, MAX_COMPUTERNAME_LENGTH+1);
|
||||
forked->token = myself->token;
|
||||
forked->impersonated = myself->impersonated;
|
||||
forked->orig_uid = myself->orig_uid;
|
||||
forked->orig_gid = myself->orig_gid;
|
||||
forked->real_uid = myself->real_uid;
|
||||
forked->real_gid = myself->real_gid;
|
||||
strcpy (forked->root, myself->root);
|
||||
forked->rootlen = myself->rootlen;
|
||||
set_child_mmap_ptr (forked);
|
||||
forked.remember ();
|
||||
|
||||
/* Wait for subproc to initialize itself. */
|
||||
if (!sync_with_child(pi, subproc_ready, TRUE, "waiting for longjmp"))
|
||||
@ -536,8 +513,6 @@ fork_parent (void *stack_here, HANDLE& hParent, dll *&first_dll, bool& load_dlls
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
forked.remember ();
|
||||
|
||||
/* Start thread, and wait for it to reload dlls. */
|
||||
if (!resume_child (pi, forker_finished) ||
|
||||
!sync_with_child (pi, subproc_ready, load_dlls, "child loading dlls"))
|
||||
|
Reference in New Issue
Block a user