summary refs log tree commit diff
path: root/mach
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-02-17 07:19:11 +0000
committerRoland McGrath <roland@gnu.org>2002-02-17 07:19:11 +0000
commit61c83c3f0573d03cda87717ee46b5c985c4646fd (patch)
tree1f3a38e0adcca1304a73547f63d86938c97e1951 /mach
parentc12bc232a1d747402e88efc8b4a90e0014f04928 (diff)
downloadglibc-61c83c3f0573d03cda87717ee46b5c985c4646fd.tar.gz
glibc-61c83c3f0573d03cda87717ee46b5c985c4646fd.tar.xz
glibc-61c83c3f0573d03cda87717ee46b5c985c4646fd.zip
* sysdeps/mach/configure.in: Add some checks for Mach headers
	to ensure a sane installation.
	(mach_interface_list): Define this variable by checking for .defs
	files found in various variants.
	* configure.in (mach_interface_list): AC_SUBST this.
	* config.make.in (mach-interface-list): New substituted variable.
	* mach/Makefile (user-interfaces): Define this using the value
	of $(mach-interface-list) instead of mach, mach4.
	Updated other references to mach_interface to use it as well.

	* sysdeps/mach/powerpc/machine-lock.h: Avoid multi-line strings.

	* mach/msgserver.c [NDR_CHAR_ASCII] (mig_reply_header_t): #define as
	mig_reply_error_t for OSF Mach variant.

	* mach/Makefile (routines): Remove bootprivport.
	* mach/bootprivport.c: File removed.  It has never been used.

	* mach/msg-destroy.c (__mach_msg_destroy) [MACH_MSG_PORT_DESCRIPTOR]:
	Grok the OSF flavor of message format.
	(mach_msg_destroy_port): For MAKE_SEND and
	MAKE_SEND_ONCE rights, create an destroy a right to ensure proper
	no-senders notification.

2002-02-06  Roland McGrath  <roland@frob.com>

	* hurd/Versions (libc: GLIBC_2.0): Move cthread_fork, cthread_detach
	to here if 2.0 compatibility enabled ...
	(libc: GLIBC_2.1.3): ... from here.
Diffstat (limited to 'mach')
-rw-r--r--mach/msg-destroy.c100
-rw-r--r--mach/msgserver.c10
2 files changed, 105 insertions, 5 deletions
diff --git a/mach/msg-destroy.c b/mach/msg-destroy.c
index 1e618df0bf..9ecbdc0512 100644
--- a/mach/msg-destroy.c
+++ b/mach/msg-destroy.c
@@ -26,6 +26,15 @@
 /*
  * HISTORY
  * $Log$
+ * Revision 1.6  2002/02/17 07:13:36  roland
+ * 2002-02-16  Roland McGrath  <roland@frob.com>
+ *
+ * 	* mach/msg-destroy.c (__mach_msg_destroy) [MACH_MSG_PORT_DESCRIPTOR]:
+ * 	Grok the OSF flavor of message format.
+ * 	(mach_msg_destroy_port): For MAKE_SEND and
+ * 	MAKE_SEND_ONCE rights, create an destroy a right to ensure proper
+ * 	no-senders notification.
+ *
  * Revision 1.5  1997/06/21 01:40:07  drepper
  * More 64bit changes.
  *
@@ -91,6 +100,69 @@ __mach_msg_destroy(msg)
     mach_msg_destroy_port(msg->msgh_remote_port, MACH_MSGH_BITS_REMOTE(mbits));
 
     if (mbits & MACH_MSGH_BITS_COMPLEX) {
+#ifdef MACH_MSG_PORT_DESCRIPTOR
+	mach_msg_body_t		*body;
+	mach_msg_descriptor_t	*saddr, *eaddr;
+
+    	body = (mach_msg_body_t *) (msg + 1);
+    	saddr = (mach_msg_descriptor_t *)
+			((mach_msg_base_t *) msg + 1);
+    	eaddr =  saddr + body->msgh_descriptor_count;
+
+	for  ( ; saddr < eaddr; saddr++) {
+	    switch (saddr->type.type) {
+
+	        case MACH_MSG_PORT_DESCRIPTOR: {
+		    mach_msg_port_descriptor_t *dsc;
+
+		    /*
+		     * Destroy port rights carried in the message
+		     */
+		    dsc = &saddr->port;
+		    mach_msg_destroy_port(dsc->name, dsc->disposition);
+		    break;
+	        }
+
+	        case MACH_MSG_OOL_DESCRIPTOR : {
+		    mach_msg_ool_descriptor_t *dsc;
+
+		    /*
+		     * Destroy memory carried in the message
+		     */
+		    dsc = &saddr->out_of_line;
+		    if (dsc->deallocate) {
+		        mach_msg_destroy_memory((vm_offset_t)dsc->address,
+						dsc->size);
+		    }
+		    break;
+	        }
+
+	        case MACH_MSG_OOL_PORTS_DESCRIPTOR : {
+		    mach_port_t             		*ports;
+		    mach_msg_ool_ports_descriptor_t	*dsc;
+		    mach_msg_type_number_t   		j;
+
+		    /*
+		     * Destroy port rights carried in the message
+		     */
+		    dsc = &saddr->ool_ports;
+		    ports = (mach_port_t *) dsc->address;
+		    for (j = 0; j < dsc->count; j++, ports++)  {
+		        mach_msg_destroy_port(*ports, dsc->disposition);
+		    }
+
+		    /*
+		     * Destroy memory carried in the message
+		     */
+		    if (dsc->deallocate) {
+		        mach_msg_destroy_memory((vm_offset_t)dsc->address,
+					dsc->count * sizeof(mach_port_t));
+		    }
+		    break;
+	        }
+	    }
+	}
+#else
 	vm_offset_t saddr;
 	vm_offset_t eaddr;
 
