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.
This commit is contained in:
Christopher Faylor 2012-04-15 17:51:22 +00:00
parent 0a3819e655
commit aba77cbe8f
8 changed files with 40 additions and 24 deletions

View File

@ -1,3 +1,18 @@
2012-04-15 Christopher Faylor <me.cygwin2012@cgf.cx>
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 <me.cygwin2012@cgf.cx> 2012-04-12 Christopher Faylor <me.cygwin2012@cgf.cx>
* devices.in (exists_console): Allow /dev/con{sole,in,out} to be * devices.in (exists_console): Allow /dev/con{sole,in,out} to be

View File

@ -6,7 +6,10 @@
#include "tty.h" #include "tty.h"
#include "pinfo.h" #include "pinfo.h"
#include "shared_info.h" #include "shared_info.h"
#include "path.h"
#include "fhandler.h"
#include "ntdll.h" #include "ntdll.h"
typedef const device *KR_device_t; typedef const device *KR_device_t;
@ -73,7 +76,7 @@ exists_console (const device& dev)
case FH_CONSOLE: case FH_CONSOLE:
case FH_CONIN: case FH_CONIN:
case FH_CONOUT: case FH_CONOUT:
return !!GetConsoleCP (); return fhandler_console::exists ();
default: default:
/* Only show my own console device (for now?) */ /* Only show my own console device (for now?) */
return iscons_dev (myself->ctty) && myself->ctty == devn; return iscons_dev (myself->ctty) && myself->ctty == devn;

View File

@ -5,7 +5,10 @@
#include "tty.h" #include "tty.h"
#include "pinfo.h" #include "pinfo.h"
#include "shared_info.h" #include "shared_info.h"
#include "path.h"
#include "fhandler.h"
#include "ntdll.h" #include "ntdll.h"
typedef const device *KR_device_t; typedef const device *KR_device_t;
} }
%type KR_device_t %type KR_device_t
@ -69,7 +72,7 @@ exists_console (const device& dev)
case FH_CONSOLE: case FH_CONSOLE:
case FH_CONIN: case FH_CONIN:
case FH_CONOUT: case FH_CONOUT:
return !!GetConsoleCP (); return fhandler_console::exists ();
default: default:
/* Only show my own console device (for now?) */ /* Only show my own console device (for now?) */
return iscons_dev (myself->ctty) && myself->ctty == devn; return iscons_dev (myself->ctty) && myself->ctty == devn;

View File

@ -1377,6 +1377,7 @@ private:
ssize_t __stdcall write (const void *ptr, size_t len); ssize_t __stdcall write (const void *ptr, size_t len);
void doecho (const void *str, DWORD len) { (void) write (str, len); } void doecho (const void *str, DWORD len) { (void) write (str, len); }
int close (); int close ();
static bool exists () {return !!GetConsoleCP ();}
int tcflush (int); int tcflush (int);
int tcsetattr (int a, const struct termios *t); int tcsetattr (int a, const struct termios *t);

View File

