about summary refs log tree commit diff
path: root/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'hurd')
-rw-r--r--hurd/catch-exc.c1
-rw-r--r--hurd/hurd/signal.h5
-rw-r--r--hurd/hurdfault.c3
-rw-r--r--hurd/intr-msg.c84
4 files changed, 88 insertions, 5 deletions
diff --git a/hurd/catch-exc.c b/hurd/catch-exc.c
index 6c58793a98..33366e0d1a 100644
--- a/hurd/catch-exc.c
+++ b/hurd/catch-exc.c
@@ -18,6 +18,7 @@
 
 #include <mach/exc_server.h>
 #include <hurd/signal.h>
+#include <assert.h>
 
 /* Called by the microkernel when a thread gets an exception.  */
 
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h
index c955ae3ab5..238a73f19c 100644
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
@@ -1,5 +1,5 @@
 /* Implementing POSIX.1 signals under the Hurd.
-   Copyright (C) 1993, 94, 95, 96, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1993,94,95,96,98,99,2002 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
@@ -38,6 +38,7 @@
 #include <hurd/msg.h>
 
 #include <cthreads.h>		/* For `struct mutex'.  */
+#include <setjmp.h>		/* For `jmp_buf'.  */
 #include <spin-lock.h>
 #include <hurd/threadvar.h>	/* We cache sigstate in a threadvar.  */
 struct hurd_signal_preemptor;	/* <hurd/sigpreempt.h> */
@@ -204,7 +205,7 @@ _hurd_critical_section_unlock (void *our_lock)
       __spin_unlock (&ss->critical_section_lock);
       pending = ss->pending & ~ss->blocked;
       __spin_unlock (&ss->lock);
-      if (pending)
+      if (! __sigisemptyset (&pending))
 	/* There are unblocked signals pending, which weren't
 	   delivered because we were in the critical section.
 	   Tell the signal thread to deliver them now.  */
diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c
index ceb2f8c679..6313f16e2e 100644
--- a/hurd/hurdfault.c
+++ b/hurd/hurdfault.c
@@ -193,7 +193,8 @@ _hurdsig_fault_init (void)
     assert (MACH_PORT_RECEIVE_STATUS_COUNT == sizeof lim / sizeof (natural_t));
     err = __mach_port_set_attributes (__mach_task_self (), forward_sigexc,
 				      MACH_PORT_RECEIVE_STATUS,
-				      &lim, MACH_PORT_RECEIVE_STATUS_COUNT);
+				      (mach_port_info_t) &lim,
+				      MACH_PORT_RECEIVE_STATUS_COUNT);
   }
 #else
   err = __mach_port_set_qlimit (__mach_task_self (), forward_sigexc, 1);
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index ae997b2bb2..e75fca81fb 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -1,5 +1,5 @@
 /* Replacement for mach_msg used in interruptible Hurd RPCs.
-   Copyright (C) 95,96,97,98,99,2000,01 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,99,2000,01,02 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
@@ -25,6 +25,9 @@
 
 #include "intr-msg.h"
 
+#ifdef NDR_CHAR_ASCII		/* OSF Mach flavors have different names.  */
+# define mig_reply_header_t	mig_reply_error_t
+#endif
 
 error_t
 _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
@@ -40,7 +43,15 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
   const mach_msg_option_t user_option = option;
   const mach_msg_timeout_t user_timeout = timeout;
 
