* dcrt0.cc (child_info_fork::handle_fork): Set uid/gid in myself so that it can
be used by subsequent startup functions. (dll_crt0_0): Issue a warning if DuplicateTokenEx fails and DEBUGGING. (dll_crt0_1): Move user_data->{resourcelocks,threadinterface} initialization here from dll_crt0_0. * fork.cc (frok::child): Tell wait_for_sigthread that this is fork. (frok::parent): Only initialize start_time once. Tighten time when we're "deimpersonated". * sigproc.cc (signal_fixup_after_exec): Rework (futiley) sa_buf stuff. Add debugging output. (wait_for_sigthread): Accept an argument which illustrates whether we are forked or not. (wait_sig): Avoid using myself pointer. * winsup.h ((wait_for_sigthread): Reflect change to argument.
This commit is contained in:
@@ -178,7 +178,7 @@ frok::child (void *)
|
||||
ld_preload ();
|
||||
fixup_hooks_after_fork ();
|
||||
_my_tls.fixup_after_fork ();
|
||||
wait_for_sigthread ();
|
||||
wait_for_sigthread (true);
|
||||
cygwin_finished_initializing = true;
|
||||
return 0;
|
||||
}
|
||||
@@ -283,17 +283,17 @@ frok::parent (void *stack_here)
|
||||
si.lpReserved2 = (LPBYTE) &ch;
|
||||
si.cbReserved2 = sizeof (ch);
|
||||
|
||||
syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %p, 0, 0, %p, %p)",
|
||||
myself->progname, myself->progname, c_flags, &si, &pi);
|
||||
bool locked = __malloc_lock ();
|
||||
time_t start_time = time (NULL);
|
||||
|
||||
/* Remove impersonation */
|
||||
cygheap->user.deimpersonate ();
|
||||
fix_impersonation = true;
|
||||
|
||||
syscall_printf ("CreateProcess (%s, %s, 0, 0, 1, %p, 0, 0, %p, %p)",
|
||||
myself->progname, myself->progname, c_flags, &si, &pi);
|
||||
bool locked = __malloc_lock ();
|
||||
time_t start_time;
|
||||
while (1)
|
||||
{
|
||||
start_time = time (NULL);
|
||||
rc = CreateProcess (myself->progname, /* image to run */
|
||||
myself->progname, /* what we send in arg0 */
|
||||
&sec_none_nih,
|
||||
@@ -345,6 +345,10 @@ frok::parent (void *stack_here)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Restore impersonation */
|
||||
cygheap->user.reimpersonate ();
|
||||
fix_impersonation = false;
|
||||
|
||||
child_pid = cygwin_pid (pi.dwProcessId);
|
||||
child.init (child_pid, 1, NULL);
|
||||
|
||||
@@ -366,10 +370,6 @@ frok::parent (void *stack_here)
|
||||
for the forkee. */
|
||||
strcpy (child->progname, myself->progname);
|
||||
|
||||
/* Restore impersonation */
|
||||
cygheap->user.reimpersonate ();
|
||||
fix_impersonation = false;
|
||||
|
||||
/* Fill in fields in the child's process table entry. */
|
||||
child->dwProcessId = pi.dwProcessId;
|
||||
child.hProcess = pi.hProcess;
|
||||
@@ -396,10 +396,10 @@ frok::parent (void *stack_here)
|
||||
/* CHILD IS STOPPED */
|
||||
debug_printf ("child is alive (but stopped)");
|
||||
|
||||
/* Initialize, in order: data, bss, heap, stack, dll data, dll bss
|
||||
Note: variables marked as NO_COPY will not be copied
|
||||
since they are placed in a protected segment. */
|
||||
|
||||
/* Initialize, in order: stack, dll data, dll bss.
|
||||
data, bss, heap were done earlier (in dcrt0.cc)
|
||||
Note: variables marked as NO_COPY will not be copied since they are
|
||||
placed in a protected segment. */
|
||||
|
||||
MALLOC_CHECK;
|
||||
const void *impure_beg;
|
||||
|
Reference in New Issue
Block a user