about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/mmap.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-08-30 01:41:50 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-08-30 01:41:50 +0200
commitc9536b7b9ddb111bded10e7252da28a6826771d1 (patch)
treedb4e39646b48ec3cc8c0c3793320edb6216af580 /sysdeps/mach/hurd/mmap.c
parentd76d187c5f75d963d1b70a5ddc2f368a7f4cfe04 (diff)
downloadglibc-c9536b7b9ddb111bded10e7252da28a6826771d1.tar.gz
glibc-c9536b7b9ddb111bded10e7252da28a6826771d1.tar.xz
glibc-c9536b7b9ddb111bded10e7252da28a6826771d1.zip
hurd: Remove optimizing anonymous maps as __vm_allocate.
Optimizing anonymous maps brings bugs, and does not optimize much anyway.

	[BZ #19903]
	* sysdeps/mach/hurd/mmap.c (__mmap): Remove optimizing anonymous maps
	as __vm_allocate.
Diffstat (limited to 'sysdeps/mach/hurd/mmap.c')
-rw-r--r--sysdeps/mach/hurd/mmap.c23
1 files changed, 0 insertions, 23 deletions
diff --git a/sysdeps/mach/hurd/mmap.c b/sysdeps/mach/hurd/mmap.c
index 8eb741f7e1..e3ff77d6c9 100644
--- a/sysdeps/mach/hurd/mmap.c
+++ b/sysdeps/mach/hurd/mmap.c
@@ -44,29 +44,6 @@ __mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
   if ((mapaddr & (__vm_page_size - 1)) || (offset & (__vm_page_size - 1)))
     return (void *) (long int) __hurd_fail (EINVAL);
 
-  if ((flags & (MAP_TYPE|MAP_INHERIT)) == MAP_ANON
-      && prot == (PROT_READ|PROT_WRITE)) /* cf VM_PROT_DEFAULT */
-    {
-      /* vm_allocate has (a little) less overhead in the kernel too.  */
-      err = __vm_allocate (__mach_task_self (), &mapaddr, len, mapaddr == 0);
-
-      if (err == KERN_NO_SPACE)
-	{
-	  if (flags & MAP_FIXED)
-	    {
-	      /* XXX this is not atomic as it is in unix! */
-	      /* The region is already allocated; deallocate it first.  */
-	      err = __vm_deallocate (__mach_task_self (), mapaddr, len);
-	      if (!err)
-		err = __vm_allocate (__mach_task_self (), &mapaddr, len, 0);
-	    }
-	  else if (mapaddr != 0)
-	    err = __vm_allocate (__mach_task_self (), &mapaddr, len, 1);
-	}
-
-      return err ? (void *) (long int) __hurd_fail (err) : (void *) mapaddr;
-    }
-
   vmprot = VM_PROT_NONE;
   if (prot & PROT_READ)
     vmprot |= VM_PROT_READ;