-  struct clobber { int i[2]; };
+  struct clobber
+  {
+#ifdef NDR_CHAR_ASCII
+    NDR_record_t ndr;
+#else
+    mach_msg_type_t type;
+#endif
+    error_t err;
+  };
   union msg
   {
     mach_msg_header_t header;
@@ -48,7 +59,11 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
     struct
     {
       mach_msg_header_t header;
+#ifdef NDR_CHAR_ASCII
+      NDR_record_t ndr;
+#else
       int type;
+#endif
       int code;
     } check;
     struct
@@ -147,8 +162,12 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 	 the message buffer and we might need to clean up the port rights.  */
     case MACH_SEND_TIMED_OUT:
     case MACH_SEND_INVALID_NOTIFY:
+#ifdef MACH_SEND_NO_NOTIFY
     case MACH_SEND_NO_NOTIFY:
+#endif
+#ifdef MACH_SEND_NOTIFY_IN_PROGRESS
     case MACH_SEND_NOTIFY_IN_PROGRESS:
+#endif
       if (MACH_MSGH_BITS_REMOTE (msg->msgh_bits) == MACH_MSG_TYPE_MOVE_SEND)
 	{
 	  __mach_port_deallocate (__mach_task_self (), msg->msgh_remote_port);
@@ -159,6 +178,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 	}
       if (msg->msgh_bits & MACH_MSGH_BITS_COMPLEX)
 	{
+#ifndef MACH_MSG_PORT_DESCRIPTOR
 	  /* Check for MOVE_SEND rights in the message.  These hold refs
 	     that we need to release in case the message is in fact never
 	     re-sent later.  Since it might in fact be re-sent, we turn
@@ -228,6 +248,62 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 		  ++(void **) ty;
 		}
 	    }
+#else  /* Untyped Mach IPC flavor. */
+	  mach_msg_body_t *body = (void *) (msg + 1);
+	  mach_msg_descriptor_t *desc = (void *) (body + 1);
+	  mach_msg_descriptor_t *desc_end = desc + body->msgh_descriptor_count;
+	  for (; desc < desc_end; ++desc)
+	    switch (desc->type.type)
+	      {
+	      case MACH_MSG_PORT_DESCRIPTOR:
+		switch (desc->port.disposition)
+		  {
+		  case MACH_MSG_TYPE_MOVE_SEND:
+		    __mach_port_deallocate (mach_task_self (),
+					    desc->port.name);
+		    desc->port.disposition = MACH_MSG_TYPE_COPY_SEND;
+		    break;
+		  case MACH_MSG_TYPE_COPY_SEND:
+		  case MACH_MSG_TYPE_MOVE_RECEIVE:
+		    break;
+		  default:
+		    assert (! "unexpected port type in interruptible RPC");
+		  }
+		break;
+	      case MACH_MSG_OOL_DESCRIPTOR:
+		if (desc->out_of_line.deallocate)
+		  __vm_deallocate (__mach_task_self (),
+				   (vm_address_t) desc->out_of_line.address,
+				   desc->out_of_line.size);
+		break;
+	      case MACH_MSG_OOL_PORTS_DESCRIPTOR:
+		switch (desc->ool_ports.disposition)
+		  {
+		  case MACH_MSG_TYPE_MOVE_SEND:
+		    {
+		      mach_msg_size_t i;
+		      const mach_port_t *ports = desc->ool_ports.address;
+		      for (i = 0; i < desc->ool_ports.count; ++i)
+			__mach_port_deallocate (__mach_task_self (), ports[i]);
+		      desc->ool_ports.disposition = MACH_MSG_TYPE_COPY_SEND;
+		      break;
+		    }
+		  case MACH_MSG_TYPE_COPY_SEND:
+		  case MACH_MSG_TYPE_MOVE_RECEIVE:
+		    break;
+		  default:
+		    assert (! "unexpected port type in interruptible RPC");
+		  }
+		if (desc->ool_ports.deallocate)
+		  __vm_deallocate (__mach_task_self (),
+				   (vm_address_t) desc->ool_ports.address,
+				   desc->ool_ports.count
+				   * sizeof (mach_port_t));
+		break;
+	      default:
+		assert (! "unexpected descriptor type in interruptible RPC");
+	      }
+#endif
 	}
       break;
 
@@ -285,6 +361,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
     case MACH_MSG_SUCCESS:
       {
 	/* We got a reply.  Was it EINTR?  */
+#ifdef MACH_MSG_TYPE_BIT
 	const union
 	{
 	  mach_msg_type_t t;
@@ -292,10 +369,13 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 	} check =
 	  { t: { MACH_MSG_TYPE_INTEGER_T, sizeof (integer_t) * 8,
 		 1, TRUE, FALSE, FALSE, 0 } };
+#endif
 
         if (m->reply.RetCode == EINTR &&
 	    m->header.msgh_size == sizeof m->reply &&
+#ifdef MACH_MSG_TYPE_BIT
 	    m->check.type == check.i &&
+#endif
 	    !(m->header.msgh_bits & MACH_MSGH_BITS_COMPLEX))
 	  {
 	    /* It is indeed EINTR.  Is the interrupt for us?  */