From f985cc1c535516836e4bb323b0498255ce7a8b6b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 6 Jun 2009 19:56:41 +0000 Subject: [PATCH] * mmap.cc: Use NtUnmapViewOfSection instead of UnmapViewOfFile throughout for symmetry. (fhandler_dev_mem::munmap): Use correct process handle in call to NtUnmapViewOfSection. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/mmap.cc | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 478170ec5..e11466cbc 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2009-06-06 Corinna Vinschen + + * mmap.cc: Use NtUnmapViewOfSection instead of UnmapViewOfFile + throughout for symmetry. + (fhandler_dev_mem::munmap): Use correct process handle in call to + NtUnmapViewOfSection. + 2009-06-06 Corinna Vinschen * dll_init.h (struct dll): Set size of name element to ANYSIZE_ARRAY. diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 30410692f..799b3f701 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -1480,7 +1480,7 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot, __seterrno (); else { - UnmapViewOfFile (base); + NtUnmapViewOfSection (GetCurrentProcess (), base); set_errno (EINVAL); debug_printf ("MapView: address shift with MAP_FIXED given"); } @@ -1499,7 +1499,7 @@ fhandler_dev_zero::munmap (HANDLE h, caddr_t addr, size_t len) VirtualFree (addr, 0, MEM_RELEASE); else { - UnmapViewOfFile (addr); + NtUnmapViewOfSection (GetCurrentProcess (), addr); NtClose (h); } return 0; @@ -1560,7 +1560,7 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, int prot, __seterrno (); else { - UnmapViewOfFile (base); + NtUnmapViewOfSection (GetCurrentProcess (), base); set_errno (EINVAL); debug_printf ("MapView: address shift with MAP_FIXED given"); } @@ -1575,7 +1575,7 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, int prot, int fhandler_disk_file::munmap (HANDLE h, caddr_t addr, size_t len) { - UnmapViewOfFile (addr); + NtUnmapViewOfSection (GetCurrentProcess (), addr); NtClose (h); return 0; } @@ -1673,7 +1673,7 @@ int fhandler_dev_mem::munmap (HANDLE h, caddr_t addr, size_t len) { NTSTATUS ret; - if (!NT_SUCCESS (ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, addr))) + if (!NT_SUCCESS (ret = NtUnmapViewOfSection (GetCurrentProcess (), addr))) { __seterrno_from_nt_status (ret); return -1;