* dcrt0.cc (_dll_crt0): Accommodate breaking apart of early_stuff_init.

* exceptions.cc (early_stuff_init): Delete.
(init_console_handler): New function - top half of early_stuff_init.
(init_global_security): New function - bottom half of early_stuff_init.
(sig_handle): Avoid special hExeced test for SIGINT.  Just terminate the
captive process.
(signal_exit): Add debugging output.
* fhandler_tty.cc (fhandler_tty_slave::open): Don't allocate a console if one
already seems to exist.  Properly initialize ctrl-c handling if we do allocate
a console.
* winsup.h (early_stuff_init): Delete declaration.
(init_console_handler): New declaration.
(init_global_security): New declaration.
This commit is contained in:
Christopher Faylor 2003-09-12 06:41:53 +00:00
parent 3a25635489
commit fb3dd71676
5 changed files with 36 additions and 9 deletions

View File

@ -1,3 +1,19 @@
2003-09-12 Christopher Faylor <cgf@redhat.com>
* dcrt0.cc (_dll_crt0): Accommodate breaking apart of early_stuff_init.
* exceptions.cc (early_stuff_init): Delete.
(init_console_handler): New function - top half of early_stuff_init.
(init_global_security): New function - bottom half of early_stuff_init.
(sig_handle): Avoid special hExeced test for SIGINT. Just terminate
the captive process.
(signal_exit): Add debugging output.
* fhandler_tty.cc (fhandler_tty_slave::open): Don't allocate a console
if one already seems to exist. Properly initialize ctrl-c handling if
we do allocate a console.
* winsup.h (early_stuff_init): Delete declaration.
(init_console_handler): New declaration.
(init_global_security): New declaration.
2003-09-11 Christopher Faylor <cgf@redhat.com> 2003-09-11 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (path_conv::ndisk_links): Rename from * fhandler_disk_file.cc (path_conv::ndisk_links): Rename from

View File

@ -859,7 +859,8 @@ _dll_crt0 ()
main_environ = user_data->envptr; main_environ = user_data->envptr;
*main_environ = NULL; *main_environ = NULL;
early_stuff_init (); init_console_handler ();
init_global_security ();
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (), if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
GetCurrentProcess (), &hMainProc, 0, FALSE, GetCurrentProcess (), &hMainProc, 0, FALSE,
DUPLICATE_SAME_ACCESS)) DUPLICATE_SAME_ACCESS))

View File

@ -115,12 +115,16 @@ init_exception_handler (exception_list *el)
#endif #endif
void void
early_stuff_init () init_console_handler ()
{ {
(void) SetConsoleCtrlHandler (ctrl_c_handler, FALSE); (void) SetConsoleCtrlHandler (ctrl_c_handler, FALSE);
if (!SetConsoleCtrlHandler (ctrl_c_handler, TRUE)) if (!SetConsoleCtrlHandler (ctrl_c_handler, TRUE))
system_printf ("SetConsoleCtrlHandler failed, %E"); system_printf ("SetConsoleCtrlHandler failed, %E");
}
void
init_global_security ()
{
/* Initialize global security attribute stuff */ /* Initialize global security attribute stuff */
sec_none.nLength = sec_none_nih.nLength = sec_none.nLength = sec_none_nih.nLength =
@ -1024,7 +1028,7 @@ sig_handle (int sig)
if (handler == (void *) SIG_DFL) if (handler == (void *) SIG_DFL)
{ {
if (sig == SIGCHLD || sig == SIGIO || sig == SIGCONT || sig == SIGWINCH if (sig == SIGCHLD || sig == SIGIO || sig == SIGCONT || sig == SIGWINCH
|| sig == SIGURG || (hExeced && sig == SIGINT)) || sig == SIGURG)
{ {
sigproc_printf ("default signal %d ignored", sig); sigproc_printf ("default signal %d ignored", sig);
goto done; goto done;
@ -1107,7 +1111,10 @@ signal_exit (int rc)
user_data->resourcelocks->Init (); user_data->resourcelocks->Init ();
if (hExeced) if (hExeced)
{
sigproc_printf ("terminating captive process");
TerminateProcess (hExeced, rc); TerminateProcess (hExeced, rc);
}
sigproc_printf ("about to call do_exit (%x)", rc); sigproc_printf ("about to call do_exit (%x)", rc);
(void) SetEvent (signal_arrived); (void) SetEvent (signal_arrived);

View File

@ -555,8 +555,8 @@ fhandler_tty_slave::open (path_conv *, int flags, mode_t)
set_output_handle (to_master_local); set_output_handle (to_master_local);
set_open_status (); set_open_status ();
if (fhandler_console::open_fhs++ == 0 && !output_done_event if (fhandler_console::open_fhs++ == 0 && !GetConsoleCP ()
&& wincap.pty_needs_alloc_console ()) && !output_done_event && wincap.pty_needs_alloc_console ())
{ {
BOOL b; BOOL b;
HWINSTA h = CreateWindowStation (NULL, 0, GENERIC_READ | GENERIC_WRITE, &sec_none_nih); HWINSTA h = CreateWindowStation (NULL, 0, GENERIC_READ | GENERIC_WRITE, &sec_none_nih);
@ -568,7 +568,9 @@ fhandler_tty_slave::open (path_conv *, int flags, mode_t)
} }
b = AllocConsole (); // will cause flashing if workstation b = AllocConsole (); // will cause flashing if workstation
// stuff fails // stuff fails
termios_printf ("%d = AllocConsole ()", b); termios_printf ("%d = AllocConsole (), %E", b);
if (b)
init_console_handler ();
} }
termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs); termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs);
termios_printf ("tty%d opened", ttynum); termios_printf ("tty%d opened", ttynum);

View File

@ -223,7 +223,8 @@ void __stdcall to_timestruc_t (FILETIME * ptr, timestruc_t * out);
void __stdcall time_as_timestruc_t (timestruc_t * out); void __stdcall time_as_timestruc_t (timestruc_t * out);
void __stdcall set_console_title (char *); void __stdcall set_console_title (char *);
void early_stuff_init (); void init_console_handler ();
void init_global_security ();
int __stdcall check_null_str (const char *name) __attribute__ ((regparm(1))); int __stdcall check_null_str (const char *name) __attribute__ ((regparm(1)));
int __stdcall check_null_empty_str (const char *name) __attribute__ ((regparm(1))); int __stdcall check_null_empty_str (const char *name) __attribute__ ((regparm(1)));