* wincap.h (wincaps:pty_needs_alloc_console): New element.

(wincapc:pty_needs_alloc_console): New function.
* wincap.cc: Add pty_needs_alloc_console throughout.
* fhandler_tty.cc (fhandler_tty_slave::open): Open an "invisible" console on
first pty allocation.
This commit is contained in:
Christopher Faylor 2003-04-20 01:36:15 +00:00
parent afa18d8a69
commit 6b3bdf38e0
4 changed files with 46 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2003-04-19 Christopher Faylor <cgf@redhat.com>
* wincap.h (wincaps:pty_needs_alloc_console): New element.
(wincapc:pty_needs_alloc_console): New function.
* wincap.cc: Add pty_needs_alloc_console throughout.
* fhandler_tty.cc (fhandler_tty_slave::open): Open an "invisible"
console on first pty allocation.
2003-04-18 Christopher Faylor <cgf@redhat.com> 2003-04-18 Christopher Faylor <cgf@redhat.com>
* fhandler_tty.cc (fhandler_tty_slave::open): Allocate a console * fhandler_tty.cc (fhandler_tty_slave::open): Allocate a console

View File

@ -9,6 +9,8 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include "winsup.h" #include "winsup.h"
#include <wingdi.h>
#include <winuser.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -554,9 +556,19 @@ fhandler_tty_slave::open (path_conv *, int flags, mode_t)
set_open_status (); set_open_status ();
if (!output_done_event) if (!output_done_event)
{ {
if (fhandler_console::open_fhs++ == 0) if (fhandler_console::open_fhs++ == 0
&& wincap.pty_needs_alloc_console ())
{ {
BOOL b = AllocConsole (); BOOL b;
HWINSTA h = CreateWindowStation (NULL, 0, GENERIC_READ | GENERIC_WRITE, &sec_none_nih);
termios_printf ("CreateWindowStation %p, %E", h);
if (h)
{
b = SetProcessWindowStation (h);
termios_printf ("SetProcessWindowStation %d, %E", b);
}
b = AllocConsole (); // will cause flashing if workstation
// stuff fails
termios_printf ("%d = AllocConsole ()", b); termios_printf ("%d = AllocConsole ()", b);
} }
termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs); termios_printf ("incremented open_fhs %d", fhandler_console::open_fhs);

View File

@ -47,7 +47,8 @@ static NO_COPY wincaps wincap_unknown = {
has_64bit_file_access:false, has_64bit_file_access:false,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:false, supports_reading_modem_output_lines:false,
needs_memory_protection:false needs_memory_protection:false,
pty_needs_alloc_console:false
}; };
static NO_COPY wincaps wincap_95 = { static NO_COPY wincaps wincap_95 = {
@ -86,7 +87,8 @@ static NO_COPY wincaps wincap_95 = {
has_64bit_file_access:false, has_64bit_file_access:false,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:false, supports_reading_modem_output_lines:false,
needs_memory_protection:false needs_memory_protection:false,
pty_needs_alloc_console:false
}; };
static NO_COPY wincaps wincap_95osr2 = { static NO_COPY wincaps wincap_95osr2 = {
@ -125,7 +127,8 @@ static NO_COPY wincaps wincap_95osr2 = {
has_64bit_file_access:false, has_64bit_file_access:false,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:false, supports_reading_modem_output_lines:false,
needs_memory_protection:false needs_memory_protection:false,
pty_needs_alloc_console:false
}; };
static NO_COPY wincaps wincap_98 = { static NO_COPY wincaps wincap_98 = {
@ -164,7 +167,8 @@ static NO_COPY wincaps wincap_98 = {
has_64bit_file_access:false, has_64bit_file_access:false,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:false, supports_reading_modem_output_lines:false,
needs_memory_protection:false needs_memory_protection:false,
pty_needs_alloc_console:false
}; };
static NO_COPY wincaps wincap_98se = { static NO_COPY wincaps wincap_98se = {
@ -203,7 +207,8 @@ static NO_COPY wincaps wincap_98se = {
has_64bit_file_access:false, has_64bit_file_access:false,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:false, supports_reading_modem_output_lines:false,
needs_memory_protection:false needs_memory_protection:false,
pty_needs_alloc_console:false
}; };
static NO_COPY wincaps wincap_me = { static NO_COPY wincaps wincap_me = {
@ -242,7 +247,8 @@ static NO_COPY wincaps wincap_me = {
has_64bit_file_access:false, has_64bit_file_access:false,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:false, supports_reading_modem_output_lines:false,
needs_memory_protection:false needs_memory_protection:false,
pty_needs_alloc_console:false
}; };
static NO_COPY wincaps wincap_nt3 = { static NO_COPY wincaps wincap_nt3 = {
@ -281,7 +287,8 @@ static NO_COPY wincaps wincap_nt3 = {
has_64bit_file_access:true, has_64bit_file_access:true,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:true, supports_reading_modem_output_lines:true,
needs_memory_protection:true needs_memory_protection:true,
pty_needs_alloc_console:true
}; };
static NO_COPY wincaps wincap_nt4 = { static NO_COPY wincaps wincap_nt4 = {
@ -320,7 +327,8 @@ static NO_COPY wincaps wincap_nt4 = {
has_64bit_file_access:true, has_64bit_file_access:true,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:true, supports_reading_modem_output_lines:true,
needs_memory_protection:true needs_memory_protection:true,
pty_needs_alloc_console:true
}; };
static NO_COPY wincaps wincap_nt4sp4 = { static NO_COPY wincaps wincap_nt4sp4 = {
@ -359,7 +367,8 @@ static NO_COPY wincaps wincap_nt4sp4 = {
has_64bit_file_access:true, has_64bit_file_access:true,
has_process_io_counters:false, has_process_io_counters:false,
supports_reading_modem_output_lines:true, supports_reading_modem_output_lines:true,
needs_memory_protection:true needs_memory_protection:true,
pty_needs_alloc_console:true
}; };
static NO_COPY wincaps wincap_2000 = { static NO_COPY wincaps wincap_2000 = {
@ -398,7 +407,8 @@ static NO_COPY wincaps wincap_2000 = {
has_64bit_file_access:true, has_64bit_file_access:true,
has_process_io_counters:true, has_process_io_counters:true,
supports_reading_modem_output_lines:true, supports_reading_modem_output_lines:true,
needs_memory_protection:true needs_memory_protection:true,
pty_needs_alloc_console:true
}; };
static NO_COPY wincaps wincap_xp = { static NO_COPY wincaps wincap_xp = {
@ -437,7 +447,8 @@ static NO_COPY wincaps wincap_xp = {
has_64bit_file_access:true, has_64bit_file_access:true,
has_process_io_counters:true, has_process_io_counters:true,
supports_reading_modem_output_lines:true, supports_reading_modem_output_lines:true,
needs_memory_protection:true needs_memory_protection:true,
pty_needs_alloc_console:true
}; };
wincapc wincap; wincapc wincap;

View File

@ -49,6 +49,7 @@ struct wincaps
unsigned has_process_io_counters : 1; unsigned has_process_io_counters : 1;
unsigned supports_reading_modem_output_lines : 1; unsigned supports_reading_modem_output_lines : 1;
unsigned needs_memory_protection : 1; unsigned needs_memory_protection : 1;
unsigned pty_needs_alloc_console : 1;
}; };
class wincapc class wincapc
@ -102,6 +103,7 @@ public:
bool IMPLEMENT (has_process_io_counters) bool IMPLEMENT (has_process_io_counters)
bool IMPLEMENT (supports_reading_modem_output_lines) bool IMPLEMENT (supports_reading_modem_output_lines)
bool IMPLEMENT (needs_memory_protection) bool IMPLEMENT (needs_memory_protection)
bool IMPLEMENT (pty_needs_alloc_console)
#undef IMPLEMENT #undef IMPLEMENT
}; };