* mmap.cc: Use NtUnmapViewOfSection instead of UnmapViewOfFile

throughout for symmetry.
	(fhandler_dev_mem::munmap): Use correct process handle in call to
	NtUnmapViewOfSection.
This commit is contained in:
Corinna Vinschen 2009-06-06 19:56:41 +00:00
parent c05f7ba26e
commit f985cc1c53
2 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2009-06-06 Corinna Vinschen <corinna@vinschen.de>
* 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 <corinna@vinschen.de> 2009-06-06 Corinna Vinschen <corinna@vinschen.de>
* dll_init.h (struct dll): Set size of name element to ANYSIZE_ARRAY. * dll_init.h (struct dll): Set size of name element to ANYSIZE_ARRAY.

View File

@ -1480,7 +1480,7 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot,
__seterrno (); __seterrno ();
else else
{ {
UnmapViewOfFile (base); NtUnmapViewOfSection (GetCurrentProcess (), base);
set_errno (EINVAL); set_errno (EINVAL);
debug_printf ("MapView: address shift with MAP_FIXED given"); 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); VirtualFree (addr, 0, MEM_RELEASE);
else else
{ {
UnmapViewOfFile (addr); NtUnmapViewOfSection (GetCurrentProcess (), addr);
NtClose (h); NtClose (h);
} }
return 0; return 0;
@ -1560,7 +1560,7 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, int prot,
__seterrno (); __seterrno ();
else else
{ {
UnmapViewOfFile (base); NtUnmapViewOfSection (GetCurrentProcess (), base);
set_errno (EINVAL); set_errno (EINVAL);
debug_printf ("MapView: address shift with MAP_FIXED given"); 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 int
fhandler_disk_file::munmap (HANDLE h, caddr_t addr, size_t len) fhandler_disk_file::munmap (HANDLE h, caddr_t addr, size_t len)
{ {
UnmapViewOfFile (addr); NtUnmapViewOfSection (GetCurrentProcess (), addr);
NtClose (h); NtClose (h);
return 0; return 0;
} }
@ -1673,7 +1673,7 @@ int
fhandler_dev_mem::munmap (HANDLE h, caddr_t addr, size_t len) fhandler_dev_mem::munmap (HANDLE h, caddr_t addr, size_t len)
{ {
NTSTATUS ret; NTSTATUS ret;
if (!NT_SUCCESS (ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, addr))) if (!NT_SUCCESS (ret = NtUnmapViewOfSection (GetCurrentProcess (), addr)))
{ {
__seterrno_from_nt_status (ret); __seterrno_from_nt_status (ret);
return -1; return -1;