* fhandler_console.cc (fhandler_console::need_invisible): Drop

pty_needs_alloc_console check.
	* spawn.cc (spawn_guts): Ditto.
	(av::fixup): Remove setting iscui.
	* syscalls.cc (rename): Drop has_move_file_ex checks.  Remove 9x
	specific code.
	* wincap.cc: Remove has_move_file_ex and pty_needs_alloc_console
	throughout.
	* wincap.h: Ditto.
This commit is contained in:
Corinna Vinschen 2007-02-23 12:01:52 +00:00
parent 7131554a69
commit b5cb5c9e64
7 changed files with 21 additions and 64 deletions

View File

@ -1,3 +1,15 @@
2007-02-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::need_invisible): Drop
pty_needs_alloc_console check.
* spawn.cc (spawn_guts): Ditto.
(av::fixup): Remove setting iscui.
* syscalls.cc (rename): Drop has_move_file_ex checks. Remove 9x
specific code.
* wincap.cc: Remove has_move_file_ex and pty_needs_alloc_console
throughout.
* wincap.h: Ditto.
2007-02-23 Corinna Vinschen <corinna@vinschen.de> 2007-02-23 Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (dummy_ctrl_c_handler): Remove. * exceptions.cc (dummy_ctrl_c_handler): Remove.

View File

@ -1850,7 +1850,7 @@ bool
fhandler_console::need_invisible () fhandler_console::need_invisible ()
{ {
BOOL b = false; BOOL b = false;
if (GetConsoleCP () || !wincap.pty_needs_alloc_console ()) if (GetConsoleCP ())
invisible_console = false; invisible_console = false;
else else
{ {

View File

@ -414,11 +414,6 @@ spawn_guts (const char * prog_arg, const char *const *argv,
si.hStdError = handle (2, true); si.hStdError = handle (2, true);
si.cb = sizeof (si); si.cb = sizeof (si);
if (!wincap.pty_needs_alloc_console () && newargv.iscui && myself->ctty == -1)
{
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
}
c_flags = GetPriorityClass (hMainProc); c_flags = GetPriorityClass (hMainProc);
sigproc_printf ("priority class %d", c_flags); sigproc_printf ("priority class %d", c_flags);
@ -965,7 +960,6 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
else else
real_path.set_cygexec (false); real_path.set_cygexec (false);
UnmapViewOfFile (buf); UnmapViewOfFile (buf);
iscui = subsys == IMAGE_SUBSYSTEM_WINDOWS_CUI;
break; break;
} }
} }

View File

@ -1418,20 +1418,12 @@ rename (const char *oldpath, const char *newpath)
code instead. code instead.
The order in the condition is (hopefully) trimmed for doing the least The order in the condition is (hopefully) trimmed for doing the least
expensive stuff first. Nevertheless it would be nice if 9x could expensive stuff first. */
generate the same error codes as NT.
NT generates ERROR_SHARING_VIOLATION in all cases, while 9x generates
ERROR_ACCESS_DENIED if the target path doesn't exist,
ERROR_ALREADY_EXISTS otherwise */
int len; int len;
DWORD lasterr; DWORD lasterr;
lasterr = GetLastError (); lasterr = GetLastError ();
if (real_old.isdir () if (real_old.isdir ()
&& ((lasterr == ERROR_SHARING_VIOLATION && wincap.has_move_file_ex ()) && lasterr == ERROR_SHARING_VIOLATION
|| (lasterr == ERROR_ACCESS_DENIED && !real_new.exists ()
&& !wincap.has_move_file_ex ())
|| (lasterr == ERROR_ALREADY_EXISTS && real_new.exists ()
&& !wincap.has_move_file_ex ()))
&& (len = strlen (real_old), strncasematch (real_old, real_new, len)) && (len = strlen (real_old), strncasematch (real_old, real_new, len))
&& real_new[len] == '\\') && real_new[len] == '\\')
SetLastError (ERROR_INVALID_PARAMETER); SetLastError (ERROR_INVALID_PARAMETER);
@ -1444,31 +1436,9 @@ rename (const char *oldpath, const char *newpath)
else if (MoveFile (real_old, real_new)) else if (MoveFile (real_old, real_new))
res = 0; res = 0;
} }
else if (wincap.has_move_file_ex ()) else if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (),
{
if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (),
MOVEFILE_REPLACE_EXISTING)) MOVEFILE_REPLACE_EXISTING))
res = 0; res = 0;
}
else if (lasterr == ERROR_ALREADY_EXISTS || lasterr == ERROR_FILE_EXISTS)
{
syscall_printf ("try win95 hack");
for (int i = 0; i < 2; i++)
{
if (!DeleteFileA (real_new) &&
GetLastError () != ERROR_FILE_NOT_FOUND)
{
syscall_printf ("deleting %s to be paranoid",
real_new.get_win32 ());
break;
}
else if (MoveFile (real_old, real_new))
{
res = 0;
break;
}
}
}
done: done:
if (res) if (res)