@ -2371,7 +2371,7 @@ bool
fhandler_console::need_invisible () fhandler_console::need_invisible ()
{ {
BOOL b = false; BOOL b = false;
if (GetConsoleCP ()) if (exists ())
invisible_console = false; invisible_console = false;
else else
{ {

View File

@ -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; 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 /* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround
issues with the "Program Compatibility Assistant (PCA) Service" 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 && (!iscygwin () || mode != _P_OVERLAY
|| ::cygheap->fdtab.need_fixup_before ())) || ::cygheap->fdtab.need_fixup_before ()))
c_flags |= CREATE_SUSPENDED; c_flags |= CREATE_SUSPENDED;
/* If a native application should be spawned, we test here if the spawning /* Give non-Cygwin processes their own process group since they will be
process is running in a console and, if so, if it's a foreground or dealing with CTRL-C themselves. Not sure if this is correct for spawn*()
background process. If it's a background process, we start the native or not though. */
process with the CREATE_NEW_PROCESS_GROUP flag set. This lets the native if (!iscygwin () && fhandler_console::exists ())
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)
c_flags |= CREATE_NEW_PROCESS_GROUP; c_flags |= CREATE_NEW_PROCESS_GROUP;
refresh_cygheap (); refresh_cygheap ();

View File

@ -53,7 +53,7 @@ wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_stack_size_param_is_a_reservation:false, has_stack_size_param_is_a_reservation:false,
has_console_logon_sid:false, has_console_logon_sid:false,
wow64_has_secondary_stack:false, wow64_has_secondary_stack:false,
has_program_compatibility_assitant:false, has_program_compatibility_assistant:false,
kernel_is_always_casesensitive:true, 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_stack_size_param_is_a_reservation:false,
has_console_logon_sid:false, has_console_logon_sid:false,
wow64_has_secondary_stack:false, wow64_has_secondary_stack:false,
has_program_compatibility_assitant:false, has_program_compatibility_assistant:false,
kernel_is_always_casesensitive:true, 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_stack_size_param_is_a_reservation:true,
has_console_logon_sid:false, has_console_logon_sid:false,
wow64_has_secondary_stack:false, wow64_has_secondary_stack:false,
has_program_compatibility_assitant:false, has_program_compatibility_assistant:false,
kernel_is_always_casesensitive: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_stack_size_param_is_a_reservation:true,
has_console_logon_sid:false, has_console_logon_sid:false,
wow64_has_secondary_stack:false, wow64_has_secondary_stack:false,
has_program_compatibility_assitant:false, has_program_compatibility_assistant:false,
kernel_is_always_casesensitive: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_stack_size_param_is_a_reservation:true,
has_console_logon_sid:false, has_console_logon_sid:false,
wow64_has_secondary_stack:false, wow64_has_secondary_stack:false,
has_program_compatibility_assitant:false, has_program_compatibility_assistant:false,
kernel_is_always_casesensitive: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_stack_size_param_is_a_reservation:true,
has_console_logon_sid:false, has_console_logon_sid:false,
wow64_has_secondary_stack:true, wow64_has_secondary_stack:true,
has_program_compatibility_assitant:false, has_program_compatibility_assistant:false,
kernel_is_always_casesensitive: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_stack_size_param_is_a_reservation:true,
has_console_logon_sid:false, has_console_logon_sid:false,
wow64_has_secondary_stack:false, wow64_has_secondary_stack:false,
has_program_compatibility_assitant:true, has_program_compatibility_assistant:true,
kernel_is_always_casesensitive:false, 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_stack_size_param_is_a_reservation:true,
has_console_logon_sid:true, has_console_logon_sid:true,
wow64_has_secondary_stack:false, wow64_has_secondary_stack:false,
has_program_compatibility_assitant:true, has_program_compatibility_assistant:true,
kernel_is_always_casesensitive:false, kernel_is_always_casesensitive:false,
}; };

View File

@ -43,7 +43,7 @@ struct wincaps
unsigned has_stack_size_param_is_a_reservation : 1; unsigned has_stack_size_param_is_a_reservation : 1;
unsigned has_console_logon_sid : 1; unsigned has_console_logon_sid : 1;
unsigned wow64_has_secondary_stack : 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; unsigned kernel_is_always_casesensitive : 1;
}; };
@ -96,7 +96,7 @@ public:
bool IMPLEMENT (has_stack_size_param_is_a_reservation) bool IMPLEMENT (has_stack_size_param_is_a_reservation)
bool IMPLEMENT (has_console_logon_sid) bool IMPLEMENT (has_console_logon_sid)
bool IMPLEMENT (wow64_has_secondary_stack) bool IMPLEMENT (wow64_has_secondary_stack)
bool IMPLEMENT (has_program_compatibility_assitant) bool IMPLEMENT (has_program_compatibility_assistant)
bool IMPLEMENT (kernel_is_always_casesensitive) bool IMPLEMENT (kernel_is_always_casesensitive)
#undef IMPLEMENT #undef IMPLEMENT