@@ -142,6 +214,7 @@ __mach_msg_destroy(msg)
 		saddr += sizeof(vm_offset_t);
 	    }
 	}
+#endif
     }
 }
 
@@ -153,15 +226,32 @@ mach_msg_destroy_port(port, type)
     mach_msg_type_name_t type;
 {
     if (MACH_PORT_VALID(port)) switch (type) {
-      case MACH_MSG_TYPE_PORT_SEND:
-      case MACH_MSG_TYPE_PORT_SEND_ONCE:
-	(void) __mach_port_deallocate(__mach_task_self(), port);
+      case MACH_MSG_TYPE_MOVE_SEND:
+      case MACH_MSG_TYPE_MOVE_SEND_ONCE:
+	/* destroy the send/send-once right */
+	(void) __mach_port_deallocate(mach_task_self(), port);
 	break;
 
-      case MACH_MSG_TYPE_PORT_RECEIVE:
-	(void) __mach_port_mod_refs(__mach_task_self(), port,
+      case MACH_MSG_TYPE_MOVE_RECEIVE:
+	/* destroy the receive right */
+	(void) __mach_port_mod_refs(mach_task_self(), port,
 				    MACH_PORT_RIGHT_RECEIVE, -1);
 	break;
+
+      case MACH_MSG_TYPE_MAKE_SEND:
+	/* create a send right and then destroy it */
+	(void) __mach_port_insert_right(mach_task_self(), port,
+					port, MACH_MSG_TYPE_MAKE_SEND);
+	(void) __mach_port_deallocate(mach_task_self(), port);
+	break;
+
+      case MACH_MSG_TYPE_MAKE_SEND_ONCE:
+	/* create a send-once right and then destroy it */
+	(void) __mach_port_extract_right(mach_task_self(), port,
+					 MACH_MSG_TYPE_MAKE_SEND_ONCE,
+					 &port, &type);
+	(void) __mach_port_deallocate(mach_task_self(), port);
+	break;
     }
 }
 
diff --git a/mach/msgserver.c b/mach/msgserver.c
index d15f0c1cee..6471877a78 100644
--- a/mach/msgserver.c
+++ b/mach/msgserver.c
@@ -49,6 +49,12 @@
 /*
  * HISTORY
  * $Log$
+ * Revision 1.8  2002/02/17 07:13:32  roland
+ * 2002-02-16  Roland McGrath  <roland@frob.com>
+ *
+ * 	* mach/msgserver.c [NDR_CHAR_ASCII] (mig_reply_header_t): #define as
+ * 	mig_reply_error_t for OSF Mach variant.
+ *
  * Revision 1.7  2001/07/06 04:55:34  aj
  * Update to LGPL v2.1.
  *
@@ -93,6 +99,10 @@
 #include <stdlib.h>		/* For malloc and free.  */
 #include <assert.h>
 
+#ifdef NDR_CHAR_ASCII		/* OSF Mach flavors have different names.  */
+# define mig_reply_header_t	mig_reply_error_t
+#endif
+
 mach_msg_return_t
 __mach_msg_server_timeout (boolean_t (*demux) (mach_msg_header_t *request,
 					       mach_msg_header_t *reply),