View File

@ -20,10 +20,8 @@ static NO_COPY wincaps wincap_unknown = {
has_security_descriptor_control:false, has_security_descriptor_control:false,
has_ip_helper_lib:false, has_ip_helper_lib:false,
has_physical_mem_access:true, has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_process_io_counters:false, has_process_io_counters:false,
pty_needs_alloc_console:true,
has_terminal_services:false, has_terminal_services:false,
has_ioctl_storage_get_media_types_ex:false, has_ioctl_storage_get_media_types_ex:false,
has_extended_priority_class:false, has_extended_priority_class:false,
@ -50,10 +48,8 @@ static NO_COPY wincaps wincap_nt4 = {
has_security_descriptor_control:false, has_security_descriptor_control:false,
has_ip_helper_lib:false, has_ip_helper_lib:false,
has_physical_mem_access:true, has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_process_io_counters:false, has_process_io_counters:false,
pty_needs_alloc_console:true,
has_terminal_services:false, has_terminal_services:false,
has_ioctl_storage_get_media_types_ex:false, has_ioctl_storage_get_media_types_ex:false,
has_extended_priority_class:false, has_extended_priority_class:false,
@ -80,10 +76,8 @@ static NO_COPY wincaps wincap_nt4sp4 = {
has_security_descriptor_control:false, has_security_descriptor_control:false,
has_ip_helper_lib:true, has_ip_helper_lib:true,
has_physical_mem_access:true, has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_process_io_counters:false, has_process_io_counters:false,
pty_needs_alloc_console:true,
has_terminal_services:false, has_terminal_services:false,
has_ioctl_storage_get_media_types_ex:false, has_ioctl_storage_get_media_types_ex:false,
has_extended_priority_class:false, has_extended_priority_class:false,
@ -110,10 +104,8 @@ static NO_COPY wincaps wincap_2000 = {
has_security_descriptor_control:true, has_security_descriptor_control:true,
has_ip_helper_lib:true, has_ip_helper_lib:true,
has_physical_mem_access:true, has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_process_io_counters:true, has_process_io_counters:true,
pty_needs_alloc_console:true,
has_terminal_services:true, has_terminal_services:true,
has_ioctl_storage_get_media_types_ex:false, has_ioctl_storage_get_media_types_ex:false,
has_extended_priority_class:true, has_extended_priority_class:true,
@ -140,10 +132,8 @@ static NO_COPY wincaps wincap_xp = {
has_security_descriptor_control:true, has_security_descriptor_control:true,
has_ip_helper_lib:true, has_ip_helper_lib:true,
has_physical_mem_access:true, has_physical_mem_access:true,
has_move_file_ex:true,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_process_io_counters:true, has_process_io_counters:true,
pty_needs_alloc_console:true,
has_terminal_services:true, has_terminal_services:true,
has_ioctl_storage_get_media_types_ex:true, has_ioctl_storage_get_media_types_ex:true,
has_extended_priority_class:true, has_extended_priority_class:true,
@ -170,10 +160,8 @@ static NO_COPY wincaps wincap_2003 = {
has_security_descriptor_control:true, has_security_descriptor_control:true,
has_ip_helper_lib:true, has_ip_helper_lib:true,
has_physical_mem_access:false, has_physical_mem_access:false,
has_move_file_ex:true,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_process_io_counters:true, has_process_io_counters:true,
pty_needs_alloc_console:true,
has_terminal_services:true, has_terminal_services:true,
has_ioctl_storage_get_media_types_ex:true, has_ioctl_storage_get_media_types_ex:true,
has_extended_priority_class:true, has_extended_priority_class:true,
@ -200,10 +188,8 @@ static NO_COPY wincaps wincap_vista = {
has_security_descriptor_control:true, has_security_descriptor_control:true,
has_ip_helper_lib:true, has_ip_helper_lib:true,
has_physical_mem_access:false, has_physical_mem_access:false,
has_move_file_ex:true,
has_unreliable_pipes:false, has_unreliable_pipes:false,
has_process_io_counters:true, has_process_io_counters:true,
pty_needs_alloc_console:true,
has_terminal_services:true, has_terminal_services:true,
has_ioctl_storage_get_media_types_ex:true, has_ioctl_storage_get_media_types_ex:true,
has_extended_priority_class:true, has_extended_priority_class:true,

View File

@ -20,10 +20,8 @@ struct wincaps
unsigned has_security_descriptor_control : 1; unsigned has_security_descriptor_control : 1;
unsigned has_ip_helper_lib : 1; unsigned has_ip_helper_lib : 1;
unsigned has_physical_mem_access : 1; unsigned has_physical_mem_access : 1;
unsigned has_move_file_ex : 1;
unsigned has_unreliable_pipes : 1; unsigned has_unreliable_pipes : 1;
unsigned has_process_io_counters : 1; unsigned has_process_io_counters : 1;
unsigned pty_needs_alloc_console : 1;
unsigned has_terminal_services : 1; unsigned has_terminal_services : 1;
unsigned has_ioctl_storage_get_media_types_ex : 1; unsigned has_ioctl_storage_get_media_types_ex : 1;
unsigned has_extended_priority_class : 1; unsigned has_extended_priority_class : 1;
@ -66,10 +64,8 @@ public:
bool IMPLEMENT (has_security_descriptor_control) bool IMPLEMENT (has_security_descriptor_control)
bool IMPLEMENT (has_ip_helper_lib) bool IMPLEMENT (has_ip_helper_lib)
bool IMPLEMENT (has_physical_mem_access) bool IMPLEMENT (has_physical_mem_access)
bool IMPLEMENT (has_move_file_ex)
bool IMPLEMENT (has_unreliable_pipes) bool IMPLEMENT (has_unreliable_pipes)
bool IMPLEMENT (has_process_io_counters) bool IMPLEMENT (has_process_io_counters)
bool IMPLEMENT (pty_needs_alloc_console)
bool IMPLEMENT (has_terminal_services) bool IMPLEMENT (has_terminal_services)
bool IMPLEMENT (has_ioctl_storage_get_media_types_ex) bool IMPLEMENT (has_ioctl_storage_get_media_types_ex)
bool IMPLEMENT (has_extended_priority_class) bool IMPLEMENT (has_extended_priority_class)

View File

@ -1,6 +1,6 @@
/* winf.h /* winf.h
Copyright 2003, 2004, 2005 Red Hat, Inc. Copyright 2006, 2007 Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@ -27,9 +27,8 @@ class av
public: public:
int argc; int argc;
bool win16_exe; bool win16_exe;
bool iscui; av (): argv (NULL) {}
av (): argv (NULL), iscui (false) {} av (int ac_in, const char * const *av_in) : calloced (0), argc (ac_in), win16_exe (false)
av (int ac_in, const char * const *av_in) : calloced (0), argc (ac_in), win16_exe (false), iscui (false)
{ {
argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 5) * sizeof (char *)); argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 5) * sizeof (char *));
memcpy (argv, av_in, (argc + 1) * sizeof (char *)); memcpy (argv, av_in, (argc + 1) * sizeof (char *));