diff options
author | Christopher Faylor <me@cgf.cx> | 2006-03-16 05:57:37 +0300 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-03-16 05:57:37 +0300 |
commit | 974f27a51acaa16269541985e22ee7590ba49670 (patch) | |
tree | 88561981b54b1c8012c6b9ed255b54cffe78bef1 /winsup | |
parent | 490cfb83e99515e5b5573ab74d73f15c582da1b6 (diff) |
* cygheap.cc (init_cygheap::manage_console_count): Turn console control handler
on/off depending on whether we have allocated a console or not.
* dcrt0.cc (child_info_fork::fork_retry): Add more potential retry statuses.
(dll_crt0_0): Turn on/off console control depending on whether we have a
controlling tty or not.
* exceptions.cc (init_console_handler): Change BOOL to bool.
* fhandler_console.cc (fhandler_console::need_invisible): Cosmetic change.
* winsup.h (init_console_handler): Reflect argument type change.
* wincap.h (supports_setconsolectrlhandler_null): Remove duplicate capability
throughout.
* wincap.cc: Ditto.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 17 | ||||
-rw-r--r-- | winsup/cygwin/cygheap.cc | 7 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 13 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/wincap.cc | 23 | ||||
-rw-r--r-- | winsup/cygwin/wincap.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/winsup.h | 2 |
8 files changed, 38 insertions, 32 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 480074b28..cb12f151b 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,20 @@ +2006-03-15 Christopher Faylor <cgf@timesys.com> + + * cygheap.cc (init_cygheap::manage_console_count): Turn console control + handler on/off depending on whether we have allocated a console or not. + * dcrt0.cc (child_info_fork::fork_retry): Add more potential retry + statuses. + (dll_crt0_0): Turn on/off console control depending on whether we have + a controlling tty or not. + * exceptions.cc (init_console_handler): Change BOOL to bool. + * fhandler_console.cc (fhandler_console::need_invisible): Cosmetic + change. + * winsup.h (init_console_handler): Reflect argument type change. + + * wincap.h (supports_setconsolectrlhandler_null): Remove duplicate + capability throughout. + * wincap.cc: Ditto. + 2006-03-14 Christopher Faylor <cgf@timesys.com> * child_info.h (child_info_fork::fork_retry): Declare new function. diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 122e6207a..0c555e37e 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -93,13 +93,16 @@ cygheap_fixup_in_child (bool execed) int init_cygheap::manage_console_count (const char *something, int amount, bool avoid_freeing_console) { + if (console_count == 0 && amount > 0) + init_console_handler (true); console_count += amount; debug_printf ("%s: console_count %d, amount %d, %s, avoid_freeing_console %d", something, console_count, amount, myctty (), avoid_freeing_console); if (!avoid_freeing_console && amount <= 0 && !console_count && myself->ctty == -1) { - FreeConsole (); - debug_printf ("freed console"); + BOOL res = FreeConsole (); + debug_printf ("freed console, res %d", res); + init_console_handler (false); } return console_count; } diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 26a749c0a..c309fb36c 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -651,9 +651,8 @@ child_info_fork::fork_retry (HANDLE h) switch (exit_code) { case STATUS_CONTROL_C_EXIT: - if (retry-- > 0) - return 0; - break; + case STATUS_DLL_INIT_FAILED: + case STATUS_DLL_INIT_FAILED_LOGOFF: case EXITCODE_RETRY: if (retry-- > 0) return 0; @@ -709,7 +708,6 @@ dll_crt0_0 () sigproc_init (); lock_process::init (); - init_console_handler (TRUE); _impure_ptr = _GLOBAL_REENT; _impure_ptr->_stdin = &_impure_ptr->__sf[0]; _impure_ptr->_stdout = &_impure_ptr->__sf[1]; @@ -736,7 +734,10 @@ dll_crt0_0 () child_proc_info = get_cygwin_startup_info (); if (!child_proc_info) - memory_init (); + { + memory_init (); + init_console_handler (myself->ctty >= 0); + } else { cygwin_user_h = child_proc_info->user_h; @@ -772,6 +773,7 @@ dll_crt0_0 () } break; } + init_console_handler (myself->ctty >= 0); } user_data->resourcelocks->Init (); @@ -782,6 +784,7 @@ dll_crt0_0 () pinfo_init (envp, envc); uinfo_init (); /* initialize user info */ } + _cygtls::init (); /* Initialize events */ diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 60c1d1783..53294cd63 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -100,7 +100,7 @@ dummy_ctrl_c_handler (DWORD dwCtrlType) } void -init_console_handler (BOOL install_handler) +init_console_handler (bool install_handler) { BOOL res; while (SetConsoleCtrlHandler (ctrl_c_handler, FALSE)) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index e3af92438..23f2cf8e7 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -1885,9 +1885,7 @@ fhandler_console::need_invisible () failed */ debug_printf ("h %p, horig %p, flags %p", h, horig, oi.dwFlags); if (horig && h && h != horig && SetProcessWindowStation (horig)) - { - CloseWindowStation (h); - } + CloseWindowStation (h); termios_printf ("%d = AllocConsole (), %E", b); invisible_console = true; } diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index e1b09a05b..caef37873 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -66,7 +66,6 @@ static NO_COPY wincaps wincap_unknown = { has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, has_exclusiveaddruse:false, - supports_setconsolectrlhandler_null:false }; static NO_COPY wincaps wincap_95 = { @@ -124,7 +123,6 @@ static NO_COPY wincaps wincap_95 = { has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, has_exclusiveaddruse:false, - supports_setconsolectrlhandler_null:false }; static NO_COPY wincaps wincap_95osr2 = { @@ -182,7 +180,6 @@ static NO_COPY wincaps wincap_95osr2 = { has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, has_exclusiveaddruse:false, - supports_setconsolectrlhandler_null:false }; static NO_COPY wincaps wincap_98 = { @@ -240,7 +237,6 @@ static NO_COPY wincaps wincap_98 = { has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, has_exclusiveaddruse:false, - supports_setconsolectrlhandler_null:false }; static NO_COPY wincaps wincap_98se = { @@ -298,7 +294,6 @@ static NO_COPY wincaps wincap_98se = { has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, has_exclusiveaddruse:false, - supports_setconsolectrlhandler_null:false }; static NO_COPY wincaps wincap_me = { @@ -356,7 +351,6 @@ static NO_COPY wincaps wincap_me = { has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, has_exclusiveaddruse:false, - supports_setconsolectrlhandler_null:false }; static NO_COPY wincaps wincap_nt3 = { @@ -414,7 +408,6 @@ static NO_COPY wincaps wincap_nt3 = { has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, has_exclusiveaddruse:false, - supports_setconsolectrlhandler_null:true }; static NO_COPY wincaps wincap_nt4 = { @@ -472,7 +465,6 @@ static NO_COPY wincaps wincap_nt4 = { has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, has_exclusiveaddruse:false, - supports_setconsolectrlhandler_null:true }; static NO_COPY wincaps wincap_nt4sp4 = { @@ -529,8 +521,7 @@ static NO_COPY wincaps wincap_nt4sp4 = { has_working_virtual_lock:true, has_disabled_user_tos_setting:false, has_fileid_dirinfo:false, - has_exclusiveaddruse:true, - supports_setconsolectrlhandler_null:true + has_exclusiveaddruse:true }; static NO_COPY wincaps wincap_2000 = { @@ -587,8 +578,7 @@ static NO_COPY wincaps wincap_2000 = { has_working_virtual_lock:true, has_disabled_user_tos_setting:true, has_fileid_dirinfo:true, - has_exclusiveaddruse:true, - supports_setconsolectrlhandler_null:true + has_exclusiveaddruse:true }; static NO_COPY wincaps wincap_xp = { @@ -645,8 +635,7 @@ static NO_COPY wincaps wincap_xp = { has_working_virtual_lock:true, has_disabled_user_tos_setting:true, has_fileid_dirinfo:true, - has_exclusiveaddruse:true, - supports_setconsolectrlhandler_null:true + has_exclusiveaddruse:true }; static NO_COPY wincaps wincap_2003 = { @@ -703,8 +692,7 @@ static NO_COPY wincaps wincap_2003 = { has_working_virtual_lock:true, has_disabled_user_tos_setting:true, has_fileid_dirinfo:true, - has_exclusiveaddruse:true, - supports_setconsolectrlhandler_null:true + has_exclusiveaddruse:true }; static NO_COPY wincaps wincap_vista = { @@ -761,8 +749,7 @@ static NO_COPY wincaps wincap_vista = { has_working_virtual_lock:true, has_disabled_user_tos_setting:true, has_fileid_dirinfo:true, - has_exclusiveaddruse:true, - supports_setconsolectrlhandler_null:true + has_exclusiveaddruse:true }; wincapc wincap __attribute__((section (".cygwin_dll_common"), shared)); diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index a8c0e5bfc..d4edfd3da 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -67,7 +67,6 @@ struct wincaps unsigned has_disabled_user_tos_setting : 1; unsigned has_fileid_dirinfo : 1; unsigned has_exclusiveaddruse : 1; - unsigned supports_setconsolectrlhandler_null : 1; }; class wincapc @@ -141,7 +140,6 @@ public: bool IMPLEMENT (has_disabled_user_tos_setting) bool IMPLEMENT (has_fileid_dirinfo) bool IMPLEMENT (has_exclusiveaddruse) - bool IMPLEMENT (supports_setconsolectrlhandler_null) #undef IMPLEMENT }; diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index b8cdd15b7..3695f4917 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -255,7 +255,7 @@ void __stdcall timeval_to_filetime (const struct timeval *, FILETIME *); /* Console related */ void __stdcall set_console_title (char *); -void init_console_handler (BOOL); +void init_console_handler (bool); void init_global_security (); |