* cygheap.h (struct cwdstuff): Remove sync member and keep_in_sync
accessors. * external.cc (cygwin_internal): Drop call to cygheap->cwd.keep_in_sync. * fhandler_disk_file.cc (fhandler_disk_file::link): Always presume ability to create hard links. * path.cc (cwdstuff::init): Drop 9x considerations. (cwdstuff::keep_in_sync): Remove. (cwdstuff::set): Take NT for granted. * pinfo.h (cygwin_pid): Just return pid. * wincap.cc: Remove has_hard_links, can_open_directories, has_negative_pids, has_named_pipes, has_try_enter_critical_section, cant_debug_dll_entry and detect_win16_exe throughout. * wincap.h: Ditto.
This commit is contained in:
parent
3af640487f
commit
8e17bd8685
|
@ -1,3 +1,19 @@
|
|||
2007-02-22 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* cygheap.h (struct cwdstuff): Remove sync member and keep_in_sync
|
||||
accessors.
|
||||
* external.cc (cygwin_internal): Drop call to cygheap->cwd.keep_in_sync.
|
||||
* fhandler_disk_file.cc (fhandler_disk_file::link): Always presume
|
||||
ability to create hard links.
|
||||
* path.cc (cwdstuff::init): Drop 9x considerations.
|
||||
(cwdstuff::keep_in_sync): Remove.
|
||||
(cwdstuff::set): Take NT for granted.
|
||||
* pinfo.h (cygwin_pid): Just return pid.
|
||||
* wincap.cc: Remove has_hard_links, can_open_directories,
|
||||
has_negative_pids, has_named_pipes, has_try_enter_critical_section,
|
||||
cant_debug_dll_entry and detect_win16_exe throughout.
|
||||
* wincap.h: Ditto.
|
||||
|
||||
2007-02-22 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler_console.cc (fhandler_console::read): Drop 9x specific
|
||||
|
|
|
@ -225,7 +225,6 @@ struct cwdstuff
|
|||
char *win32;
|
||||
DWORD hash;
|
||||
DWORD drive_length;
|
||||
bool sync;
|
||||
static muto cwd_lock;
|
||||
char *get (char *, int = 1, int = 0, unsigned = CYG_MAX_PATH);
|
||||
DWORD get_hash ();
|
||||
|
@ -240,8 +239,6 @@ struct cwdstuff
|
|||
void fixup_after_exec (char *, char *, DWORD);
|
||||
bool get_initial ();
|
||||
int set (const char *, const char *, bool);
|
||||
bool keep_in_sync () const { return sync; }
|
||||
void keep_in_sync (bool val);
|
||||
};
|
||||
|
||||
#ifdef DEBUGGING
|
||||
|
|
|
@ -346,7 +346,6 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
|||
try_to_debug ();
|
||||
break;
|
||||
case CW_SYNC_WINENV:
|
||||
cygheap->cwd.keep_in_sync (true);
|
||||
sync_winenv ();
|
||||
return 0;
|
||||
case CW_CYGTLS_PADSIZE:
|
||||
|
|
|
@ -883,9 +883,6 @@ fhandler_disk_file::link (const char *newpath)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Try to make hard link first on Windows NT */
|
||||
if (wincap.has_hard_links ())
|
||||
{
|
||||
if (CreateHardLinkA (newpc, pc, NULL))
|
||||
goto success;
|
||||
|
||||
|
@ -971,7 +968,7 @@ fhandler_disk_file::link (const char *newpath)
|
|||
| FILE_ATTRIBUTE_SYSTEM
|
||||
| FILE_ATTRIBUTE_READONLY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
docopy:
|
||||
/* do this with a copy */
|
||||
if (!CopyFileA (pc, newpc, 1))
|
||||
|
|
|
@ -4187,28 +4187,11 @@ cwdstuff::init ()
|
|||
{
|
||||
cwd_lock.init ("cwd_lock");
|
||||
get_initial ();
|
||||
if (!dynamically_loaded && !keep_in_sync ())
|
||||
{
|
||||
/* Actually chdir into the system dir to avoid cwd problems on 9x.
|
||||
See comment in cwdstuff::set below. */
|
||||
if (!wincap.can_open_directories ())
|
||||
SetCurrentDirectory (windows_system_directory);
|
||||
else
|
||||
if (!dynamically_loaded)
|
||||
close_user_proc_parms_cwd_handle ();
|
||||
}
|
||||
cwd_lock.release ();
|
||||
}
|
||||
|
||||
void
|
||||
cwdstuff::keep_in_sync (bool val)
|
||||
{
|
||||
if (!wincap.can_open_directories ())
|
||||
{
|
||||
sync = val;
|
||||
SetCurrentDirectory (val ? win32 : windows_system_directory);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get initial cwd. Should only be called once in a process tree. */
|
||||
bool
|
||||
cwdstuff::get_initial ()
|
||||
|
@ -4236,23 +4219,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
|||
cwd_lock.acquire ();
|
||||
if (doit)
|
||||
{
|
||||
if (keep_in_sync ())
|
||||
{
|
||||
/* If a Cygwin application called cygwin_internal(CW_SYNC_WINENV),
|
||||
then it's about to call native Windows functions. This also
|
||||
sets the keep_in_sync flag so that we actually chdir into the
|
||||
native directory on 9x to avoid confusion. */
|
||||
if (!SetCurrentDirectory (win32_cwd))
|
||||
{
|
||||
__seterrno ();
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We don't actually chdir on 9x but stay in the system dir.
|
||||
|
||||
On NT we utilize the user parameter block. The directory is
|
||||
/* We utilize the user parameter block. The directory is
|
||||
stored manually, but the handle to the directory is always
|
||||
closed and set to NULL. This way the directory isn't blocked
|
||||
even if it's the cwd of a Cygwin process.
|
||||
|
@ -4269,6 +4236,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
|||
privilege enabled. The reason is apparently that
|
||||
SetCurrentDirectory calls NtOpenFile without the
|
||||
FILE_OPEN_FOR_BACKUP_INTENT flag set. */
|
||||
HANDLE h;
|
||||
DWORD attr = GetFileAttributes (win32_cwd);
|
||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
|
@ -4280,12 +4248,9 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
|||
set_errno (ENOTDIR);
|
||||
goto out;
|
||||
}
|
||||
if (wincap.can_open_directories ())
|
||||
{
|
||||
HANDLE h = CreateFile (win32_cwd, FILE_TRAVERSE,
|
||||
FILE_SHARE_VALID_FLAGS, NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
h = CreateFile (win32_cwd, FILE_TRAVERSE, FILE_SHARE_VALID_FLAGS,
|
||||
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS,
|
||||
NULL);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
__seterrno ();
|
||||
|
@ -4311,8 +4276,6 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
|||
CloseHandle (h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If there is no win32 path or it has the form c:xxx, get the value */
|
||||
if (!win32_cwd || (isdrive (win32_cwd) && win32_cwd[2] != '\\'))
|
||||
{
|
||||
|
|
|
@ -231,7 +231,7 @@ public:
|
|||
extern __inline pid_t
|
||||
cygwin_pid (pid_t pid)
|
||||
{
|
||||
return (pid_t) (wincap.has_negative_pids ()) ? -(int) pid : pid;
|
||||
return pid;
|
||||
}
|
||||
|
||||
void __stdcall pinfo_init (char **, int);
|
||||
|
|
|
@ -21,13 +21,8 @@ static NO_COPY wincaps wincap_unknown = {
|
|||
has_security_descriptor_control:false,
|
||||
has_ip_helper_lib:false,
|
||||
has_physical_mem_access:true,
|
||||
has_hard_links:true,
|
||||
can_open_directories:true,
|
||||
has_move_file_ex:true,
|
||||
has_negative_pids:false,
|
||||
has_unreliable_pipes:false,
|
||||
has_named_pipes:true,
|
||||
has_try_enter_critical_section:true,
|
||||
has_raw_devices:true,
|
||||
has_valid_processorlevel:true,
|
||||
has_64bit_file_access:true,
|
||||
|
@ -37,12 +32,10 @@ static NO_COPY wincaps wincap_unknown = {
|
|||
pty_needs_alloc_console:true,
|
||||
has_terminal_services:false,
|
||||
has_switch_to_thread:true,
|
||||
cant_debug_dll_entry:false,
|
||||
has_ioctl_storage_get_media_types_ex:false,
|
||||
start_proc_suspended:false,
|
||||
has_extended_priority_class:false,
|
||||
has_guid_volumes:false,
|
||||
detect_win16_exe:false,
|
||||
has_null_console_handler_routine:true,
|
||||
has_disk_ex_ioctls:false,
|
||||
has_disabled_user_tos_setting:false,
|
||||
|
@ -67,13 +60,8 @@ static NO_COPY wincaps wincap_nt4 = {
|
|||
has_security_descriptor_control:false,
|
||||
has_ip_helper_lib:false,
|
||||
has_physical_mem_access:true,
|
||||
has_hard_links:true,
|
||||
can_open_directories:true,
|
||||
has_move_file_ex:true,
|
||||
has_negative_pids:false,
|
||||
has_unreliable_pipes:false,
|
||||
has_named_pipes:true,
|
||||
has_try_enter_critical_section:true,
|
||||
has_raw_devices:true,
|
||||
has_valid_processorlevel:true,
|
||||
has_64bit_file_access:true,
|
||||
|
@ -83,12 +71,10 @@ static NO_COPY wincaps wincap_nt4 = {
|
|||
pty_needs_alloc_console:true,
|
||||
has_terminal_services:false,
|
||||
has_switch_to_thread:true,
|
||||
cant_debug_dll_entry:false,
|
||||
has_ioctl_storage_get_media_types_ex:false,
|
||||
start_proc_suspended:false,
|
||||
has_extended_priority_class:false,
|
||||
has_guid_volumes:false,
|
||||
detect_win16_exe:false,
|
||||
has_null_console_handler_routine:true,
|
||||
has_disk_ex_ioctls:false,
|
||||
has_disabled_user_tos_setting:false,
|
||||
|
@ -113,13 +99,8 @@ static NO_COPY wincaps wincap_nt4sp4 = {
|
|||
has_security_descriptor_control:false,
|
||||
has_ip_helper_lib:true,
|
||||
has_physical_mem_access:true,
|
||||
has_hard_links:true,
|
||||
can_open_directories:true,
|
||||
has_move_file_ex:true,
|
||||
has_negative_pids:false,
|
||||
has_unreliable_pipes:false,
|
||||
has_named_pipes:true,
|
||||
has_try_enter_critical_section:true,
|
||||
has_raw_devices:true,
|
||||
has_valid_processorlevel:true,
|
||||
has_64bit_file_access:true,
|
||||
|
@ -129,12 +110,10 @@ static NO_COPY wincaps wincap_nt4sp4 = {
|
|||
pty_needs_alloc_console:true,
|
||||
has_terminal_services:false,
|
||||
has_switch_to_thread:true,
|
||||
cant_debug_dll_entry:false,
|
||||
has_ioctl_storage_get_media_types_ex:false,
|
||||
start_proc_suspended:false,
|
||||
has_extended_priority_class:false,
|
||||
has_guid_volumes:false,
|
||||
detect_win16_exe:false,
|
||||
has_null_console_handler_routine:true,
|
||||
has_disk_ex_ioctls:false,
|
||||
has_disabled_user_tos_setting:false,
|
||||
|
@ -159,13 +138,8 @@ static NO_COPY wincaps wincap_2000 = {
|
|||
has_security_descriptor_control:true,
|
||||
has_ip_helper_lib:true,
|
||||
has_physical_mem_access:true,
|
||||
has_hard_links:true,
|
||||
can_open_directories:true,
|
||||
has_move_file_ex:true,
|
||||
has_negative_pids:false,
|
||||
has_unreliable_pipes:false,
|
||||
has_named_pipes:true,
|
||||
has_try_enter_critical_section:true,
|
||||
has_raw_devices:true,
|
||||
has_valid_processorlevel:true,
|
||||
has_64bit_file_access:true,
|
||||
|
@ -175,12 +149,10 @@ static NO_COPY wincaps wincap_2000 = {
|
|||
pty_needs_alloc_console:true,
|
||||
has_terminal_services:true,
|
||||
has_switch_to_thread:true,
|
||||
cant_debug_dll_entry:false,
|
||||
has_ioctl_storage_get_media_types_ex:false,
|
||||
start_proc_suspended:false,
|
||||
has_extended_priority_class:true,
|
||||
has_guid_volumes:true,
|
||||
detect_win16_exe:false,
|
||||
has_null_console_handler_routine:true,
|
||||
has_disk_ex_ioctls:false,
|
||||
has_disabled_user_tos_setting:true,
|
||||
|
@ -205,13 +177,8 @@ static NO_COPY wincaps wincap_xp = {
|
|||
has_security_descriptor_control:true,
|
||||
has_ip_helper_lib:true,
|
||||
has_physical_mem_access:true,
|
||||
has_hard_links:true,
|
||||
can_open_directories:true,
|
||||
has_move_file_ex:true,
|
||||
has_negative_pids:false,
|
||||
has_unreliable_pipes:false,
|
||||
has_named_pipes:true,
|
||||
has_try_enter_critical_section:true,
|
||||
has_raw_devices:true,
|
||||
has_valid_processorlevel:true,
|
||||
has_64bit_file_access:true,
|
||||
|
@ -221,12 +188,10 @@ static NO_COPY wincaps wincap_xp = {
|
|||
pty_needs_alloc_console:true,
|
||||
has_terminal_services:true,
|
||||
has_switch_to_thread:true,
|
||||
cant_debug_dll_entry:false,
|
||||
has_ioctl_storage_get_media_types_ex:true,
|
||||
start_proc_suspended:false,
|
||||
has_extended_priority_class:true,
|
||||
has_guid_volumes:true,
|
||||
detect_win16_exe:false,
|
||||
has_null_console_handler_routine:true,
|
||||
has_disk_ex_ioctls:true,
|
||||
has_disabled_user_tos_setting:true,
|
||||
|
@ -251,13 +216,8 @@ static NO_COPY wincaps wincap_2003 = {
|
|||
has_security_descriptor_control:true,
|
||||
has_ip_helper_lib:true,
|
||||
has_physical_mem_access:false,
|
||||
has_hard_links:true,
|
||||
can_open_directories:true,
|
||||
has_move_file_ex:true,
|
||||
has_negative_pids:false,
|
||||
has_unreliable_pipes:false,
|
||||
has_named_pipes:true,
|
||||
has_try_enter_critical_section:true,
|
||||
has_raw_devices:true,
|
||||
has_valid_processorlevel:true,
|
||||
has_64bit_file_access:true,
|
||||
|
@ -267,12 +227,10 @@ static NO_COPY wincaps wincap_2003 = {
|
|||
pty_needs_alloc_console:true,
|
||||
has_terminal_services:true,
|
||||
has_switch_to_thread:true,
|
||||
cant_debug_dll_entry:false,
|
||||
has_ioctl_storage_get_media_types_ex:true,
|
||||
start_proc_suspended:false,
|
||||
has_extended_priority_class:true,
|
||||
has_guid_volumes:true,
|
||||
detect_win16_exe:false,
|
||||
has_null_console_handler_routine:true,
|
||||
has_disk_ex_ioctls:true,
|
||||
has_disabled_user_tos_setting:true,
|
||||
|
@ -297,13 +255,8 @@ static NO_COPY wincaps wincap_vista = {
|
|||
has_security_descriptor_control:true,
|
||||
has_ip_helper_lib:true,
|
||||
has_physical_mem_access:false,
|
||||
has_hard_links:true,
|
||||
can_open_directories:true,
|
||||
has_move_file_ex:true,
|
||||
has_negative_pids:false,
|
||||
has_unreliable_pipes:false,
|
||||
has_named_pipes:true,
|
||||
has_try_enter_critical_section:true,
|
||||
has_raw_devices:true,
|
||||
has_valid_processorlevel:true,
|
||||
has_64bit_file_access:true,
|
||||
|
@ -313,12 +266,10 @@ static NO_COPY wincaps wincap_vista = {
|
|||
pty_needs_alloc_console:true,
|
||||
has_terminal_services:true,
|
||||
has_switch_to_thread:true,
|
||||
cant_debug_dll_entry:false,
|
||||
has_ioctl_storage_get_media_types_ex:true,
|
||||
start_proc_suspended:false,
|
||||
has_extended_priority_class:true,
|
||||
has_guid_volumes:true,
|
||||
detect_win16_exe:false,
|
||||
has_null_console_handler_routine:true,
|
||||
has_disk_ex_ioctls:true,
|
||||
has_disabled_user_tos_setting:true,
|
||||
|
|
|
@ -21,13 +21,8 @@ struct wincaps
|
|||
unsigned has_security_descriptor_control : 1;
|
||||
unsigned has_ip_helper_lib : 1;
|
||||
unsigned has_physical_mem_access : 1;
|
||||
unsigned has_hard_links : 1;
|
||||
unsigned can_open_directories : 1;
|
||||
unsigned has_move_file_ex : 1;
|
||||
unsigned has_negative_pids : 1;
|
||||
unsigned has_unreliable_pipes : 1;
|
||||
unsigned has_named_pipes : 1;
|
||||
unsigned has_try_enter_critical_section : 1;
|
||||
unsigned has_raw_devices : 1;
|
||||
unsigned has_valid_processorlevel : 1;
|
||||
unsigned has_64bit_file_access : 1;
|
||||
|
@ -37,12 +32,10 @@ struct wincaps
|
|||
unsigned pty_needs_alloc_console : 1;
|
||||
unsigned has_terminal_services : 1;
|
||||
unsigned has_switch_to_thread : 1;
|
||||
unsigned cant_debug_dll_entry : 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 detect_win16_exe : 1;
|
||||
unsigned has_null_console_handler_routine : 1;
|
||||
unsigned has_disk_ex_ioctls : 1;
|
||||
unsigned has_disabled_user_tos_setting : 1;
|
||||
|
@ -83,13 +76,8 @@ public:
|
|||
bool IMPLEMENT (has_security_descriptor_control)
|
||||
bool IMPLEMENT (has_ip_helper_lib)
|
||||
bool IMPLEMENT (has_physical_mem_access)
|
||||
bool IMPLEMENT (has_hard_links)
|
||||
bool IMPLEMENT (can_open_directories)
|
||||
bool IMPLEMENT (has_move_file_ex)
|
||||
bool IMPLEMENT (has_negative_pids)
|
||||
bool IMPLEMENT (has_unreliable_pipes)
|
||||
bool IMPLEMENT (has_named_pipes)
|
||||
bool IMPLEMENT (has_try_enter_critical_section)
|
||||
bool IMPLEMENT (has_raw_devices)
|
||||
bool IMPLEMENT (has_valid_processorlevel)
|
||||
bool IMPLEMENT (has_64bit_file_access)
|
||||
|
@ -99,12 +87,10 @@ public:
|
|||
bool IMPLEMENT (pty_needs_alloc_console)
|
||||
bool IMPLEMENT (has_terminal_services)
|
||||
bool IMPLEMENT (has_switch_to_thread)
|
||||
bool IMPLEMENT (cant_debug_dll_entry)
|
||||
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 (detect_win16_exe)
|
||||
bool IMPLEMENT (has_null_console_handler_routine)
|
||||
bool IMPLEMENT (has_disk_ex_ioctls)
|
||||
bool IMPLEMENT (has_disabled_user_tos_setting)
|
||||
|
|
Loading…
Reference in New Issue