From aba77cbe8fddb0c1d9d544eee03aa95faf180c01 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 15 Apr 2012 17:51:22 +0000 Subject: wincap.h: Rename assitant to assistant throughout. wincap.cc: Ditto. * devices.in (exists_console): Use fhandler_console::exists () rather than raw test. * devices.cc: Regenerate. * fhandler.h (fhandler_console::exists): Define new function. * fhandler_console.cc (fhandler_console::need_invisible): Use fhandler_console::exists () rather than raw test. * spawn.cc: Rename assitant to assistant throughout. (child_info_spawn::worker): Simplify test for when to start a non-Cygwin process in its own process group. Just do it whenever we start a non-Cygwin process. --- winsup/cygwin/ChangeLog | 15 +++++++++++++++ winsup/cygwin/devices.cc | 5 ++++- winsup/cygwin/devices.in | 5 ++++- winsup/cygwin/fhandler.h | 1 + winsup/cygwin/fhandler_console.cc | 2 +- winsup/cygwin/spawn.cc | 16 +++++----------- winsup/cygwin/wincap.cc | 16 ++++++++-------- winsup/cygwin/wincap.h | 4 ++-- 8 files changed, 40 insertions(+), 24 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b5dbd7bd8..6e8b5b5e1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,18 @@ +2012-04-15 Christopher Faylor + + wincap.h: Rename assitant to assistant throughout. + wincap.cc: Ditto. + * devices.in (exists_console): Use fhandler_console::exists () rather + than raw test. + * devices.cc: Regenerate. + * fhandler.h (fhandler_console::exists): Define new function. + * fhandler_console.cc (fhandler_console::need_invisible): Use + fhandler_console::exists () rather than raw test. + * spawn.cc: Rename assitant to assistant throughout. + (child_info_spawn::worker): Simplify test for when to start a + non-Cygwin process in its own process group. Just do it whenever we + start a non-Cygwin process. + 2012-04-12 Christopher Faylor * devices.in (exists_console): Allow /dev/con{sole,in,out} to be diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index d67bcf4ba..9c8a0d03c 100644 --- a/winsup/cygwin/devices.cc +++ b/winsup/cygwin/devices.cc @@ -6,7 +6,10 @@ #include "tty.h" #include "pinfo.h" #include "shared_info.h" +#include "path.h" +#include "fhandler.h" #include "ntdll.h" + typedef const device *KR_device_t; @@ -73,7 +76,7 @@ exists_console (const device& dev) case FH_CONSOLE: case FH_CONIN: case FH_CONOUT: - return !!GetConsoleCP (); + return fhandler_console::exists (); default: /* Only show my own console device (for now?) */ return iscons_dev (myself->ctty) && myself->ctty == devn; diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in index b656886ee..09a1f7da5 100644 --- a/winsup/cygwin/devices.in +++ b/winsup/cygwin/devices.in @@ -5,7 +5,10 @@ #include "tty.h" #include "pinfo.h" #include "shared_info.h" +#include "path.h" +#include "fhandler.h" #include "ntdll.h" + typedef const device *KR_device_t; } %type KR_device_t @@ -69,7 +72,7 @@ exists_console (const device& dev) case FH_CONSOLE: case FH_CONIN: case FH_CONOUT: - return !!GetConsoleCP (); + return fhandler_console::exists (); default: /* Only show my own console device (for now?) */ return iscons_dev (myself->ctty) && myself->ctty == devn; diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 84d531420..20b91392c 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1377,6 +1377,7 @@ private: ssize_t __stdcall write (const void *ptr, size_t len); void doecho (const void *str, DWORD len) { (void) write (str, len); } int close (); + static bool exists () {return !!GetConsoleCP ();} int tcflush (int); int tcsetattr (int a, const struct termios *t); diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index d2e993fb0..8c756535d 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -2371,7 +2371,7 @@ bool fhandler_console::need_invisible () { BOOL b = false; - if (GetConsoleCP ()) + if (exists ()) invisible_console = false; else { diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index c05c7af9f..d296597d1 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -453,7 +453,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, c_flags |= CREATE_SEPARATE_WOW_VDM | CREATE_UNICODE_ENVIRONMENT; - if (wincap.has_program_compatibility_assitant ()) + if (wincap.has_program_compatibility_assistant ()) { /* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround issues with the "Program Compatibility Assistant (PCA) Service" @@ -599,16 +599,10 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, && (!iscygwin () || mode != _P_OVERLAY || ::cygheap->fdtab.need_fixup_before ())) c_flags |= CREATE_SUSPENDED; - /* If a native application should be spawned, we test here if the spawning - process is running in a console and, if so, if it's a foreground or - background process. If it's a background process, we start the native - process with the CREATE_NEW_PROCESS_GROUP flag set. This lets the native - process ignore Ctrl-C by default. If we don't do that, pressing Ctrl-C - in a console will break native processes running in the background, - because the Ctrl-C event is sent to all processes in the console, unless - they ignore it explicitely. CREATE_NEW_PROCESS_GROUP does that for us. */ - if (!iscygwin () && myself->ctty >= 0 && iscons_dev (myself->ctty) - && fhandler_console::tc_getpgid () != myself->pgid) + /* Give non-Cygwin processes their own process group since they will be + dealing with CTRL-C themselves. Not sure if this is correct for spawn*() + or not though. */ + if (!iscygwin () && fhandler_console::exists ()) c_flags |= CREATE_NEW_PROCESS_GROUP; refresh_cygheap (); diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index 6fe172f77..495e3a36f 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -53,7 +53,7 @@ wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = { has_stack_size_param_is_a_reservation:false, has_console_logon_sid:false, wow64_has_secondary_stack:false, - has_program_compatibility_assitant:false, + has_program_compatibility_assistant:false, kernel_is_always_casesensitive:true, }; @@ -87,7 +87,7 @@ wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) = has_stack_size_param_is_a_reservation:false, has_console_logon_sid:false, wow64_has_secondary_stack:false, - has_program_compatibility_assitant:false, + has_program_compatibility_assistant:false, kernel_is_always_casesensitive:true, }; @@ -121,7 +121,7 @@ wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = { has_stack_size_param_is_a_reservation:true, has_console_logon_sid:false, wow64_has_secondary_stack:false, - has_program_compatibility_assitant:false, + has_program_compatibility_assistant:false, kernel_is_always_casesensitive:false, }; @@ -155,7 +155,7 @@ wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = { has_stack_size_param_is_a_reservation:true, has_console_logon_sid:false, wow64_has_secondary_stack:false, - has_program_compatibility_assitant:false, + has_program_compatibility_assistant:false, kernel_is_always_casesensitive:false, }; @@ -189,7 +189,7 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = { has_stack_size_param_is_a_reservation:true, has_console_logon_sid:false, wow64_has_secondary_stack:false, - has_program_compatibility_assitant:false, + has_program_compatibility_assistant:false, kernel_is_always_casesensitive:false, }; @@ -223,7 +223,7 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { has_stack_size_param_is_a_reservation:true, has_console_logon_sid:false, wow64_has_secondary_stack:true, - has_program_compatibility_assitant:false, + has_program_compatibility_assistant:false, kernel_is_always_casesensitive:false, }; @@ -257,7 +257,7 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { has_stack_size_param_is_a_reservation:true, has_console_logon_sid:false, wow64_has_secondary_stack:false, - has_program_compatibility_assitant:true, + has_program_compatibility_assistant:true, kernel_is_always_casesensitive:false, }; @@ -291,7 +291,7 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { has_stack_size_param_is_a_reservation:true, has_console_logon_sid:true, wow64_has_secondary_stack:false, - has_program_compatibility_assitant:true, + has_program_compatibility_assistant:true, kernel_is_always_casesensitive:false, }; diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index 3ca5d87ea..f22c194a9 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -43,7 +43,7 @@ struct wincaps unsigned has_stack_size_param_is_a_reservation : 1; unsigned has_console_logon_sid : 1; unsigned wow64_has_secondary_stack : 1; - unsigned has_program_compatibility_assitant : 1; + unsigned has_program_compatibility_assistant : 1; unsigned kernel_is_always_casesensitive : 1; }; @@ -96,7 +96,7 @@ public: bool IMPLEMENT (has_stack_size_param_is_a_reservation) bool IMPLEMENT (has_console_logon_sid) bool IMPLEMENT (wow64_has_secondary_stack) - bool IMPLEMENT (has_program_compatibility_assitant) + bool IMPLEMENT (has_program_compatibility_assistant) bool IMPLEMENT (kernel_is_always_casesensitive) #undef IMPLEMENT -- cgit v1.2.3