* exceptions.cc (dummy_ctrl_c_handler): Remove.

(init_console_handler): Drop has_null_console_handler_routine checks.
	* fhandler_raw.cc (fhandler_dev_raw::open): Drop has_raw_devices check.
	* fhandler_serial.cc (fhandler_serial::open): Drop
	.supports_reading_modem_output_lines check.
	* miscfuncs.cc (low_priority_sleep): Drop has_switch_to_thread check.
	* shared.cc (open_shared): Drop needs_memory_protection checks.
	* spawn.cc (spawn_guts): Drop start_proc_suspended check.
	* uname.cc (uname): Drop has_valid_processorlevel check.
	* wincap.cc: Remove has_raw_devices, has_valid_processorlevel,
	supports_reading_modem_output_lines, needs_memory_protection,
	has_switch_to_thread, start_proc_suspended and
	has_null_console_handler_routine throughout.
	* wincap.h: Ditto.
This commit is contained in:
Corinna Vinschen 2007-02-23 10:51:59 +00:00
parent 0ed760d75e
commit aaee2ffaed
11 changed files with 34 additions and 124 deletions

View File

@ -1,3 +1,20 @@
2007-02-23 Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (dummy_ctrl_c_handler): Remove.
(init_console_handler): Drop has_null_console_handler_routine checks.
* fhandler_raw.cc (fhandler_dev_raw::open): Drop has_raw_devices check.
* fhandler_serial.cc (fhandler_serial::open): Drop
.supports_reading_modem_output_lines check.
* miscfuncs.cc (low_priority_sleep): Drop has_switch_to_thread check.
* shared.cc (open_shared): Drop needs_memory_protection checks.
* spawn.cc (spawn_guts): Drop start_proc_suspended check.
* uname.cc (uname): Drop has_valid_processorlevel check.
* wincap.cc: Remove has_raw_devices, has_valid_processorlevel,
supports_reading_modem_output_lines, needs_memory_protection,
has_switch_to_thread, start_proc_suspended and
has_null_console_handler_routine throughout.
* wincap.h: Ditto.
2007-02-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::lseek): Drop 9x considerations.

View File

@ -94,26 +94,17 @@ NO_COPY static struct
/* Initialization code. */
BOOL WINAPI
dummy_ctrl_c_handler (DWORD)
{
return TRUE;
}
void
init_console_handler (bool install_handler)
{
BOOL res;
SetConsoleCtrlHandler (ctrl_c_handler, FALSE);
if (wincap.has_null_console_handler_routine ())
SetConsoleCtrlHandler (NULL, FALSE);
SetConsoleCtrlHandler (NULL, FALSE);
if (install_handler)
res = SetConsoleCtrlHandler (ctrl_c_handler, TRUE);
else if (wincap.has_null_console_handler_routine ())
res = SetConsoleCtrlHandler (NULL, TRUE);
else
res = SetConsoleCtrlHandler (dummy_ctrl_c_handler, TRUE);
res = SetConsoleCtrlHandler (NULL, TRUE);
if (!res)
system_printf ("SetConsoleCtrlHandler failed, %E");
}

View File

