diff options
author | Christopher Faylor <me@cgf.cx> | 2006-03-29 06:35:25 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-03-29 06:35:25 +0000 |
commit | 12b33712894f9c61732ef686d81248fc607b6766 (patch) | |
tree | 67847a11d95c794dd7d91e58c366c2b521de701d /winsup/cygwin/fork.cc | |
parent | cdc2256b769c1183177bf92cb22c34311ce8e6de (diff) | |
download | cygnal-12b33712894f9c61732ef686d81248fc607b6766.tar.gz cygnal-12b33712894f9c61732ef686d81248fc607b6766.tar.bz2 cygnal-12b33712894f9c61732ef686d81248fc607b6766.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r-- | winsup/cygwin/fork.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 82d1b32b8..b60a2bc50 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -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; |