Remove untyped mach RPC code.

Message ID ZVmYX6j4pYNUfqn4@jupiter.tail36e24.ts.net
State Committed
Commit 6ae7b5f43d4b13f24606d7108d822e469a96af3d
Headers
Series Remove untyped mach RPC code. |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_check--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_glibc_build--master-arm warning Patch is already merged

Commit Message

Flavio Cruz Nov. 19, 2023, 5:08 a.m. UTC
  Existing MiG does not support untyped messages and the Hurd will
continue to use typed messages for the foreseeable future.
---
 hurd/hurdfault.c   |  4 ---
 hurd/intr-msg.c    | 69 ----------------------------------------------
 mach/msg-destroy.c | 64 ------------------------------------------
 mach/msgserver.c   |  4 ---
 4 files changed, 141 deletions(-)
  

Comments

Samuel Thibault Nov. 19, 2023, 9:21 a.m. UTC | #1
Applied, thanks!

Flavio Cruz, le dim. 19 nov. 2023 00:08:47 -0500, a ecrit:
> Existing MiG does not support untyped messages and the Hurd will
> continue to use typed messages for the foreseeable future.
> ---
>  hurd/hurdfault.c   |  4 ---
>  hurd/intr-msg.c    | 69 ----------------------------------------------
>  mach/msg-destroy.c | 64 ------------------------------------------
>  mach/msgserver.c   |  4 ---
>  4 files changed, 141 deletions(-)
> 
> diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c
> index dae889a9..1578b88e 100644
> --- a/hurd/hurdfault.c
> +++ b/hurd/hurdfault.c
> @@ -115,10 +115,6 @@ _hurdsig_fault_catch_exception_raise_state_identity
>  #endif
>  
>  
> -#ifdef NDR_CHAR_ASCII		/* OSF Mach flavors have different names.  */
> -# define mig_reply_header_t	mig_reply_error_t
> -#endif
> -
>  static void
>  faulted (void)
>  {
> diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
> index 737bfe0f..24184f82 100644
> --- a/hurd/intr-msg.c
> +++ b/hurd/intr-msg.c
> @@ -25,10 +25,6 @@
>  
>  #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,
>  			 mach_msg_option_t option,
> @@ -45,11 +41,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
>  
>    struct clobber
>    {
> -#ifdef NDR_CHAR_ASCII
> -    NDR_record_t ndr;
> -#else
>      mach_msg_type_t type;
> -#endif
>      error_t err;
>    };
>    union msg
> @@ -59,11 +51,7 @@ _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
>        mach_msg_type_t type;
> -#endif
>        int code;
>      } check;
>      struct
> @@ -171,7 +159,6 @@ _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
> @@ -243,62 +230,6 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
>  		  ty = (void *) data + sizeof (void *);
>  		}
>  	    }
> -#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;
>  
> diff --git a/mach/msg-destroy.c b/mach/msg-destroy.c
> index 0a8b46c8..19137baa 100644
> --- a/mach/msg-destroy.c
> +++ b/mach/msg-destroy.c
> @@ -71,69 +71,6 @@ __mach_msg_destroy (mach_msg_header_t *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;
>  
> @@ -185,7 +122,6 @@ __mach_msg_destroy (mach_msg_header_t *msg)
>  		saddr += sizeof(vm_offset_t);
>  	    }
>  	}
> -#endif
>      }
>  }
>  
> diff --git a/mach/msgserver.c b/mach/msgserver.c
> index 9ffe71ed..8f8beedd 100644
> --- a/mach/msgserver.c
> +++ b/mach/msgserver.c
> @@ -66,10 +66,6 @@
>  #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),
> -- 
> 2.39.2
>
  

Patch

diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c
index dae889a9..1578b88e 100644
--- a/hurd/hurdfault.c
+++ b/hurd/hurdfault.c
@@ -115,10 +115,6 @@  _hurdsig_fault_catch_exception_raise_state_identity
 #endif
 
 
-#ifdef NDR_CHAR_ASCII		/* OSF Mach flavors have different names.  */
-# define mig_reply_header_t	mig_reply_error_t
-#endif
-
 static void
 faulted (void)
 {
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index 737bfe0f..24184f82 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -25,10 +25,6 @@ 
 
 #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,
 			 mach_msg_option_t option,
@@ -45,11 +41,7 @@  _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 
   struct clobber
   {
-#ifdef NDR_CHAR_ASCII
-    NDR_record_t ndr;
-#else
     mach_msg_type_t type;
-#endif
     error_t err;
   };
   union msg
@@ -59,11 +51,7 @@  _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
       mach_msg_type_t type;
-#endif
       int code;
     } check;
     struct
@@ -171,7 +159,6 @@  _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
@@ -243,62 +230,6 @@  _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
 		  ty = (void *) data + sizeof (void *);
 		}
 	    }
-#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;
 
diff --git a/mach/msg-destroy.c b/mach/msg-destroy.c
index 0a8b46c8..19137baa 100644
--- a/mach/msg-destroy.c
+++ b/mach/msg-destroy.c
@@ -71,69 +71,6 @@  __mach_msg_destroy (mach_msg_header_t *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;
 
@@ -185,7 +122,6 @@  __mach_msg_destroy (mach_msg_header_t *msg)
 		saddr += sizeof(vm_offset_t);
 	    }
 	}
-#endif
     }
 }
 
diff --git a/mach/msgserver.c b/mach/msgserver.c
index 9ffe71ed..8f8beedd 100644
--- a/mach/msgserver.c
+++ b/mach/msgserver.c
@@ -66,10 +66,6 @@ 
 #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),