From b5cb5c9e642a3b868024345fd31c71052e4b0932 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2007 12:01:52 +0000 Subject: [PATCH] * 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. --- winsup/cygwin/ChangeLog | 12 ++++++++++ winsup/cygwin/fhandler_console.cc | 2 +- winsup/cygwin/spawn.cc | 6 ----- winsup/cygwin/syscalls.cc | 40 ++++--------------------------- winsup/cygwin/wincap.cc | 14 ----------- winsup/cygwin/wincap.h | 4 ---- winsup/cygwin/winf.h | 7 +++--- 7 files changed, 21 insertions(+), 64 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 40f2551e1..b97b90206 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2007-02-23 Corinna Vinschen + + * 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 * exceptions.cc (dummy_ctrl_c_handler): Remove. diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 4bd04fbd0..a37cf5869 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -1850,7 +1850,7 @@ bool fhandler_console::need_invisible () { BOOL b = false; - if (GetConsoleCP () || !wincap.pty_needs_alloc_console ()) + if (GetConsoleCP ()) invisible_console = false; else { diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 7955f3eca..510ed210d 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -414,11 +414,6 @@ spawn_guts (const char * prog_arg, const char *const *argv, si.hStdError = handle (2, true); 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); 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 real_path.set_cygexec (false); UnmapViewOfFile (buf); - iscui = subsys == IMAGE_SUBSYSTEM_WINDOWS_CUI; break; } } diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index ed11037d9..1295a89c9 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1418,20 +1418,12 @@ rename (const char *oldpath, const char *newpath) code instead. The order in the condition is (hopefully) trimmed for doing the least - expensive stuff first. Nevertheless it would be nice if 9x could - 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 */ + expensive stuff first. */ int len; DWORD lasterr; lasterr = GetLastError (); if (real_old.isdir () - && ((lasterr == ERROR_SHARING_VIOLATION && wincap.has_move_file_ex ()) - || (lasterr == ERROR_ACCESS_DENIED && !real_new.exists () - && !wincap.has_move_file_ex ()) - || (lasterr == ERROR_ALREADY_EXISTS && real_new.exists () - && !wincap.has_move_file_ex ())) + && lasterr == ERROR_SHARING_VIOLATION && (len = strlen (real_old), strncasematch (real_old, real_new, len)) && real_new[len] == '\\') SetLastError (ERROR_INVALID_PARAMETER); @@ -1444,31 +1436,9 @@ rename (const char *oldpath, const char *newpath) else if (MoveFile (real_old, real_new)) res = 0; } - else if (wincap.has_move_file_ex ()) - { - if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (), - MOVEFILE_REPLACE_EXISTING)) - 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; - } - } - } + else if (MoveFileEx (real_old.get_win32 (), real_new.get_win32 (), + MOVEFILE_REPLACE_EXISTING)) + res = 0; done: if (res) diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index 0ebf83690..5c1bb8c26 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -20,10 +20,8 @@ static NO_COPY wincaps wincap_unknown = { has_security_descriptor_control:false, has_ip_helper_lib:false, has_physical_mem_access:true, - has_move_file_ex:true, has_unreliable_pipes:false, has_process_io_counters:false, - pty_needs_alloc_console:true, has_terminal_services:false, has_ioctl_storage_get_media_types_ex:false, has_extended_priority_class:false, @@ -50,10 +48,8 @@ static NO_COPY wincaps wincap_nt4 = { has_security_descriptor_control:false, has_ip_helper_lib:false, has_physical_mem_access:true, - has_move_file_ex:true, has_unreliable_pipes:false, has_process_io_counters:false, - pty_needs_alloc_console:true, has_terminal_services:false, has_ioctl_storage_get_media_types_ex:false, has_extended_priority_class:false, @@ -80,10 +76,8 @@ static NO_COPY wincaps wincap_nt4sp4 = { has_security_descriptor_control:false, has_ip_helper_lib:true, has_physical_mem_access:true, - has_move_file_ex:true, has_unreliable_pipes:false, has_process_io_counters:false, - pty_needs_alloc_console:true, has_terminal_services:false, has_ioctl_storage_get_media_types_ex:false, has_extended_priority_class:false, @@ -110,10 +104,8 @@ static NO_COPY wincaps wincap_2000 = { has_security_descriptor_control:true, has_ip_helper_lib:true, has_physical_mem_access:true, - has_move_file_ex:true, has_unreliable_pipes:false, has_process_io_counters:true, - pty_needs_alloc_console:true, has_terminal_services:true, has_ioctl_storage_get_media_types_ex:false, has_extended_priority_class:true, @@ -140,10 +132,8 @@ static NO_COPY wincaps wincap_xp = { has_security_descriptor_control:true, has_ip_helper_lib:true, has_physical_mem_access:true, - has_move_file_ex:true, has_unreliable_pipes:false, has_process_io_counters:true, - pty_needs_alloc_console:true, has_terminal_services:true, has_ioctl_storage_get_media_types_ex:true, has_extended_priority_class:true, @@ -170,10 +160,8 @@ static NO_COPY wincaps wincap_2003 = { has_security_descriptor_control:true, has_ip_helper_lib:true, has_physical_mem_access:false, - has_move_file_ex:true, has_unreliable_pipes:false, has_process_io_counters:true, - pty_needs_alloc_console:true, has_terminal_services:true, has_ioctl_storage_get_media_types_ex:true, has_extended_priority_class:true, @@ -200,10 +188,8 @@ static NO_COPY wincaps wincap_vista = { has_security_descriptor_control:true, has_ip_helper_lib:true, has_physical_mem_access:false, - has_move_file_ex:true, has_unreliable_pipes:false, has_process_io_counters:true, - pty_needs_alloc_console:true, has_terminal_services:true, has_ioctl_storage_get_media_types_ex:true, has_extended_priority_class:true, diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h index 080ce420f..c3e9b0fc8 100644 --- a/winsup/cygwin/wincap.h +++ b/winsup/cygwin/wincap.h @@ -20,10 +20,8 @@ struct wincaps unsigned has_security_descriptor_control : 1; unsigned has_ip_helper_lib : 1; unsigned has_physical_mem_access : 1; - unsigned has_move_file_ex : 1; unsigned has_unreliable_pipes : 1; unsigned has_process_io_counters : 1; - unsigned pty_needs_alloc_console : 1; unsigned has_terminal_services : 1; unsigned has_ioctl_storage_get_media_types_ex : 1; unsigned has_extended_priority_class : 1; @@ -66,10 +64,8 @@ public: bool IMPLEMENT (has_security_descriptor_control) bool IMPLEMENT (has_ip_helper_lib) bool IMPLEMENT (has_physical_mem_access) - bool IMPLEMENT (has_move_file_ex) bool IMPLEMENT (has_unreliable_pipes) bool IMPLEMENT (has_process_io_counters) - bool IMPLEMENT (pty_needs_alloc_console) bool IMPLEMENT (has_terminal_services) bool IMPLEMENT (has_ioctl_storage_get_media_types_ex) bool IMPLEMENT (has_extended_priority_class) diff --git a/winsup/cygwin/winf.h b/winsup/cygwin/winf.h index 16dde7063..8f965e917 100644 --- a/winsup/cygwin/winf.h +++ b/winsup/cygwin/winf.h @@ -1,6 +1,6 @@ /* 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 Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -27,9 +27,8 @@ class av public: int argc; bool win16_exe; - bool iscui; - av (): argv (NULL), iscui (false) {} - av (int ac_in, const char * const *av_in) : calloced (0), argc (ac_in), win16_exe (false), iscui (false) + av (): argv (NULL) {} + av (int ac_in, const char * const *av_in) : calloced (0), argc (ac_in), win16_exe (false) { argv = (char **) cmalloc (HEAP_1_ARGV, (argc + 5) * sizeof (char *)); memcpy (argv, av_in, (argc + 1) * sizeof (char *));