about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-11-22 10:00:23 +0000
committerRoland McGrath <roland@gnu.org>1995-11-22 10:00:23 +0000
commit1a3a58fd763828c347baa92c378e2498efc12a9e (patch)
treeea33cd3a194cf9474e025d81c4619575096927f0 /sysdeps
parent91c7b85dc8fc310d4dcbe205861735a6748fecb4 (diff)
downloadglibc-1a3a58fd763828c347baa92c378e2498efc12a9e.tar.gz
glibc-1a3a58fd763828c347baa92c378e2498efc12a9e.tar.xz
glibc-1a3a58fd763828c347baa92c378e2498efc12a9e.zip
Tue Nov 21 14:12:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> cvs/libc-951122
	* malloc/malloc.c (align): Don't check contiguity and call abort.

	* hurd/hurdsig.c (post_reply): Function removed.
	(abort_thread, abort_all_rpcs, _hurdsig_abort_rpcs): Don't call it.
	Take single callback fn arg instead of reply port and type.
	(_hurd_internal_post_signal): Callers changed.
	Cache reply stub fn ptr in local var before UNTRACED might be changed.

	* sysdeps/mach/hurd/mmap.c: Cope with a null write memobj for
	PROT_READ|PROT_WRITE copy mapping.  Pass a proper vm_inherit_t to
	vm_map.

	* elf/rtld.c (_dl_start): For --list, do output and exit before
	relocating.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/mmap.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/sysdeps/mach/hurd/mmap.c b/sysdeps/mach/hurd/mmap.c
index 97930778ae..4f9304f4f5 100644
--- a/sysdeps/mach/hurd/mmap.c
+++ b/sysdeps/mach/hurd/mmap.c
@@ -66,16 +66,27 @@ __mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
 	  {
 	  case PROT_READ:
 	    memobj = robj;
-	    __mach_port_deallocate (__mach_task_self (), wobj);
+	    if (wobj != MACH_PORT_NULL)
+	      __mach_port_deallocate (__mach_task_self (), wobj);
 	    break;
 	  case PROT_WRITE:
 	    memobj = wobj;
-	    __mach_port_deallocate (__mach_task_self (), robj);
+	    if (robj != MACH_PORT_NULL)
+	      __mach_port_deallocate (__mach_task_self (), robj);
 	    break;
 	  case PROT_READ|PROT_WRITE:
-	    __mach_port_deallocate (__mach_task_self (), robj);
 	    if (robj == wobj)
-	      memobj = wobj;
+	      {
+		memobj = wobj;
+		/* Remove extra reference.  */
+		__mach_port_deallocate (__mach_task_self (), memobj);
+	      }
+	    else if (wobj == MACH_PORT_NULL && /* Not writable by mapping.  */
+		     (flags & (MAP_COPY|MAP_PRIVATE)))
+	      /* The file can only be mapped for reading.  Since we are
+		 making a private mapping, we will never try to write the
+		 object anyway, so we don't care.  */
+	      memobj = robj;
 	    else
 	      {
 		__mach_port_deallocate (__mach_task_self (), wobj);
@@ -96,7 +107,9 @@ __mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
 		  memobj, (vm_offset_t) offset,
 		  flags & (MAP_COPY|MAP_PRIVATE),
 		  vmprot, VM_PROT_ALL,
-		  flags & MAP_INHERIT);
+		  (flags & MAP_INHERIT) == 0 ? VM_INHERIT_NONE :
+		  (flags & (MAP_COPY|MAP_PRIVATE)) ? VM_INHERIT_COPY :
+		  VM_INHERIT_SHARE);
 
   if (memobj != MACH_PORT_NULL)
     __mach_port_deallocate (__mach_task_self (), memobj);
@@ -105,4 +118,4 @@ __mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
 }
 
 weak_alias (__mmap, mmap)
-	
+