@ -1,7 +1,7 @@
/* external.cc: Interface to Cygwin internals from external programs.
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006 Red Hat, Inc.
2006, 2007 Red Hat, Inc.
Written by Christopher Faylor <cgf@cygnus.com>

View File

@ -65,13 +65,6 @@ fhandler_dev_raw::fstat (struct __stat64 *buf)
int
fhandler_dev_raw::open (int flags, mode_t)
{
if (!wincap.has_raw_devices ())
{
set_errno (ENOENT);
debug_printf ("%s is accessible under NT/W2K only", get_win32_name ());
return 0;
}
/* Check for illegal flags. */
if (get_major () != DEV_TAPE_MAJOR && (flags & (O_APPEND | O_EXCL)))
{

View File

@ -1,6 +1,7 @@
/* fhandler_serial.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007 Red Hat, Inc.
This file is part of Cygwin.
@ -262,23 +263,6 @@ fhandler_serial::open (int flags, mode_t mode)
system_printf ("couldn't set initial state for %s, %E", get_name ());
}
/* setting rts and dtr to known state so that ioctl() function with
request TIOCMGET could return correct value of RTS and DTR lines.
Important only for Win 9x systems */
if (!wincap.supports_reading_modem_output_lines ())
{
if (EscapeCommFunction (get_handle (), SETDTR) == 0)
system_printf ("couldn't set initial state of DTR for %s, %E", get_name ());
if (EscapeCommFunction (get_handle (), SETRTS) == 0)
system_printf ("couldn't set initial state of RTS for %s, %E", get_name ());
/* even though one of above functions fail I have to set rts and dtr
variables to initial value. */
rts = TIOCM_RTS;
dtr = TIOCM_DTR;
}
SetCommMask (get_handle (), EV_RXCHAR);
set_open_status ();
syscall_printf ("%p = fhandler_serial::open (%s, %p, %p)",

View File

@ -1,7 +1,7 @@
/* miscfuncs.cc: misc funcs that don't belong anywhere else
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006 Red Hat, Inc.
2005, 2006, 2007 Red Hat, Inc.
This file is part of Cygwin.
@ -246,7 +246,7 @@ low_priority_sleep (DWORD secs)
staylow = true;
}
if (!secs && wincap.has_switch_to_thread ())
if (!secs)
{
for (int i = 0; i < 3; i++)
SwitchToThread ();

View File

@ -69,8 +69,7 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
void *shared;
void *addr;
if ((m == SH_JUSTCREATE || m == SH_JUSTOPEN)
|| !wincap.needs_memory_protection () && offsets[0])
if (m == SH_JUSTCREATE || m == SH_JUSTOPEN)
addr = NULL;
else
{
@ -122,7 +121,7 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
if (!shared)
api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", mapname, shared_h);
if (m == SH_USER_SHARED && offsets[0] && wincap.needs_memory_protection ())
if (m == SH_USER_SHARED && offsets[0])
{
ptrdiff_t delta = (caddr_t) shared - (caddr_t) off_addr (0);
offsets[0] = (caddr_t) shared - (caddr_t) cygwin_hmodule;

View File

@ -460,8 +460,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
So we have to start the child in suspend state, unfortunately, to avoid
a race condition. */
if (!newargv.win16_exe
&& (wincap.start_proc_suspended () || mode != _P_OVERLAY
|| cygheap->fdtab.need_fixup_before ()))
&& (mode != _P_OVERLAY || cygheap->fdtab.need_fixup_before ()))
c_flags |= CREATE_SUSPENDED;
runpath = null_app_name ? NULL : (const char *) real_path;

View File

@ -1,6 +1,7 @@
/* uname.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Red Hat, Inc.
Written by Steve Chamberlain of Cygnus Support, sac@cygnus.com
Rewritten by Geoffrey Noer of Cygnus Solutions, noer@cygnus.com
@ -72,23 +73,12 @@ uname (struct utsname *name)
{
case PROCESSOR_ARCHITECTURE_INTEL:
unsigned int ptype;
if (wincap.has_valid_processorlevel ())
{
if (sysinfo.wProcessorLevel < 3) /* Shouldn't happen. */
ptype = 3;
else if (sysinfo.wProcessorLevel > 9) /* P4 */
ptype = 6;
else
ptype = sysinfo.wProcessorLevel;
}
if (sysinfo.wProcessorLevel < 3) /* Shouldn't happen. */
ptype = 3;
else if (sysinfo.wProcessorLevel > 9) /* P4 */
ptype = 6;
else
{
if (sysinfo.dwProcessorType == PROCESSOR_INTEL_386 ||
sysinfo.dwProcessorType == PROCESSOR_INTEL_486)
ptype = sysinfo.dwProcessorType / 100;
else
ptype = PROCESSOR_INTEL_PENTIUM / 100;
}
ptype = sysinfo.wProcessorLevel;
__small_sprintf (name->machine, "i%d86", ptype);
break;
case PROCESSOR_ARCHITECTURE_IA64:

View File

@ -22,19 +22,12 @@ static NO_COPY wincaps wincap_unknown = {
has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:false,
has_switch_to_thread:true,
has_ioctl_storage_get_media_types_ex:false,
start_proc_suspended:false,
has_extended_priority_class:false,
has_guid_volumes:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:false,
has_disabled_user_tos_setting:false,
has_fileid_dirinfo:false,
@ -59,19 +52,12 @@ static NO_COPY wincaps wincap_nt4 = {
has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:false,
has_switch_to_thread:true,
has_ioctl_storage_get_media_types_ex:false,
start_proc_suspended:false,
has_extended_priority_class:false,
has_guid_volumes:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:false,
has_disabled_user_tos_setting:false,
has_fileid_dirinfo:false,
@ -96,19 +82,12 @@ static NO_COPY wincaps wincap_nt4sp4 = {
has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:false,
has_switch_to_thread:true,
has_ioctl_storage_get_media_types_ex:false,
start_proc_suspended:false,
has_extended_priority_class:false,
has_guid_volumes:false,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:false,
has_disabled_user_tos_setting:false,
has_fileid_dirinfo:false,
@ -133,19 +112,12 @@ static NO_COPY wincaps wincap_2000 = {
has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:true,
has_switch_to_thread:true,
has_ioctl_storage_get_media_types_ex:false,
start_proc_suspended:false,
has_extended_priority_class:true,
has_guid_volumes:true,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:false,
has_disabled_user_tos_setting:true,
has_fileid_dirinfo:true,
@ -170,19 +142,12 @@ static NO_COPY wincaps wincap_xp = {
has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:true,
has_switch_to_thread:true,
has_ioctl_storage_get_media_types_ex:true,
start_proc_suspended:false,
has_extended_priority_class:true,
has_guid_volumes:true,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:true,
has_disabled_user_tos_setting:true,
has_fileid_dirinfo:true,
@ -207,19 +172,12 @@ static NO_COPY wincaps wincap_2003 = {
has_physical_mem_access:false,
has_move_file_ex:true,
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:true,
has_switch_to_thread:true,
has_ioctl_storage_get_media_types_ex:true,
start_proc_suspended:false,
has_extended_priority_class:true,
has_guid_volumes:true,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:true,
has_disabled_user_tos_setting:true,
has_fileid_dirinfo:true,
@ -244,19 +202,12 @@ static NO_COPY wincaps wincap_vista = {
has_physical_mem_access:false,
has_move_file_ex:true,
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:true,
has_switch_to_thread:true,
has_ioctl_storage_get_media_types_ex:true,
start_proc_suspended:false,
has_extended_priority_class:true,
has_guid_volumes:true,
has_null_console_handler_routine:true,
has_disk_ex_ioctls:true,
has_disabled_user_tos_setting:true,
has_fileid_dirinfo:true,

View File

@ -22,19 +22,12 @@ struct wincaps
unsigned has_physical_mem_access : 1;
unsigned has_move_file_ex : 1;
unsigned has_unreliable_pipes : 1;
unsigned has_raw_devices : 1;
unsigned has_valid_processorlevel : 1;
unsigned has_process_io_counters : 1;
unsigned supports_reading_modem_output_lines : 1;
unsigned needs_memory_protection : 1;
unsigned pty_needs_alloc_console : 1;
unsigned has_terminal_services : 1;
unsigned has_switch_to_thread : 1;
unsigned has_ioctl_storage_get_media_types_ex : 1;
unsigned start_proc_suspended : 1;
unsigned has_extended_priority_class : 1;
unsigned has_guid_volumes : 1;
unsigned has_null_console_handler_routine : 1;
unsigned has_disk_ex_ioctls : 1;
unsigned has_disabled_user_tos_setting : 1;
unsigned has_fileid_dirinfo : 1;
@ -75,19 +68,12 @@ public:
bool IMPLEMENT (has_physical_mem_access)
bool IMPLEMENT (has_move_file_ex)
bool IMPLEMENT (has_unreliable_pipes)
bool IMPLEMENT (has_raw_devices)
bool IMPLEMENT (has_valid_processorlevel)
bool IMPLEMENT (has_process_io_counters)
bool IMPLEMENT (supports_reading_modem_output_lines)
bool IMPLEMENT (needs_memory_protection)
bool IMPLEMENT (pty_needs_alloc_console)
bool IMPLEMENT (has_terminal_services)
bool IMPLEMENT (has_switch_to_thread)
bool IMPLEMENT (has_ioctl_storage_get_media_types_ex)
bool IMPLEMENT (start_proc_suspended)
bool IMPLEMENT (has_extended_priority_class)
bool IMPLEMENT (has_guid_volumes)
bool IMPLEMENT (has_null_console_handler_routine)
bool IMPLEMENT (has_disk_ex_ioctls)
bool IMPLEMENT (has_disabled_user_tos_setting)
bool IMPLEMENT (has_fileid_dirinfo)