* dcrt0.cc (dll_crt0_0): Reorganize so that sigproc_init is called a little
later. Add a comment. * fork.cc (resume_child): Make void. (frok::parent): Only zero pi when necessary. Explicitly zero si. Set this_errno when child_copy fails. Accommodate change to resume_child. * sigproc.cc (sigalloc): Move global_sigs initialization here. (sigproc_init): Move global_sigs. (sig_send): Just check for flush signals once. * wincap.h: Define supports_setconsolectrlhandler_null throughout. * wincap.cc: Ditto.
This commit is contained in:
parent
d6382e653a
commit
bbca1e4cb9
@ -1,3 +1,17 @@
|
|||||||
|
2006-03-13 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* dcrt0.cc (dll_crt0_0): Reorganize so that sigproc_init is called a
|
||||||
|
little later. Add a comment.
|
||||||
|
* fork.cc (resume_child): Make void.
|
||||||
|
(frok::parent): Only zero pi when necessary. Explicitly zero si. Set
|
||||||
|
this_errno when child_copy fails. Accommodate change to resume_child.
|
||||||
|
* sigproc.cc (sigalloc): Move global_sigs initialization here.
|
||||||
|
(sigproc_init): Move global_sigs.
|
||||||
|
(sig_send): Just check for flush signals once.
|
||||||
|
|
||||||
|
* wincap.h: Define supports_setconsolectrlhandler_null throughout.
|
||||||
|
* wincap.cc: Ditto.
|
||||||
|
|
||||||
2006-03-13 Corinna Vinschen <corinna@vinschen.de>
|
2006-03-13 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* autoload.cc (LoadDLLfuncNt): New define to wrap NT native functions.
|
* autoload.cc (LoadDLLfuncNt): New define to wrap NT native functions.
|
||||||
|
@ -671,6 +671,13 @@ void __stdcall
|
|||||||
dll_crt0_0 ()
|
dll_crt0_0 ()
|
||||||
{
|
{
|
||||||
init_global_security ();
|
init_global_security ();
|
||||||
|
initial_env ();
|
||||||
|
|
||||||
|
/* Initialize signal processing here, early, in the hopes that the creation
|
||||||
|
of a thread early in the process will cause more predictability in memory
|
||||||
|
layout for the main thread. */
|
||||||
|
sigproc_init ();
|
||||||
|
|
||||||
lock_process::init ();
|
lock_process::init ();
|
||||||
init_console_handler (TRUE);
|
init_console_handler (TRUE);
|
||||||
_impure_ptr = _GLOBAL_REENT;
|
_impure_ptr = _GLOBAL_REENT;
|
||||||
@ -680,7 +687,6 @@ dll_crt0_0 ()
|
|||||||
_impure_ptr->_current_locale = "C";
|
_impure_ptr->_current_locale = "C";
|
||||||
user_data->impure_ptr = _impure_ptr;
|
user_data->impure_ptr = _impure_ptr;
|
||||||
user_data->impure_ptr_ptr = &_impure_ptr;
|
user_data->impure_ptr_ptr = &_impure_ptr;
|
||||||
initial_env ();
|
|
||||||
mmap_init ();
|
mmap_init ();
|
||||||
|
|
||||||
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
|
||||||
@ -750,8 +756,6 @@ dll_crt0_0 ()
|
|||||||
DuplicateTokenEx (hProcToken, MAXIMUM_ALLOWED, NULL,
|
DuplicateTokenEx (hProcToken, MAXIMUM_ALLOWED, NULL,
|
||||||
SecurityImpersonation, TokenImpersonation,
|
SecurityImpersonation, TokenImpersonation,
|
||||||
&hProcImpToken);
|
&hProcImpToken);
|
||||||
/* Initialize signal/subprocess handling. */
|
|
||||||
sigproc_init ();
|
|
||||||
debug_printf ("finished dll_crt0_0 initialization");
|
debug_printf ("finished dll_crt0_0 initialization");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,12 +50,12 @@ class frok
|
|||||||
friend int fork ();
|
friend int fork ();
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static void
|
||||||
resume_child (HANDLE forker_finished)
|
resume_child (HANDLE forker_finished)
|
||||||
{
|
{
|
||||||
SetEvent (forker_finished);
|
SetEvent (forker_finished);
|
||||||
debug_printf ("signalled child");
|
debug_printf ("signalled child");
|
||||||
return 1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notify parent that it is time for the next step. */
|
/* Notify parent that it is time for the next step. */
|
||||||
@ -214,7 +214,6 @@ frok::parent (void *stack_here)
|
|||||||
{
|
{
|
||||||
HANDLE forker_finished;
|
HANDLE forker_finished;
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
PROCESS_INFORMATION pi = {0, NULL, 0, 0};
|
|
||||||
child_pid = -1;
|
child_pid = -1;
|
||||||
error = NULL;
|
error = NULL;
|
||||||
this_errno = 0;
|
this_errno = 0;
|
||||||
@ -225,7 +224,6 @@ frok::parent (void *stack_here)
|
|||||||
|
|
||||||
int c_flags = GetPriorityClass (hMainProc);
|
int c_flags = GetPriorityClass (hMainProc);
|
||||||
debug_printf ("priority class %d", c_flags);
|
debug_printf ("priority class %d", c_flags);
|
||||||
STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL};
|
|
||||||
|
|
||||||
/* If we don't have a console, then don't create a console for the
|
/* If we don't have a console, then don't create a console for the
|
||||||
child either. */
|
child either. */
|
||||||
@ -274,6 +272,10 @@ frok::parent (void *stack_here)
|
|||||||
debug_printf ("stack - bottom %p, top %p, size %d",
|
debug_printf ("stack - bottom %p, top %p, size %d",
|
||||||
ch.stackbottom, ch.stacktop, ch.stacksize);
|
ch.stackbottom, ch.stacktop, ch.stacksize);
|
||||||
|
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
STARTUPINFO si;
|
||||||
|
|
||||||
|
memset (&si, 0, sizeof (si));
|
||||||
si.cb = sizeof (STARTUPINFO);
|
si.cb = sizeof (STARTUPINFO);
|
||||||
si.lpReserved2 = (LPBYTE) &ch;
|
si.lpReserved2 = (LPBYTE) &ch;
|
||||||
si.cbReserved2 = sizeof (ch);
|
si.cbReserved2 = sizeof (ch);
|
||||||
@ -300,6 +302,7 @@ frok::parent (void *stack_here)
|
|||||||
{
|
{
|
||||||
this_errno = geterrno_from_win_error ();
|
this_errno = geterrno_from_win_error ();
|
||||||
error = "CreateProcessA failed";
|
error = "CreateProcessA failed";
|
||||||
|
memset (&pi, 0, sizeof (pi));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +406,10 @@ frok::parent (void *stack_here)
|
|||||||
locked = false;
|
locked = false;
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
if (!rc)
|
if (!rc)
|
||||||
goto cleanup;
|
{
|
||||||
|
this_errno = get_errno ();
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Now fill data/bss of any DLLs that were linked into the program. */
|
/* Now fill data/bss of any DLLs that were linked into the program. */
|
||||||
for (dll *d = dlls.istart (DLL_LINK); d; d = dlls.inext ())
|
for (dll *d = dlls.istart (DLL_LINK); d; d = dlls.inext ())
|
||||||
@ -422,10 +428,9 @@ frok::parent (void *stack_here)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start thread, and wait for it to reload dlls. */
|
/* Start thread, and then wait for it to reload dlls. */
|
||||||
if (!resume_child (forker_finished))
|
resume_child (forker_finished);
|
||||||
goto cleanup;
|
if (!ch.sync (child->pid, pi.hProcess, FORK_WAIT_TIMEOUT))
|
||||||
else if (!ch.sync (child->pid, pi.hProcess, FORK_WAIT_TIMEOUT))
|
|
||||||
{
|
{
|
||||||
this_errno = EAGAIN;
|
this_errno = EAGAIN;
|
||||||
error = "died waiting for dll loading";
|
error = "died waiting for dll loading";
|
||||||
|
@ -112,6 +112,7 @@ sigalloc ()
|
|||||||
{
|
{
|
||||||
cygheap->sigs = global_sigs =
|
cygheap->sigs = global_sigs =
|
||||||
(struct sigaction *) ccalloc (HEAP_SIGS, NSIG, sizeof (struct sigaction));
|
(struct sigaction *) ccalloc (HEAP_SIGS, NSIG, sizeof (struct sigaction));
|
||||||
|
global_sigs[SIGSTOP].sa_flags = SA_RESTART | SA_NODEFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall
|
void __stdcall
|
||||||
@ -479,14 +480,12 @@ sigproc_init ()
|
|||||||
ProtectHandle (wait_sig_inited);
|
ProtectHandle (wait_sig_inited);
|
||||||
|
|
||||||
/* sync_proc_subproc is used by proc_subproc. It serialises
|
/* sync_proc_subproc is used by proc_subproc. It serialises
|
||||||
* access to the children and proc arrays.
|
access to the children and proc arrays. */
|
||||||
*/
|
|
||||||
sync_proc_subproc.init ("sync_proc_subproc");
|
sync_proc_subproc.init ("sync_proc_subproc");
|
||||||
|
|
||||||
hwait_sig = new cygthread (wait_sig, 0, cygself, "sig");
|
hwait_sig = new cygthread (wait_sig, 0, cygself, "sig");
|
||||||
hwait_sig->zap_h ();
|
hwait_sig->zap_h ();
|
||||||
|
|
||||||
global_sigs[SIGSTOP].sa_flags = SA_RESTART | SA_NODEFER;
|
|
||||||
sigproc_printf ("process/signal handling enabled, state %p", myself->process_state);
|
sigproc_printf ("process/signal handling enabled, state %p", myself->process_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,20 +513,20 @@ sig_send (_pinfo *p, int sig)
|
|||||||
sigheld = true;
|
sigheld = true;
|
||||||
else if (!sigheld)
|
else if (!sigheld)
|
||||||
/* nothing */;
|
/* nothing */;
|
||||||
else if (sig != __SIGNOHOLD && sig != __SIGFLUSH && sig != __SIGFLUSHFAST)
|
else if (sig == __SIGFLUSH || sig == __SIGFLUSHFAST)
|
||||||
|
return 0;
|
||||||
|
else if (sig == __SIGNOHOLD)
|
||||||
|
{
|
||||||
|
SetEvent (sigCONT);
|
||||||
|
sigheld = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
system_printf ("internal signal sent while signals are on hold");
|
system_printf ("internal signal sent while signals are on hold");
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (sig == __SIGFLUSH || sig == __SIGFLUSHFAST)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetEvent (sigCONT);
|
|
||||||
sigheld = false;
|
|
||||||
}
|
|
||||||
siginfo_t si = {0};
|
siginfo_t si = {0};
|
||||||
si.si_signo = sig;
|
si.si_signo = sig;
|
||||||
si.si_code = SI_KERNEL;
|
si.si_code = SI_KERNEL;
|
||||||
|
@ -65,7 +65,8 @@ static NO_COPY wincaps wincap_unknown = {
|
|||||||
has_working_virtual_lock:false,
|
has_working_virtual_lock:false,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:false
|
has_exclusiveaddruse:false,
|
||||||
|
supports_setconsolectrlhandler_null:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_95 = {
|
static NO_COPY wincaps wincap_95 = {
|
||||||
@ -122,7 +123,8 @@ static NO_COPY wincaps wincap_95 = {
|
|||||||
has_working_virtual_lock:false,
|
has_working_virtual_lock:false,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:false
|
has_exclusiveaddruse:false,
|
||||||
|
supports_setconsolectrlhandler_null:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_95osr2 = {
|
static NO_COPY wincaps wincap_95osr2 = {
|
||||||
@ -179,7 +181,8 @@ static NO_COPY wincaps wincap_95osr2 = {
|
|||||||
has_working_virtual_lock:false,
|
has_working_virtual_lock:false,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:false
|
has_exclusiveaddruse:false,
|
||||||
|
supports_setconsolectrlhandler_null:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_98 = {
|
static NO_COPY wincaps wincap_98 = {
|
||||||
@ -236,7 +239,8 @@ static NO_COPY wincaps wincap_98 = {
|
|||||||
has_working_virtual_lock:false,
|
has_working_virtual_lock:false,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:false
|
has_exclusiveaddruse:false,
|
||||||
|
supports_setconsolectrlhandler_null:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_98se = {
|
static NO_COPY wincaps wincap_98se = {
|
||||||
@ -293,7 +297,8 @@ static NO_COPY wincaps wincap_98se = {
|
|||||||
has_working_virtual_lock:false,
|
has_working_virtual_lock:false,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:false
|
has_exclusiveaddruse:false,
|
||||||
|
supports_setconsolectrlhandler_null:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_me = {
|
static NO_COPY wincaps wincap_me = {
|
||||||
@ -350,7 +355,8 @@ static NO_COPY wincaps wincap_me = {
|
|||||||
has_working_virtual_lock:false,
|
has_working_virtual_lock:false,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:false
|
has_exclusiveaddruse:false,
|
||||||
|
supports_setconsolectrlhandler_null:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt3 = {
|
static NO_COPY wincaps wincap_nt3 = {
|
||||||
@ -407,7 +413,8 @@ static NO_COPY wincaps wincap_nt3 = {
|
|||||||
has_working_virtual_lock:true,
|
has_working_virtual_lock:true,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:false
|
has_exclusiveaddruse:false,
|
||||||
|
supports_setconsolectrlhandler_null:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt4 = {
|
static NO_COPY wincaps wincap_nt4 = {
|
||||||
@ -464,7 +471,8 @@ static NO_COPY wincaps wincap_nt4 = {
|
|||||||
has_working_virtual_lock:true,
|
has_working_virtual_lock:true,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:false
|
has_exclusiveaddruse:false,
|
||||||
|
supports_setconsolectrlhandler_null:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt4sp4 = {
|
static NO_COPY wincaps wincap_nt4sp4 = {
|
||||||
@ -521,7 +529,8 @@ static NO_COPY wincaps wincap_nt4sp4 = {
|
|||||||
has_working_virtual_lock:true,
|
has_working_virtual_lock:true,
|
||||||
has_disabled_user_tos_setting:false,
|
has_disabled_user_tos_setting:false,
|
||||||
has_fileid_dirinfo:false,
|
has_fileid_dirinfo:false,
|
||||||
has_exclusiveaddruse:true
|
has_exclusiveaddruse:true,
|
||||||
|
supports_setconsolectrlhandler_null:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_2000 = {
|
static NO_COPY wincaps wincap_2000 = {
|
||||||
@ -578,7 +587,8 @@ static NO_COPY wincaps wincap_2000 = {
|
|||||||
has_working_virtual_lock:true,
|
has_working_virtual_lock:true,
|
||||||
has_disabled_user_tos_setting:true,
|
has_disabled_user_tos_setting:true,
|
||||||
has_fileid_dirinfo:true,
|
has_fileid_dirinfo:true,
|
||||||
has_exclusiveaddruse:true
|
has_exclusiveaddruse:true,
|
||||||
|
supports_setconsolectrlhandler_null:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_xp = {
|
static NO_COPY wincaps wincap_xp = {
|
||||||
@ -635,7 +645,8 @@ static NO_COPY wincaps wincap_xp = {
|
|||||||
has_working_virtual_lock:true,
|
has_working_virtual_lock:true,
|
||||||
has_disabled_user_tos_setting:true,
|
has_disabled_user_tos_setting:true,
|
||||||
has_fileid_dirinfo:true,
|
has_fileid_dirinfo:true,
|
||||||
has_exclusiveaddruse:true
|
has_exclusiveaddruse:true,
|
||||||
|
supports_setconsolectrlhandler_null:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_2003 = {
|
static NO_COPY wincaps wincap_2003 = {
|
||||||
@ -692,7 +703,8 @@ static NO_COPY wincaps wincap_2003 = {
|
|||||||
has_working_virtual_lock:true,
|
has_working_virtual_lock:true,
|
||||||
has_disabled_user_tos_setting:true,
|
has_disabled_user_tos_setting:true,
|
||||||
has_fileid_dirinfo:true,
|
has_fileid_dirinfo:true,
|
||||||
has_exclusiveaddruse:true
|
has_exclusiveaddruse:true,
|
||||||
|
supports_setconsolectrlhandler_null:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_vista = {
|
static NO_COPY wincaps wincap_vista = {
|
||||||
@ -749,7 +761,8 @@ static NO_COPY wincaps wincap_vista = {
|
|||||||
has_working_virtual_lock:true,
|
has_working_virtual_lock:true,
|
||||||
has_disabled_user_tos_setting:true,
|
has_disabled_user_tos_setting:true,
|
||||||
has_fileid_dirinfo:true,
|
has_fileid_dirinfo:true,
|
||||||
has_exclusiveaddruse:true
|
has_exclusiveaddruse:true,
|
||||||
|
supports_setconsolectrlhandler_null:true
|
||||||
};
|
};
|
||||||
|
|
||||||
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
|
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));
|
||||||
|
@ -67,6 +67,7 @@ struct wincaps
|
|||||||
unsigned has_disabled_user_tos_setting : 1;
|
unsigned has_disabled_user_tos_setting : 1;
|
||||||
unsigned has_fileid_dirinfo : 1;
|
unsigned has_fileid_dirinfo : 1;
|
||||||
unsigned has_exclusiveaddruse : 1;
|
unsigned has_exclusiveaddruse : 1;
|
||||||
|
unsigned supports_setconsolectrlhandler_null : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wincapc
|
class wincapc
|
||||||
@ -140,6 +141,7 @@ public:
|
|||||||
bool IMPLEMENT (has_disabled_user_tos_setting)
|
bool IMPLEMENT (has_disabled_user_tos_setting)
|
||||||
bool IMPLEMENT (has_fileid_dirinfo)
|
bool IMPLEMENT (has_fileid_dirinfo)
|
||||||
bool IMPLEMENT (has_exclusiveaddruse)
|
bool IMPLEMENT (has_exclusiveaddruse)
|
||||||
|
bool IMPLEMENT (supports_setconsolectrlhandler_null)
|
||||||
|
|
||||||
#undef IMPLEMENT
|
#undef IMPLEMENT
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user