From 439992fe5d620214ad0892f507824979990c2dd1 Mon Sep 17 00:00:00 2001 From: cgf Date: Thu, 3 Jun 2004 21:29:41 +0000 Subject: [PATCH] * winbase.h (ilockincr): More changes from the inexplicable world of gcc asm magic. (ilockdecr): Ditto. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/autoload.cc | 1 + winsup/cygwin/fhandler.cc | 9 ++++----- winsup/cygwin/ntdll.h | 1 + winsup/cygwin/winbase.h | 12 ++++++++++-- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index dabd6fc977..0b73f6733b 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2004-06-03 Christopher Faylor + + * winbase.h (ilockincr): More changes from the inexplicable world of + gcc asm magic. + (ilockdecr): Ditto. + 2004-06-03 Christopher Faylor * winbase.h (ilockincr): YA correction to ensure correct operation with diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 7fe19fd7aa..f2d46d1b32 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -389,6 +389,7 @@ LoadDLLfuncEx (NtSetSecurityObject, 12, ntdll, 1) LoadDLLfuncEx (NtUnmapViewOfSection, 8, ntdll, 1) LoadDLLfuncEx (RtlInitUnicodeString, 8, ntdll, 1) LoadDLLfuncEx (RtlNtStatusToDosError, 4, ntdll, 1) +LoadDLLfuncEx (RtlIsDosDeviceName_U, 4, ntdll, 1) LoadDLLfuncEx (GetProcessMemoryInfo, 12, psapi, 1) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index c481bde29a..c90acb24d6 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -531,7 +531,9 @@ done: int fhandler_base::open (int flags, mode_t mode) { - if (!wincap.is_winnt ()) + UNICODE_STRING upath; + WCHAR wpath[CYG_MAX_PATH + 10]; + if (!wincap.is_winnt () || RtlIsDosDeviceName_U(wpath)) return fhandler_base::open_9x (flags, mode); int res = 0; @@ -542,8 +544,6 @@ fhandler_base::open (int flags, mode_t mode) ULONG create_options; SECURITY_ATTRIBUTES sa = sec_none; security_descriptor sd; - UNICODE_STRING upath; - WCHAR wpath[CYG_MAX_PATH + 10]; OBJECT_ATTRIBUTES attr; IO_STATUS_BLOCK io; NTSTATUS status; @@ -555,8 +555,7 @@ fhandler_base::open (int flags, mode_t mode) goto done; } - InitializeObjectAttributes (&attr, pc.get_nt_native_path (upath, wpath), - OBJ_CASE_INSENSITIVE | OBJ_INHERIT, + InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE | OBJ_INHERIT, sa.lpSecurityDescriptor, NULL); switch (query_open ()) diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 0fb7c0e5a8..8e829f5edc 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -420,4 +420,5 @@ extern "C" NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID); VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR); ULONG NTAPI RtlNtStatusToDosError (NTSTATUS); + ULONG WINAPI RtlIsDosDeviceName_U (PCWSTR); } diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h index 0411afd7b0..6f9228efce 100644 --- a/winsup/cygwin/winbase.h +++ b/winsup/cygwin/winbase.h @@ -1,3 +1,11 @@ +/* winbase.h + + Copyright 2002, 2003, 2004 Red Hat, Inc. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + #include_next "winbase.h" #ifndef _WINBASE2_H @@ -9,7 +17,7 @@ ilockincr (long *m) register int __res; __asm__ __volatile__ ("\n\ movl $1,%0\n\ - lock xadd %0,%2\n\ + lock xadd %0,%1\n\ inc %0\n\ ": "=a" (__res), "=m" (*m): "m" (m): "cc"); return __res; @@ -21,7 +29,7 @@ ilockdecr (long *m) register int __res; __asm__ __volatile__ ("\n\ movl $0xffffffff,%0\n\ - lock xadd %0,%2\n\ + lock xadd %0,%1\n\ dec %0\n\ ": "=a" (__res), "=m" (*m): "m" (m): "cc"); return __res; -- 2.11.0