[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r16811 - in /fsf/trunk/libc: ChangeLog sysdeps/mach/hurd/mmap.c sysdeps/mach/hurd/socket.c



Author: eglibc
Date: Tue Jan 24 00:02:01 2012
New Revision: 16811

Log:
Import glibc-mainline for 2012-01-24

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/sysdeps/mach/hurd/mmap.c
    fsf/trunk/libc/sysdeps/mach/hurd/socket.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Jan 24 00:02:01 2012
@@ -1,3 +1,14 @@
+2012-01-22  Pino Toscano  <toscano.pino@xxxxxxxxxx>
+
+	* sysdeps/mach/hurd/socket.c (__socket): Return EAFNOSUPPORT instead
+	of the non-standard EPFNOSUPPORT.
+
+2011-12-26  Samuel Thibault  <samuel.thibault@xxxxxxxxxxxx>
+
+	* sysdeps/mach/hurd/mmap.c (__mmap): When MAPADDR is nonzero, try
+	__vm_allocate and __vm_map with ANYWHERE set to 0 first, and try with
+	ANYWHERE set to 1 only on KERN_NO_SPACE error.
+
 2012-01-21  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	* wcsmbs/uchar.h: Test __STDC_VERSION__.

Modified: fsf/trunk/libc/sysdeps/mach/hurd/mmap.c
==============================================================================
--- fsf/trunk/libc/sysdeps/mach/hurd/mmap.c (original)
+++ fsf/trunk/libc/sysdeps/mach/hurd/mmap.c Tue Jan 24 00:02:01 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994,1995,1996,1997,1999,2002,2003,2004
+/* Copyright (C) 1994,1995,1996,1997,1999,2002,2003,2004,2012
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -51,15 +51,20 @@
     {
       /* vm_allocate has (a little) less overhead in the kernel too.  */
       err = __vm_allocate (__mach_task_self (), &mapaddr, len,
-			   !(flags & MAP_FIXED));
+			   mapaddr == NULL);
 
-      if (err == KERN_NO_SPACE && (flags & MAP_FIXED))
+      if (err == KERN_NO_SPACE)
 	{
-	  /* 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);
+	  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 != NULL)
+	    err = __vm_allocate (__mach_task_self (), &mapaddr, len, 1);
 	}
 
       return err ? (__ptr_t) (long int) __hurd_fail (err) : (__ptr_t) mapaddr;
@@ -135,21 +140,32 @@
 
   err = __vm_map (__mach_task_self (),
 		  &mapaddr, (vm_size_t) len, (vm_address_t) 0,
-		  ! (flags & MAP_FIXED),
+		  mapaddr == NULL,
 		  memobj, (vm_offset_t) offset,
 		  ! (flags & MAP_SHARED),
 		  vmprot, VM_PROT_ALL,
 		  (flags & MAP_SHARED) ? VM_INHERIT_SHARE : VM_INHERIT_COPY);
 
-  if (err == KERN_NO_SPACE && (flags & MAP_FIXED))
+  if (err == KERN_NO_SPACE)
     {
-      /* 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)
+      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_map (__mach_task_self (),
+			    &mapaddr, (vm_size_t) len, (vm_address_t) 0,
+			    0, memobj, (vm_offset_t) offset,
+			    ! (flags & MAP_SHARED),
+			    vmprot, VM_PROT_ALL,
+			    (flags & MAP_SHARED) ? VM_INHERIT_SHARE
+			    : VM_INHERIT_COPY);
+	}
+      else if (mapaddr != NULL)
 	err = __vm_map (__mach_task_self (),
 			&mapaddr, (vm_size_t) len, (vm_address_t) 0,
-			0, memobj, (vm_offset_t) offset,
+			1, memobj, (vm_offset_t) offset,
 			! (flags & MAP_SHARED),
 			vmprot, VM_PROT_ALL,
 			(flags & MAP_SHARED) ? VM_INHERIT_SHARE

Modified: fsf/trunk/libc/sysdeps/mach/hurd/socket.c
==============================================================================
--- fsf/trunk/libc/sysdeps/mach/hurd/socket.c (original)
+++ fsf/trunk/libc/sysdeps/mach/hurd/socket.c Tue Jan 24 00:02:01 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1998,2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,7 +57,7 @@
      isn't supported.  */
   if (err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED
       || err == MIG_BAD_ID || err == EOPNOTSUPP)
-    err = EPFNOSUPPORT;
+    err = EAFNOSUPPORT;
 
   if (err)
     return __hurd_fail (err);

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits