From 4c4693008a2b472b3cd596bd60cd79751b8317c8 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 15 Jul 2013 13:54:27 +0000 Subject: Remove /dev/mem, /dev/kmem, /dev/port support. * Makefile.in (DLL_OFILES): Drop fhandler_mem.o. (fhandler_mem_CFLAGS): Remove rule. * devices.in (enum fh_devices): Remove FH_MEM, FH_KMEM and FH_PORT. * devices.cc: Regenerate. * dtable.cc (fh_alloc): Drop handling for FH_MEM, FH_KMEM and FH_PORT. * fhandler.h (class fhandler_dev_mem): Remove. * fhandler_mem.cc: Remove file. * globals.cc (ro_u_pmem): Remove. * mmap.cc (fhandler_dev_mem::mmap): Remove. (fhandler_dev_mem::munmap): Remove. (fhandler_dev_mem::fixup_mmap_after_fork): Remove. --- winsup/cygwin/mmap.cc | 94 --------------------------------------------------- 1 file changed, 94 deletions(-) (limited to 'winsup/cygwin/mmap.cc') diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 697ec4099..c68d4195e 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -1811,100 +1811,6 @@ fhandler_disk_file::fixup_mmap_after_fork (HANDLE h, int prot, int flags, return base == address; } -HANDLE -fhandler_dev_mem::mmap (caddr_t *addr, size_t len, int prot, - int flags, off_t off) -{ - if (off >= (off_t) mem_size - || len >= mem_size - || off + len >= mem_size) - { - set_errno (EINVAL); - debug_printf ("-1 = mmap(): illegal parameter, set EINVAL"); - return INVALID_HANDLE_VALUE; - } - - OBJECT_ATTRIBUTES attr; - InitializeObjectAttributes (&attr, &ro_u_pmem, - OBJ_CASE_INSENSITIVE | OBJ_INHERIT, - NULL, NULL); - - /* Section access is bit-wise ored, while on the Win32 level access - is only one of the values. It's not quite clear if the section - access has to be defined this way, or if SECTION_ALL_ACCESS would - be sufficient but this worked fine so far, so why change? */ - ACCESS_MASK section_access; - if (prot & PROT_WRITE) - section_access = SECTION_MAP_READ | SECTION_MAP_WRITE; - else - section_access = SECTION_MAP_READ; - - HANDLE h; - NTSTATUS status = NtOpenSection (&h, section_access, &attr); - if (!NT_SUCCESS (status)) - { - __seterrno_from_nt_status (status); - debug_printf ("-1 = mmap(): NtOpenSection failed with %E"); - return INVALID_HANDLE_VALUE; - } - - void *base = MapView (h, *addr, len, get_access (), prot, - flags | MAP_ANONYMOUS, off); - if (!base || (fixed (flags) && base != *addr)) - { - if (!base) - __seterrno (); - else - { - NtUnmapViewOfSection (NtCurrentProcess (), base); - set_errno (EINVAL); - debug_printf ("MapView: address shift with MAP_FIXED given"); - } - NtClose (h); - return INVALID_HANDLE_VALUE; - } - - *addr = (caddr_t) base; - return h; -} - -int -fhandler_dev_mem::munmap (HANDLE h, caddr_t addr, size_t len) -{ - NTSTATUS status; - if (!NT_SUCCESS (status = NtUnmapViewOfSection (NtCurrentProcess (), addr))) - { - __seterrno_from_nt_status (status); - return -1; - } - NtClose (h); - return 0; -} - -int -fhandler_dev_mem::msync (HANDLE h, caddr_t addr, size_t len, int flags) -{ - return 0; -} - -bool -fhandler_dev_mem::fixup_mmap_after_fork (HANDLE h, int prot, int flags, - off_t offset, DWORD size, - void *address) -{ - void *base = MapView (h, address, size, get_access (), prot, - flags | MAP_ANONYMOUS, offset); - if (base != address) - { - MEMORY_BASIC_INFORMATION m; - VirtualQuery (address, &m, sizeof (m)); - system_printf ("requested %p != %p mem alloc base %p, state %y, " - "size %lu, %E", address, base, m.AllocationBase, m.State, - m.RegionSize); - } - return base == address; -} - /* Call to re-create all the file mappings in a forked child. Called from the child in initialization. At this point we are passed a valid mmapped_areas map, and all the HANDLE's are valid for the child, but -- cgit v1.2.3