bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] Update ipc/ directory to use mach_port_name_t


From: Flavio Cruz
Subject: [PATCH] Update ipc/ directory to use mach_port_name_t
Date: Wed, 30 Nov 2022 02:14:20 -0500

Make it explicit where we use port names versus actual ports. For the 64
bit kernel, port names and ports are of different size so this corrects
the syscall arguments and internal structs to have the right size.

This patch also uncovered several issues we need to solve to make
GNUMach work well on 64 bits. First, the mach_msg call will receive 4
byte port names while the kernel "thinks" they are 8 bytes, which will
be a problem. Also, when we send a message, the kernel translates the
port names into port pointers in the message copied from user space.
This also won't work on 64 bits. In this patch, I added several TODOs to fix
the issues later.
---
 include/mach/message.h     |  8 ++--
 include/mach/mig_support.h |  2 +-
 ipc/ipc_entry.c            | 11 +++---
 ipc/ipc_entry.h            | 10 ++---
 ipc/ipc_kmsg.c             | 58 +++++++++++++++++-----------
 ipc/ipc_kmsg.h             | 10 ++---
 ipc/ipc_marequest.c        | 18 ++++-----
 ipc/ipc_marequest.h        |  8 ++--
 ipc/ipc_mqueue.c           |  2 +-
 ipc/ipc_mqueue.h           |  2 +-
 ipc/ipc_notify.c           | 18 ++++-----
 ipc/ipc_notify.h           |  6 +--
 ipc/ipc_object.c           | 28 +++++++-------
 ipc/ipc_object.h           | 20 +++++-----
 ipc/ipc_port.c             | 28 +++++++-------
 ipc/ipc_port.h             | 16 ++++----
 ipc/ipc_pset.c             |  7 ++--
 ipc/ipc_pset.h             |  4 +-
 ipc/ipc_right.c            | 74 ++++++++++++++++++------------------
 ipc/ipc_right.h            | 36 +++++++++---------
 ipc/ipc_space.c            |  2 +-
 ipc/ipc_space.h            |  8 ++--
 ipc/ipc_target.c           |  2 +-
 ipc/ipc_target.h           |  4 +-
 ipc/mach_debug.c           |  4 +-
 ipc/mach_msg.c             | 24 ++++++------
 ipc/mach_msg.h             |  6 +--
 ipc/mach_port.c            | 74 ++++++++++++++++++------------------
 ipc/mach_port.h            | 12 +++---
 ipc/mach_rpc.c             |  4 +-
 kern/exception.c           |  8 ++--
 kern/ipc_mig.c             | 77 +++++++++++++++++++-------------------
 kern/ipc_mig.h             | 62 +++++++++++++++---------------
 kern/ipc_tt.c              |  4 +-
 kern/ipc_tt.h              |  2 +-
 kern/thread.h              |  4 +-
 36 files changed, 339 insertions(+), 324 deletions(-)

diff --git a/include/mach/message.h b/include/mach/message.h
index 30c07296..e6d26f58 100644
--- a/include/mach/message.h
+++ b/include/mach/message.h
@@ -393,9 +393,9 @@ mach_msg_trap
     mach_msg_option_t option,
     mach_msg_size_t send_size,
     mach_msg_size_t rcv_size,
-    mach_port_t rcv_name,
+    mach_port_name_t rcv_name,
     mach_msg_timeout_t timeout,
-    mach_port_t notify);
+    mach_port_name_t notify);
 
 extern mach_msg_return_t
 mach_msg
@@ -403,9 +403,9 @@ mach_msg
     mach_msg_option_t option,
     mach_msg_size_t send_size,
     mach_msg_size_t rcv_size,
-    mach_port_t rcv_name,
+    mach_port_name_t rcv_name,
     mach_msg_timeout_t timeout,
-    mach_port_t notify);
+    mach_port_name_t notify);
 
 extern __typeof (mach_msg) __mach_msg;
 extern __typeof (mach_msg_trap) __mach_msg_trap;
diff --git a/include/mach/mig_support.h b/include/mach/mig_support.h
index 865bdc5f..0794a5fb 100644
--- a/include/mach/mig_support.h
+++ b/include/mach/mig_support.h
@@ -47,7 +47,7 @@ extern void           mig_dealloc_reply_port(mach_port_t);
 
 extern void            mig_put_reply_port(mach_port_t);
 
-extern mach_port_t     mig_get_reply_port(void);
+extern mach_port_name_t        mig_get_reply_port(void);
 
 extern void            mig_reply_setup(const mach_msg_header_t *_request,
                                        mach_msg_header_t *reply);
diff --git a/ipc/ipc_entry.c b/ipc/ipc_entry.c
index 0414ba5f..c24ea46c 100644
--- a/ipc/ipc_entry.c
+++ b/ipc/ipc_entry.c
@@ -67,7 +67,7 @@ struct kmem_cache ipc_entry_cache;
 kern_return_t
 ipc_entry_alloc(
        ipc_space_t     space,
-       mach_port_t     *namep,
+       mach_port_name_t        *namep,
        ipc_entry_t     *entryp)
 {
        kern_return_t kr;
@@ -97,10 +97,10 @@ ipc_entry_alloc(
        entry->ie_bits = 0;
        entry->ie_object = IO_NULL;
        entry->ie_request = 0;
-       entry->ie_name = (mach_port_t) key;
+       entry->ie_name = (mach_port_name_t) key;
 
        *entryp = entry;
-       *namep = (mach_port_t) key;
+       *namep = (mach_port_name_t) key;
        return KERN_SUCCESS;
 }
 
@@ -121,7 +121,7 @@ ipc_entry_alloc(
 kern_return_t
 ipc_entry_alloc_name(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        ipc_entry_t     *entryp)
 {
        kern_return_t kr;
@@ -198,12 +198,11 @@ ipc_entry_alloc_name(
 ipc_entry_t
 db_ipc_object_by_name(
        const task_t    task,
-       mach_port_t     name)
+       mach_port_name_t        name)
 {
         ipc_space_t space = task->itk_space;
         ipc_entry_t entry;
  
- 
         entry = ipc_entry_lookup(space, name);
         if(entry != IE_NULL) {
                 iprintf("(task 0x%x, name 0x%x) ==> object 0x%x",
diff --git a/ipc/ipc_entry.h b/ipc/ipc_entry.h
index b429984b..9f7b593e 100644
--- a/ipc/ipc_entry.h
+++ b/ipc/ipc_entry.h
@@ -55,7 +55,7 @@ typedef unsigned int ipc_entry_bits_t;
 typedef ipc_table_elems_t ipc_entry_num_t;     /* number of entries */
 
 typedef struct ipc_entry {
-       mach_port_t ie_name;
+       mach_port_name_t ie_name;
        ipc_entry_bits_t ie_bits;
        struct ipc_object *ie_object;
        union {
@@ -97,14 +97,14 @@ extern struct kmem_cache ipc_entry_cache;
 #define        ie_free(e)      kmem_cache_free(&ipc_entry_cache, (vm_offset_t) 
(e))
 
 extern kern_return_t
-ipc_entry_alloc(ipc_space_t space, mach_port_t *namep, ipc_entry_t *entryp);
+ipc_entry_alloc(ipc_space_t space, mach_port_name_t *namep, ipc_entry_t 
*entryp);
 
 extern kern_return_t
-ipc_entry_alloc_name(ipc_space_t space, mach_port_t name, ipc_entry_t *entryp);
+ipc_entry_alloc_name(ipc_space_t space, mach_port_name_t name, ipc_entry_t 
*entryp);
 
 ipc_entry_t
 db_ipc_object_by_name(
-       task_t          task,
-       mach_port_t     name);
+       task_t            task,
+       mach_port_name_t   name);
 
 #endif /* _IPC_IPC_ENTRY_H_ */
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 4f5ffb5f..1e00b355 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -674,11 +674,21 @@ mach_msg_return_t
 ipc_kmsg_copyin_header(
        mach_msg_header_t       *msg,
        ipc_space_t             space,
-       mach_port_t             notify)
+       mach_port_name_t        notify)
 {
        mach_msg_bits_t mbits = msg->msgh_bits &~ MACH_MSGH_BITS_CIRCULAR;
-       mach_port_t dest_name = msg->msgh_remote_port;
-       mach_port_t reply_name = msg->msgh_local_port;
+       /*
+        * TODO: For 64 bits, msgh_remote_port as written by user space
+        * is 4 bytes long but here we assume it is the same size as a pointer.
+        * When copying the message to the kernel, we need to perform the
+        * conversion so that port names are parsed correctly.
+        *
+        * When copying the message out of the kernel to user space, we also 
need
+        * to be careful with the reverse translation.
+        */
+
+       mach_port_name_t dest_name = (mach_port_name_t)msg->msgh_remote_port;
+       mach_port_name_t reply_name = (mach_port_name_t)msg->msgh_local_port;
        kern_return_t kr;
 
 #ifndef MIGRATING_THREADS
@@ -916,7 +926,7 @@ ipc_kmsg_copyin_header(
 
        if (dest_name == reply_name) {
                ipc_entry_t entry;
-               mach_port_t name = dest_name;
+               mach_port_name_t name = dest_name;
 
                /*
                 *      Destination and reply ports are the same!
@@ -1443,7 +1453,7 @@ ipc_kmsg_copyin_body(
                                ((mach_msg_type_t*)type)->msgt_name = newname;
 
                        for (i = 0; i < number; i++) {
-                               mach_port_t port = (mach_port_t) objects[i];
+                               mach_port_name_t port = (mach_port_name_t) 
objects[i];
                                ipc_object_t object;
 
                                if (!MACH_PORT_VALID(port))
@@ -1464,6 +1474,9 @@ ipc_kmsg_copyin_body(
                                        kmsg->ikm_header.msgh_bits |=
                                                MACH_MSGH_BITS_CIRCULAR;
 
+                               /* TODO: revisit this for 64 bits since the 
size of
+                                * mach_port_name_t is not the same as a 
pointer size.
+                                */
                                objects[i] = object;
                        }
 
@@ -1507,7 +1520,7 @@ ipc_kmsg_copyin(
        ipc_kmsg_t      kmsg,
        ipc_space_t     space,
        vm_map_t        map,
-       mach_port_t     notify)
+       mach_port_name_t notify)
 {
        mach_msg_return_t mr;
 
@@ -1700,7 +1713,7 @@ mach_msg_return_t
 ipc_kmsg_copyout_header(
        mach_msg_header_t       *msg,
        ipc_space_t             space,
-       mach_port_t             notify)
+       mach_port_name_t                notify)
 {
        mach_msg_bits_t mbits = msg->msgh_bits;
        ipc_port_t dest = (ipc_port_t) msg->msgh_remote_port;
@@ -1712,7 +1725,7 @@ ipc_kmsg_copyout_header(
 
        if (notify == MACH_PORT_NULL) switch (MACH_MSGH_BITS_PORTS(mbits)) {
            case MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND, 0): {
-               mach_port_t dest_name;
+               mach_port_name_t dest_name;
                ipc_port_t nsrequest;
                unsigned long payload;
 
@@ -1765,7 +1778,7 @@ ipc_kmsg_copyout_header(
                                MACH_MSG_TYPE_PORT_SEND_ONCE): {
                ipc_entry_t entry;
                ipc_port_t reply = (ipc_port_t) msg->msgh_local_port;
-               mach_port_t dest_name, reply_name;
+               mach_port_name_t dest_name, reply_name;
                ipc_port_t nsrequest;
                unsigned long payload;
 
@@ -1868,7 +1881,7 @@ ipc_kmsg_copyout_header(
            }
 
            case MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0): {
-               mach_port_t dest_name;
+               mach_port_name_t dest_name;
                unsigned long payload;
 
                /* receiving a reply message */
@@ -1922,7 +1935,7 @@ ipc_kmsg_copyout_header(
        mach_msg_type_name_t dest_type = MACH_MSGH_BITS_REMOTE(mbits);
        mach_msg_type_name_t reply_type = MACH_MSGH_BITS_LOCAL(mbits);
        ipc_port_t reply = (ipc_port_t) msg->msgh_local_port;
-       mach_port_t dest_name, reply_name;
+       mach_port_name_t dest_name, reply_name;
        unsigned long payload;
 
        if (IP_VALID(reply)) {
@@ -2111,7 +2124,7 @@ ipc_kmsg_copyout_header(
                ip_lock(dest);
                is_read_unlock(space);
 
-               reply_name = (mach_port_t) reply;
+               reply_name = (mach_port_name_t) reply;
        }
 
        /*
@@ -2230,10 +2243,10 @@ ipc_kmsg_copyout_object(
        ipc_space_t             space,
        ipc_object_t            object,
        mach_msg_type_name_t    msgt_name,
-       mach_port_t             *namep)
+       mach_port_name_t        *namep)
 {
        if (!IO_VALID(object)) {
-               *namep = (mach_port_t) object;
+               *namep = (mach_port_name_t) object;
                return MACH_MSG_SUCCESS;
        }
 
@@ -2393,7 +2406,7 @@ ipc_kmsg_copyout_body(
                is_port = MACH_MSG_TYPE_PORT_ANY(name);
 
                if (is_port) {
-                       mach_port_t *objects;
+                       ipc_object_t *objects;
                        mach_msg_type_number_t i;
 
                        if (!is_inline && (length != 0)) {
@@ -2406,7 +2419,7 @@ ipc_kmsg_copyout_body(
                                }
                        }
 
-                       objects = (mach_port_t *)
+                       objects = (ipc_object_t *)
                                (is_inline ? saddr : * (vm_offset_t *) saddr);
 
                        /* copyout port rights carried in the message */
@@ -2415,8 +2428,11 @@ ipc_kmsg_copyout_body(
                                ipc_object_t object =
                                        (ipc_object_t) objects[i];
 
+                               /* TODO: revisit this for 64 bits since the 
size of
+                                * mach_port_name_t is not the same as a 
pointer size.
+                                */
                                mr |= ipc_kmsg_copyout_object(space, object,
-                                                       name, &objects[i]);
+                                                       name, (mach_port_name_t 
*)&objects[i]);
                        }
                }
 
@@ -2498,7 +2514,7 @@ ipc_kmsg_copyout(
        ipc_kmsg_t      kmsg,
        ipc_space_t     space,
        vm_map_t        map,
-       mach_port_t     notify)
+       mach_port_name_t        notify)
 {
        mach_msg_bits_t mbits = kmsg->ikm_header.msgh_bits;
        mach_msg_return_t mr;
@@ -2547,7 +2563,7 @@ ipc_kmsg_copyout_pseudo(
        ipc_object_t reply = (ipc_object_t) kmsg->ikm_header.msgh_local_port;
        mach_msg_type_name_t dest_type = MACH_MSGH_BITS_REMOTE(mbits);
        mach_msg_type_name_t reply_type = MACH_MSGH_BITS_LOCAL(mbits);
-       mach_port_t dest_name, reply_name;
+       mach_port_name_t dest_name, reply_name;
        mach_msg_return_t mr;
 
        assert(IO_VALID(dest));
@@ -2585,7 +2601,7 @@ ipc_kmsg_copyout_dest(
        ipc_object_t reply = (ipc_object_t) kmsg->ikm_header.msgh_local_port;
        mach_msg_type_name_t dest_type = MACH_MSGH_BITS_REMOTE(mbits);
        mach_msg_type_name_t reply_type = MACH_MSGH_BITS_LOCAL(mbits);
-       mach_port_t dest_name, reply_name;
+       mach_port_name_t dest_name, reply_name;
 
        assert(IO_VALID(dest));
 
@@ -2603,7 +2619,7 @@ ipc_kmsg_copyout_dest(
                ipc_object_destroy(reply, reply_type);
                reply_name = MACH_PORT_NULL;
        } else
-               reply_name = (mach_port_t) reply;
+               reply_name = (mach_port_name_t) reply;
 
        kmsg->ikm_header.msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
                                      MACH_MSGH_BITS(reply_type, dest_type));
diff --git a/ipc/ipc_kmsg.h b/ipc/ipc_kmsg.h
index 2d75b173..ffda9b5e 100644
--- a/ipc/ipc_kmsg.h
+++ b/ipc/ipc_kmsg.h
@@ -254,26 +254,26 @@ extern void
 ipc_kmsg_put_to_kernel(mach_msg_header_t *, ipc_kmsg_t, mach_msg_size_t);
 
 extern mach_msg_return_t
-ipc_kmsg_copyin_header(mach_msg_header_t *, ipc_space_t, mach_port_t);
+ipc_kmsg_copyin_header(mach_msg_header_t *, ipc_space_t, mach_port_name_t);
 
 extern mach_msg_return_t
-ipc_kmsg_copyin(ipc_kmsg_t, ipc_space_t, vm_map_t, mach_port_t);
+ipc_kmsg_copyin(ipc_kmsg_t, ipc_space_t, vm_map_t, mach_port_name_t);
 
 extern void
 ipc_kmsg_copyin_from_kernel(ipc_kmsg_t);
 
 extern mach_msg_return_t
-ipc_kmsg_copyout_header(mach_msg_header_t *, ipc_space_t, mach_port_t);
+ipc_kmsg_copyout_header(mach_msg_header_t *, ipc_space_t, mach_port_name_t);
 
 extern mach_msg_return_t
 ipc_kmsg_copyout_object(ipc_space_t, ipc_object_t,
-                       mach_msg_type_name_t, mach_port_t *);
+                       mach_msg_type_name_t, mach_port_name_t *);
 
 extern mach_msg_return_t
 ipc_kmsg_copyout_body(ipc_kmsg_t, ipc_space_t, vm_map_t);
 
 extern mach_msg_return_t
-ipc_kmsg_copyout(ipc_kmsg_t, ipc_space_t, vm_map_t, mach_port_t);
+ipc_kmsg_copyout(ipc_kmsg_t, ipc_space_t, vm_map_t, mach_port_name_t);
 
 extern mach_msg_return_t
 ipc_kmsg_copyout_pseudo(ipc_kmsg_t, ipc_space_t, vm_map_t);
diff --git a/ipc/ipc_marequest.c b/ipc/ipc_marequest.c
index 736db838..526e4722 100644
--- a/ipc/ipc_marequest.c
+++ b/ipc/ipc_marequest.c
@@ -161,12 +161,12 @@ ipc_marequest_init(void)
 
 mach_msg_return_t
 ipc_marequest_create(
-       ipc_space_t     space,
-       ipc_port_t      port,
-       mach_port_t     notify,
-       ipc_marequest_t *marequestp)
+       ipc_space_t             space,
+       ipc_port_t              port,
+       mach_port_name_t        notify,
+       ipc_marequest_t         *marequestp)
 {
-       mach_port_t name;
+       mach_port_name_t name;
        ipc_entry_t entry;
        ipc_port_t soright;
        ipc_marequest_t marequest;
@@ -258,7 +258,7 @@ ipc_marequest_create(
 void
 ipc_marequest_cancel(
        ipc_space_t space,
-       mach_port_t name)
+       mach_port_name_t name)
 {
        ipc_marequest_bucket_t bucket;
        ipc_marequest_t marequest, *last;
@@ -294,8 +294,8 @@ ipc_marequest_cancel(
 void
 ipc_marequest_rename(
        ipc_space_t space,
-       mach_port_t old, 
-       mach_port_t new)
+       mach_port_name_t old, 
+       mach_port_name_t new)
 {
        ipc_marequest_bucket_t bucket;
        ipc_marequest_t marequest, *last;
@@ -340,7 +340,7 @@ void
 ipc_marequest_destroy(ipc_marequest_t marequest)
 {
        ipc_space_t space = marequest->imar_space;
-       mach_port_t name;
+       mach_port_name_t name;
        ipc_port_t soright;
 
        is_write_lock(space);
diff --git a/ipc/ipc_marequest.h b/ipc/ipc_marequest.h
index 4f6f7584..a55d4e23 100644
--- a/ipc/ipc_marequest.h
+++ b/ipc/ipc_marequest.h
@@ -63,7 +63,7 @@
 
 typedef struct ipc_marequest {
        struct ipc_space *imar_space;
-       mach_port_t imar_name;
+       mach_port_name_t imar_name;
        struct ipc_port *imar_soright;
        struct ipc_marequest *imar_next;
 } *ipc_marequest_t;
@@ -84,14 +84,14 @@ ipc_marequest_info(unsigned int *, hash_info_bucket_t *, 
unsigned int);
 
 extern mach_msg_return_t
 ipc_marequest_create(ipc_space_t space, ipc_port_t port,
-                    mach_port_t notify, ipc_marequest_t *marequestp);
+                    mach_port_name_t notify, ipc_marequest_t *marequestp);
 
 extern void
-ipc_marequest_cancel(ipc_space_t space, mach_port_t name);
+ipc_marequest_cancel(ipc_space_t space, mach_port_name_t name);
 
 extern void
 ipc_marequest_rename(ipc_space_t space,
-                    mach_port_t old, mach_port_t new);
+                    mach_port_name_t old, mach_port_name_t new);
 
 extern void
 ipc_marequest_destroy(ipc_marequest_t marequest);
diff --git a/ipc/ipc_mqueue.c b/ipc/ipc_mqueue.c
index 9138aec4..a371a625 100644
--- a/ipc/ipc_mqueue.c
+++ b/ipc/ipc_mqueue.c
@@ -399,7 +399,7 @@ ipc_mqueue_send(
 mach_msg_return_t
 ipc_mqueue_copyin(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        ipc_mqueue_t    *mqueuep,
        ipc_object_t    *objectp)
 {
diff --git a/ipc/ipc_mqueue.h b/ipc/ipc_mqueue.h
index 2af5e02e..efca6817 100644
--- a/ipc/ipc_mqueue.h
+++ b/ipc/ipc_mqueue.h
@@ -68,7 +68,7 @@ extern mach_msg_return_t
 ipc_mqueue_send(ipc_kmsg_t, mach_msg_option_t, mach_msg_timeout_t);
 
 extern mach_msg_return_t
-ipc_mqueue_copyin(ipc_space_t, mach_port_t, ipc_mqueue_t *, ipc_object_t *);
+ipc_mqueue_copyin(ipc_space_t, mach_port_name_t, ipc_mqueue_t *, ipc_object_t 
*);
 
 #define        IMQ_NULL_CONTINUE       ((void (*)()) 0)
 
diff --git a/ipc/ipc_notify.c b/ipc/ipc_notify.c
index df5f68bc..1fff8ead 100644
--- a/ipc/ipc_notify.c
+++ b/ipc/ipc_notify.c
@@ -253,15 +253,15 @@ ipc_notify_init(void)
 
 void
 ipc_notify_port_deleted(
-       ipc_port_t      port,
-       mach_port_t     name)
+       ipc_port_t              port,
+       mach_port_name_t        name)
 {
        ipc_kmsg_t kmsg;
        mach_port_deleted_notification_t *n;
 
        kmsg = ikm_alloc(sizeof *n);
        if (kmsg == IKM_NULL) {
-               printf("dropped port-deleted (0x%p, 0x%lx)\n", port, name);
+               printf("dropped port-deleted (0x%p, 0x%x)\n", port, name);
                ipc_port_release_sonce(port);
                return;
        }
@@ -287,15 +287,15 @@ ipc_notify_port_deleted(
 
 void
 ipc_notify_msg_accepted(
-       ipc_port_t      port,
-       mach_port_t     name)
+       ipc_port_t              port,
+       mach_port_name_t        name)
 {
        ipc_kmsg_t kmsg;
        mach_msg_accepted_notification_t *n;
 
        kmsg = ikm_alloc(sizeof *n);
        if (kmsg == IKM_NULL) {
-               printf("dropped msg-accepted (0x%p, 0x%lx)\n", port, name);
+               printf("dropped msg-accepted (0x%p, 0x%x)\n", port, name);
                ipc_port_release_sonce(port);
                return;
        }
@@ -425,15 +425,15 @@ ipc_notify_send_once(ipc_port_t port)
 
 void
 ipc_notify_dead_name(
-       ipc_port_t      port,
-       mach_port_t     name)
+       ipc_port_t              port,
+       mach_port_name_t        name)
 {
        ipc_kmsg_t kmsg;
        mach_dead_name_notification_t *n;
 
        kmsg = ikm_alloc(sizeof *n);
        if (kmsg == IKM_NULL) {
-               printf("dropped dead-name (0x%p, 0x%lx)\n", port, name);
+               printf("dropped dead-name (0x%p, 0x%x)\n", port, name);
                ipc_port_release_sonce(port);
                return;
        }
diff --git a/ipc/ipc_notify.h b/ipc/ipc_notify.h
index 789bd23c..8940f382 100644
--- a/ipc/ipc_notify.h
+++ b/ipc/ipc_notify.h
@@ -38,10 +38,10 @@ extern void
 ipc_notify_init(void);
 
 extern void
-ipc_notify_port_deleted(ipc_port_t, mach_port_t);
+ipc_notify_port_deleted(ipc_port_t, mach_port_name_t);
 
 extern void
-ipc_notify_msg_accepted(ipc_port_t, mach_port_t);
+ipc_notify_msg_accepted(ipc_port_t, mach_port_name_t);
 
 extern void
 ipc_notify_port_destroyed(ipc_port_t, ipc_port_t);
@@ -53,6 +53,6 @@ extern void
 ipc_notify_send_once(ipc_port_t);
 
 extern void
-ipc_notify_dead_name(ipc_port_t, mach_port_t);
+ipc_notify_dead_name(ipc_port_t, mach_port_name_t);
 
 #endif /* _IPC_IPC_NOTIFY_H_ */
diff --git a/ipc/ipc_object.c b/ipc/ipc_object.c
index a6457c37..ebe11492 100644
--- a/ipc/ipc_object.c
+++ b/ipc/ipc_object.c
@@ -106,7 +106,7 @@ ipc_object_release(
 kern_return_t
 ipc_object_translate(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_right_t       right,
        ipc_object_t            *objectp)
 {
@@ -150,7 +150,7 @@ ipc_object_translate(
 kern_return_t
 ipc_object_alloc_dead(
        ipc_space_t     space,
-       mach_port_t     *namep)
+       mach_port_name_t        *namep)
 {
        ipc_entry_t entry;
        kern_return_t kr;
@@ -187,7 +187,7 @@ ipc_object_alloc_dead(
 kern_return_t
 ipc_object_alloc_dead_name(
        ipc_space_t     space,
-       mach_port_t     name)
+       mach_port_name_t        name)
 {
        ipc_entry_t entry;
        kern_return_t kr;
@@ -231,7 +231,7 @@ ipc_object_alloc(
        ipc_object_type_t       otype,
        mach_port_type_t        type,
        mach_port_urefs_t       urefs,
-       mach_port_t             *namep,
+       mach_port_name_t        *namep,
        ipc_object_t            *objectp)
 {
        ipc_object_t object;
@@ -298,7 +298,7 @@ ipc_object_alloc_name(
        ipc_object_type_t       otype,
        mach_port_type_t        type,
        mach_port_urefs_t       urefs,
-       mach_port_t             name,
+       mach_port_name_t        name,
        ipc_object_t            *objectp)
 {
        ipc_object_t object;
@@ -405,7 +405,7 @@ ipc_object_copyin_type(
 kern_return_t
 ipc_object_copyin(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_msg_type_name_t    msgt_name,
        ipc_object_t            *objectp)
 {
@@ -608,9 +608,9 @@ ipc_object_copyout(
        ipc_object_t            object,
        mach_msg_type_name_t    msgt_name,
        boolean_t               overflow,
-       mach_port_t             *namep)
+       mach_port_name_t        *namep)
 {
-       mach_port_t name;
+       mach_port_name_t name;
        ipc_entry_t entry;
        kern_return_t kr;
 
@@ -747,9 +747,9 @@ ipc_object_copyout_name(
        ipc_object_t            object,
        mach_msg_type_name_t    msgt_name,
        boolean_t               overflow,
-       mach_port_t             name)
+       mach_port_name_t        name)
 {
-       mach_port_t oname;
+       mach_port_name_t oname;
        ipc_entry_t oentry;
        ipc_entry_t entry;
        kern_return_t kr;
@@ -826,9 +826,9 @@ ipc_object_copyout_dest(
        ipc_space_t             space,
        ipc_object_t            object,
        mach_msg_type_name_t    msgt_name,
-       mach_port_t             *namep)
+       mach_port_name_t        *namep)
 {
-       mach_port_t name;
+       mach_port_name_t name;
 
        assert(IO_VALID(object));
        assert(io_active(object));
@@ -930,8 +930,8 @@ ipc_object_copyout_dest(
 kern_return_t
 ipc_object_rename(
        ipc_space_t     space,
-       mach_port_t     oname,
-       mach_port_t     nname)
+       mach_port_name_t        oname,
+       mach_port_name_t        nname)
 {
        ipc_entry_t oentry, nentry;
        kern_return_t kr;
diff --git a/ipc/ipc_object.h b/ipc/ipc_object.h
index be5bea71..209fae18 100644
--- a/ipc/ipc_object.h
+++ b/ipc/ipc_object.h
@@ -116,30 +116,30 @@ extern void
 ipc_object_release(ipc_object_t);
 
 extern kern_return_t
-ipc_object_translate(ipc_space_t, mach_port_t,
+ipc_object_translate(ipc_space_t, mach_port_name_t,
                     mach_port_right_t, ipc_object_t *);
 
 extern kern_return_t
-ipc_object_alloc_dead(ipc_space_t, mach_port_t *);
+ipc_object_alloc_dead(ipc_space_t, mach_port_name_t *);
 
 extern kern_return_t
-ipc_object_alloc_dead_name(ipc_space_t, mach_port_t);
+ipc_object_alloc_dead_name(ipc_space_t, mach_port_name_t);
 
 extern kern_return_t
 ipc_object_alloc(ipc_space_t, ipc_object_type_t,
                 mach_port_type_t, mach_port_urefs_t,
-                mach_port_t *, ipc_object_t *);
+                mach_port_name_t *, ipc_object_t *);
 
 extern kern_return_t
 ipc_object_alloc_name(ipc_space_t, ipc_object_type_t,
                      mach_port_type_t, mach_port_urefs_t,
-                     mach_port_t, ipc_object_t *);
+                     mach_port_name_t, ipc_object_t *);
 
 extern mach_msg_type_name_t
 ipc_object_copyin_type(mach_msg_type_name_t);
 
 extern kern_return_t
-ipc_object_copyin(ipc_space_t, mach_port_t,
+ipc_object_copyin(ipc_space_t, mach_port_name_t,
                  mach_msg_type_name_t, ipc_object_t *);
 
 extern void
@@ -150,18 +150,18 @@ ipc_object_destroy(ipc_object_t, mach_msg_type_name_t);
 
 extern kern_return_t
 ipc_object_copyout(ipc_space_t, ipc_object_t,
-                  mach_msg_type_name_t, boolean_t, mach_port_t *);
+                  mach_msg_type_name_t, boolean_t, mach_port_name_t *);
 
 extern kern_return_t
 ipc_object_copyout_name(ipc_space_t, ipc_object_t,
-                       mach_msg_type_name_t, boolean_t, mach_port_t);
+                       mach_msg_type_name_t, boolean_t, mach_port_name_t);
 
 extern void
 ipc_object_copyout_dest(ipc_space_t, ipc_object_t,
-                       mach_msg_type_name_t, mach_port_t *);
+                       mach_msg_type_name_t, mach_port_name_t *);
 
 extern kern_return_t
-ipc_object_rename(ipc_space_t, mach_port_t, mach_port_t);
+ipc_object_rename(ipc_space_t, mach_port_name_t, mach_port_name_t);
 
 extern void
 ipc_object_print(ipc_object_t);
diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c
index 86a4ee2a..a0006cf4 100644
--- a/ipc/ipc_port.c
+++ b/ipc/ipc_port.c
@@ -96,7 +96,7 @@ ipc_port_timestamp(void)
 kern_return_t
 ipc_port_dnrequest(
        ipc_port_t                      port,
-       mach_port_t                     name,
+       mach_port_name_t                name,
        ipc_port_t                      soright,
        ipc_port_request_index_t        *indexp)
 {
@@ -234,7 +234,7 @@ ipc_port_dngrow(ipc_port_t port)
 ipc_port_t
 ipc_port_dncancel(
        ipc_port_t                      port,
-       mach_port_t                     name,
+       mach_port_name_t                name,
        ipc_port_request_index_t        index)
 {
        ipc_port_request_t ipr, table;
@@ -506,9 +506,9 @@ ipc_port_clear_receiver(
 
 void
 ipc_port_init(
-       ipc_port_t      port,
-       ipc_space_t     space,
-       mach_port_t     name)
+       ipc_port_t              port,
+       ipc_space_t             space,
+       mach_port_name_t        name)
 {
        /* port->ip_kobject doesn't have to be initialized */
 
@@ -553,11 +553,11 @@ ipc_port_init(
 kern_return_t
 ipc_port_alloc(
        ipc_space_t     space,
-       mach_port_t     *namep,
+       mach_port_name_t        *namep,
        ipc_port_t      *portp)
 {
        ipc_port_t port;
-       mach_port_t name;
+       mach_port_name_t name;
        kern_return_t kr;
 
        kr = ipc_object_alloc(space, IOT_PORT,
@@ -593,7 +593,7 @@ ipc_port_alloc(
 kern_return_t
 ipc_port_alloc_name(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        ipc_port_t      *portp)
 {
        ipc_port_t port;
@@ -734,7 +734,7 @@ ipc_port_destroy(
 
                for (index = 1; index < size; index++) {
                        ipc_port_request_t ipr = &dnrequests[index];
-                       mach_port_t name = ipr->ipr_name;
+                       mach_port_name_t name = ipr->ipr_name;
                        ipc_port_t soright;
 
                        if (name == MACH_PORT_NULL)
@@ -911,7 +911,7 @@ ipc_port_check_circularity(
 ipc_port_t
 ipc_port_lookup_notify(
        ipc_space_t     space,
-       mach_port_t     name)
+       mach_port_name_t        name)
 {
        ipc_port_t port;
        ipc_entry_t entry;
@@ -1008,12 +1008,12 @@ ipc_port_copy_send(
  *             Nothing locked.
  */
 
-mach_port_t
+mach_port_name_t
 ipc_port_copyout_send(
        ipc_port_t      sright,
        ipc_space_t     space)
 {
-       mach_port_t name;
+       mach_port_name_t name;
 
        if (IP_VALID(sright)) {
                kern_return_t kr;
@@ -1029,7 +1029,7 @@ ipc_port_copyout_send(
                                name = MACH_PORT_NULL;
                }
        } else
-               name = (mach_port_t) sright;
+               name = (mach_port_name_t) sright;
 
        return name;
 }
@@ -1197,7 +1197,7 @@ ipc_port_alloc_special(ipc_space_t space)
         *      the fast rpc path).
         */
 
-       ipc_port_init(port, space, (mach_port_t)port);
+       ipc_port_init(port, space, (mach_port_name_t)port);
 
        return port;
 }
diff --git a/ipc/ipc_port.h b/ipc/ipc_port.h
index ade69679..b0433876 100644
--- a/ipc/ipc_port.h
+++ b/ipc/ipc_port.h
@@ -137,7 +137,7 @@ typedef struct ipc_port_request {
        } notify;
 
        union {
-               mach_port_t name;
+               mach_port_name_t name;
                struct ipc_table_size *size;
        } name;
 } *ipc_port_request_t;
@@ -208,14 +208,14 @@ ipc_port_timestamp(void);
                                     (ipc_object_t *) (portp))
 
 extern kern_return_t
-ipc_port_dnrequest(ipc_port_t, mach_port_t, ipc_port_t,
+ipc_port_dnrequest(ipc_port_t, mach_port_name_t, ipc_port_t,
                   ipc_port_request_index_t *);
 
 extern kern_return_t
 ipc_port_dngrow(ipc_port_t);
 
 extern ipc_port_t
-ipc_port_dncancel(ipc_port_t, mach_port_t, ipc_port_request_index_t);
+ipc_port_dncancel(ipc_port_t, mach_port_name_t, ipc_port_request_index_t);
 
 #define        ipc_port_dnrename(port, index, oname, nname)                    
\
 MACRO_BEGIN                                                            \
@@ -273,13 +273,13 @@ extern void
 ipc_port_clear_receiver(ipc_port_t);
 
 extern void
-ipc_port_init(ipc_port_t, ipc_space_t, mach_port_t);
+ipc_port_init(ipc_port_t, ipc_space_t, mach_port_name_t);
 
 extern kern_return_t
-ipc_port_alloc(ipc_space_t, mach_port_t *, ipc_port_t *);
+ipc_port_alloc(ipc_space_t, mach_port_name_t *, ipc_port_t *);
 
 extern kern_return_t
-ipc_port_alloc_name(ipc_space_t, mach_port_t, ipc_port_t *);
+ipc_port_alloc_name(ipc_space_t, mach_port_name_t, ipc_port_t *);
 
 extern void
 ipc_port_destroy(ipc_port_t);
@@ -288,7 +288,7 @@ extern boolean_t
 ipc_port_check_circularity(ipc_port_t, ipc_port_t);
 
 extern ipc_port_t
-ipc_port_lookup_notify(ipc_space_t, mach_port_t);
+ipc_port_lookup_notify(ipc_space_t, mach_port_name_t);
 
 extern ipc_port_t
 ipc_port_make_send(ipc_port_t);
@@ -296,7 +296,7 @@ ipc_port_make_send(ipc_port_t);
 extern ipc_port_t
 ipc_port_copy_send(ipc_port_t);
 
-extern mach_port_t
+extern mach_port_name_t
 ipc_port_copyout_send(ipc_port_t, ipc_space_t);
 
 extern void
diff --git a/ipc/ipc_pset.c b/ipc/ipc_pset.c
index 884e8972..30c12a2b 100644
--- a/ipc/ipc_pset.c
+++ b/ipc/ipc_pset.c
@@ -69,11 +69,11 @@
 kern_return_t
 ipc_pset_alloc(
        ipc_space_t     space,
-       mach_port_t     *namep,
+       mach_port_name_t        *namep,
        ipc_pset_t      *psetp)
 {
        ipc_pset_t pset;
-       mach_port_t name;
+       mach_port_name_t name;
        kern_return_t kr;
 
        kr = ipc_object_alloc(space, IOT_PORT_SET,
@@ -107,13 +107,12 @@ ipc_pset_alloc(
 kern_return_t
 ipc_pset_alloc_name(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        ipc_pset_t      *psetp)
 {
        ipc_pset_t pset;
        kern_return_t kr;
 
-
        kr = ipc_object_alloc_name(space, IOT_PORT_SET,
                                   MACH_PORT_TYPE_PORT_SET, 0,
                                   name, (ipc_object_t *) &pset);
diff --git a/ipc/ipc_pset.h b/ipc/ipc_pset.h
index e9936fef..3f94be53 100644
--- a/ipc/ipc_pset.h
+++ b/ipc/ipc_pset.h
@@ -66,10 +66,10 @@ typedef struct ipc_pset {
 #define        ips_release(pset)       io_release(&(pset)->ips_object)
 
 extern kern_return_t
-ipc_pset_alloc(ipc_space_t, mach_port_t *, ipc_pset_t *);
+ipc_pset_alloc(ipc_space_t, mach_port_name_t *, ipc_pset_t *);
 
 extern kern_return_t
-ipc_pset_alloc_name(ipc_space_t, mach_port_t, ipc_pset_t *);
+ipc_pset_alloc_name(ipc_space_t, mach_port_name_t, ipc_pset_t *);
 
 extern void
 ipc_pset_add(ipc_pset_t, ipc_port_t);
diff --git a/ipc/ipc_right.c b/ipc/ipc_right.c
index 773b3b10..b62c9314 100644
--- a/ipc/ipc_right.c
+++ b/ipc/ipc_right.c
@@ -65,9 +65,9 @@
 
 kern_return_t
 ipc_right_lookup_write(
-       ipc_space_t     space,
-       mach_port_t     name,
-       ipc_entry_t     *entryp)
+       ipc_space_t             space,
+       mach_port_name_t        name,
+       ipc_entry_t             *entryp)
 {
        ipc_entry_t entry;
 
@@ -105,11 +105,11 @@ boolean_t
 ipc_right_reverse(
        ipc_space_t     space,
        ipc_object_t    object,
-       mach_port_t     *namep,
+       mach_port_name_t        *namep,
        ipc_entry_t     *entryp)
 {
        ipc_port_t port;
-       mach_port_t name;
+       mach_port_name_t name;
        ipc_entry_t entry;
 
        /* would switch on io_otype to handle multiple types of object */
@@ -184,11 +184,11 @@ ipc_right_reverse(
 
 kern_return_t
 ipc_right_dnrequest(
-       ipc_space_t     space,
-       mach_port_t     name,
-       boolean_t       immediate,
-       ipc_port_t      notify,
-       ipc_port_t      *previousp)
+       ipc_space_t             space,
+       mach_port_name_t        name,
+       boolean_t               immediate,
+       ipc_port_t              notify,
+       ipc_port_t              *previousp)
 {
        ipc_port_t previous;
 
@@ -304,10 +304,10 @@ ipc_right_dnrequest(
 
 ipc_port_t
 ipc_right_dncancel(
-       ipc_space_t     space,
-       ipc_port_t      port,
-       mach_port_t     name,
-       ipc_entry_t     entry)
+       ipc_space_t             space,
+       ipc_port_t              port,
+       mach_port_name_t        name,
+       ipc_entry_t             entry)
 {
        ipc_port_t dnrequest;
 
@@ -333,7 +333,7 @@ ipc_right_dncancel(
 boolean_t
 ipc_right_inuse(
        ipc_space_t space,
-       mach_port_t name,
+       mach_port_name_t name,
        ipc_entry_t entry)
 {
        ipc_entry_bits_t bits = entry->ie_bits;
@@ -362,7 +362,7 @@ boolean_t
 ipc_right_check(
        ipc_space_t     space,
        ipc_port_t      port,
-       mach_port_t     name,
+       mach_port_name_t        name,
        ipc_entry_t     entry)
 {
        ipc_entry_bits_t bits;
@@ -431,7 +431,7 @@ ipc_right_check(
 void
 ipc_right_clean(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        ipc_entry_t     entry)
 {
        ipc_entry_bits_t bits = entry->ie_bits;
@@ -555,9 +555,9 @@ ipc_right_clean(
 
 kern_return_t
 ipc_right_destroy(
-       ipc_space_t     space,
-       mach_port_t     name,
-       ipc_entry_t     entry)
+       ipc_space_t             space,
+       mach_port_name_t        name,
+       ipc_entry_t             entry)
 {
        ipc_entry_bits_t bits = entry->ie_bits;
        mach_port_type_t type = IE_BITS_TYPE(bits);
@@ -698,7 +698,7 @@ ipc_right_destroy(
 kern_return_t
 ipc_right_dealloc(
        ipc_space_t space,
-       mach_port_t name,
+       mach_port_name_t name,
        ipc_entry_t entry)
 {
        ipc_entry_bits_t bits = entry->ie_bits;
@@ -874,7 +874,7 @@ ipc_right_dealloc(
 kern_return_t
 ipc_right_delta(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        ipc_entry_t             entry,
        mach_port_right_t       right,
        mach_port_delta_t       delta)
@@ -1196,7 +1196,7 @@ ipc_right_delta(
 kern_return_t
 ipc_right_info(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        ipc_entry_t             entry,
        mach_port_type_t        *typep,
        mach_port_urefs_t       *urefsp)
@@ -1239,7 +1239,7 @@ ipc_right_info(
 boolean_t
 ipc_right_copyin_check(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        ipc_entry_t             entry,
        mach_msg_type_name_t    msgt_name)
 {
@@ -1327,7 +1327,7 @@ ipc_right_copyin_check(
 kern_return_t
 ipc_right_copyin(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        ipc_entry_t             entry,
        mach_msg_type_name_t    msgt_name,
        boolean_t               deadok,
@@ -1660,7 +1660,7 @@ ipc_right_copyin(
 void
 ipc_right_copyin_undo(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        ipc_entry_t             entry,
        mach_msg_type_name_t    msgt_name,
        ipc_object_t            object,
@@ -1746,11 +1746,11 @@ ipc_right_copyin_undo(
 
 kern_return_t
 ipc_right_copyin_two(
-       ipc_space_t     space,
-       mach_port_t     name,
-       ipc_entry_t     entry,
-       ipc_object_t    *objectp,
-       ipc_port_t      *sorightp)
+       ipc_space_t             space,
+       mach_port_name_t        name,
+       ipc_entry_t             entry,
+       ipc_object_t            *objectp,
+       ipc_port_t              *sorightp)
 {
        ipc_entry_bits_t bits = entry->ie_bits;
        mach_port_urefs_t urefs;
@@ -1846,7 +1846,7 @@ ipc_right_copyin_two(
 kern_return_t
 ipc_right_copyout(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        ipc_entry_t             entry,
        mach_msg_type_name_t    msgt_name,
        boolean_t               overflow,
@@ -2028,11 +2028,11 @@ ipc_right_copyout_multiname(space, name, entry, object)
 
 kern_return_t
 ipc_right_rename(
-       ipc_space_t     space,
-       mach_port_t     oname,
-       ipc_entry_t     oentry,
-       mach_port_t     nname,
-       ipc_entry_t     nentry)
+       ipc_space_t             space,
+       mach_port_name_t        oname,
+       ipc_entry_t             oentry,
+       mach_port_name_t        nname,
+       ipc_entry_t             nentry)
 {
        ipc_entry_bits_t bits = oentry->ie_bits;
        ipc_port_request_index_t request = oentry->ie_request;
diff --git a/ipc/ipc_right.h b/ipc/ipc_right.h
index 03642f86..6802abb6 100644
--- a/ipc/ipc_right.h
+++ b/ipc/ipc_right.h
@@ -44,69 +44,69 @@
 #define        ipc_right_lookup_read   ipc_right_lookup_write
 
 extern kern_return_t
-ipc_right_lookup_write(ipc_space_t, mach_port_t, ipc_entry_t *);
+ipc_right_lookup_write(ipc_space_t, mach_port_name_t, ipc_entry_t *);
 
 extern boolean_t
 ipc_right_reverse(ipc_space_t, ipc_object_t,
-                 mach_port_t *, ipc_entry_t *);
+                 mach_port_name_t *, ipc_entry_t *);
 
 extern kern_return_t
-ipc_right_dnrequest(ipc_space_t, mach_port_t, boolean_t,
+ipc_right_dnrequest(ipc_space_t, mach_port_name_t, boolean_t,
                    ipc_port_t, ipc_port_t *);
 
 extern ipc_port_t
-ipc_right_dncancel(ipc_space_t, ipc_port_t, mach_port_t, ipc_entry_t);
+ipc_right_dncancel(ipc_space_t, ipc_port_t, mach_port_name_t, ipc_entry_t);
 
 #define        ipc_right_dncancel_macro(space, port, name, entry)              
\
                (((entry)->ie_request == 0) ? IP_NULL :                 \
                 ipc_right_dncancel((space), (port), (name), (entry)))
 
 extern boolean_t
-ipc_right_inuse(ipc_space_t, mach_port_t, ipc_entry_t);
+ipc_right_inuse(ipc_space_t, mach_port_name_t, ipc_entry_t);
 
 extern boolean_t
-ipc_right_check(ipc_space_t, ipc_port_t, mach_port_t, ipc_entry_t);
+ipc_right_check(ipc_space_t, ipc_port_t, mach_port_name_t, ipc_entry_t);
 
 extern void
-ipc_right_clean(ipc_space_t, mach_port_t, ipc_entry_t);
+ipc_right_clean(ipc_space_t, mach_port_name_t, ipc_entry_t);
 
 extern kern_return_t
-ipc_right_destroy(ipc_space_t, mach_port_t, ipc_entry_t);
+ipc_right_destroy(ipc_space_t, mach_port_name_t, ipc_entry_t);
 
 extern kern_return_t
-ipc_right_dealloc(ipc_space_t, mach_port_t, ipc_entry_t);
+ipc_right_dealloc(ipc_space_t, mach_port_name_t, ipc_entry_t);
 
 extern kern_return_t
-ipc_right_delta(ipc_space_t, mach_port_t, ipc_entry_t,
+ipc_right_delta(ipc_space_t, mach_port_name_t, ipc_entry_t,
                mach_port_right_t, mach_port_delta_t);
 
 extern kern_return_t
-ipc_right_info(ipc_space_t, mach_port_t, ipc_entry_t,
+ipc_right_info(ipc_space_t, mach_port_name_t, ipc_entry_t,
               mach_port_type_t *, mach_port_urefs_t *);
 
 extern boolean_t
-ipc_right_copyin_check(ipc_space_t, mach_port_t, ipc_entry_t,
+ipc_right_copyin_check(ipc_space_t, mach_port_name_t, ipc_entry_t,
                       mach_msg_type_name_t);
 
 extern kern_return_t
-ipc_right_copyin(ipc_space_t, mach_port_t, ipc_entry_t,
+ipc_right_copyin(ipc_space_t, mach_port_name_t, ipc_entry_t,
                 mach_msg_type_name_t, boolean_t,
                 ipc_object_t *, ipc_port_t *);
 
 extern void
-ipc_right_copyin_undo(ipc_space_t, mach_port_t, ipc_entry_t,
+ipc_right_copyin_undo(ipc_space_t, mach_port_name_t, ipc_entry_t,
                      mach_msg_type_name_t, ipc_object_t, ipc_port_t);
 
 extern kern_return_t
-ipc_right_copyin_two(ipc_space_t, mach_port_t, ipc_entry_t,
+ipc_right_copyin_two(ipc_space_t, mach_port_name_t, ipc_entry_t,
                     ipc_object_t *, ipc_port_t *);
 
 extern kern_return_t
-ipc_right_copyout(ipc_space_t, mach_port_t, ipc_entry_t,
+ipc_right_copyout(ipc_space_t, mach_port_name_t, ipc_entry_t,
                  mach_msg_type_name_t, boolean_t, ipc_object_t);
 
 extern kern_return_t
-ipc_right_rename(ipc_space_t, mach_port_t, ipc_entry_t,
-                mach_port_t, ipc_entry_t);
+ipc_right_rename(ipc_space_t, mach_port_name_t, ipc_entry_t,
+                mach_port_name_t, ipc_entry_t);
 
 #endif /* _IPC_IPC_RIGHT_H_ */
diff --git a/ipc/ipc_space.c b/ipc/ipc_space.c
index 894cf58e..77040d13 100644
--- a/ipc/ipc_space.c
+++ b/ipc/ipc_space.c
@@ -194,7 +194,7 @@ ipc_space_destroy(
                mach_port_type_t type = IE_BITS_TYPE(entry->ie_bits);
 
                if (type != MACH_PORT_TYPE_NONE) {
-                       mach_port_t name =
+                       mach_port_name_t name =
                                MACH_PORT_MAKEB(entry->ie_name, entry->ie_bits);
 
                        ipc_right_clean(space, name, entry);
diff --git a/ipc/ipc_space.h b/ipc/ipc_space.h
index a2aac40a..84923e7a 100644
--- a/ipc/ipc_space.h
+++ b/ipc/ipc_space.h
@@ -142,7 +142,7 @@ void                ipc_space_destroy(struct ipc_space *);
 static inline ipc_entry_t
 ipc_entry_lookup(
        ipc_space_t space,
-       mach_port_t name)
+       mach_port_name_t name)
 {
        ipc_entry_t entry;
 
@@ -170,10 +170,10 @@ ipc_entry_lookup(
 static inline kern_return_t
 ipc_entry_get(
        ipc_space_t space,
-       mach_port_t *namep,
+       mach_port_name_t *namep,
        ipc_entry_t *entryp)
 {
-       mach_port_t new_name;
+       mach_port_name_t new_name;
        ipc_entry_t free_entry;
 
        assert(space->is_active);
@@ -229,7 +229,7 @@ ipc_entry_get(
 static inline void
 ipc_entry_dealloc(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        ipc_entry_t     entry)
 {
        assert(space->is_active);
diff --git a/ipc/ipc_target.c b/ipc/ipc_target.c
index aa35a595..94c5d407 100644
--- a/ipc/ipc_target.c
+++ b/ipc/ipc_target.c
@@ -26,7 +26,7 @@
 #include "ipc_target.h"
 
 void
-ipc_target_init(struct ipc_target *ipt, mach_port_t name)
+ipc_target_init(struct ipc_target *ipt, mach_port_name_t name)
 {
        ipt->ipt_name = name;
        ipc_mqueue_init(&ipt->ipt_messages);
diff --git a/ipc/ipc_target.h b/ipc/ipc_target.h
index a66e6875..86a0e44b 100644
--- a/ipc/ipc_target.h
+++ b/ipc/ipc_target.h
@@ -33,7 +33,7 @@ typedef struct ipc_target {
 
        struct ipc_object ipt_object;
 
-       mach_port_t ipt_name;
+       mach_port_name_t ipt_name;
        struct ipc_mqueue ipt_messages;
 
 #ifdef MIGRATING_THREADS
@@ -56,7 +56,7 @@ typedef struct ipc_target {
 #define IPT_TYPE_MESSAGE_RPC   1
 #define IPT_TYPE_MIGRATE_RPC   2
 
-void ipc_target_init(struct ipc_target *ipt, mach_port_t name);
+void ipc_target_init(struct ipc_target *ipt, mach_port_name_t name);
 void ipc_target_terminate(struct ipc_target *ipt);
 
 #define ipt_lock(ipt)          io_lock(&(ipt)->ipt_object)
diff --git a/ipc/mach_debug.c b/ipc/mach_debug.c
index aadd9066..1f3865bc 100644
--- a/ipc/mach_debug.c
+++ b/ipc/mach_debug.c
@@ -189,7 +189,7 @@ host_ipc_marequest_info(
 kern_return_t
 mach_port_dnrequest_info(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        unsigned int    *totalp,
        unsigned int    *usedp)
 {
@@ -248,7 +248,7 @@ mach_port_dnrequest_info(
 kern_return_t
 mach_port_kernel_object(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        unsigned int    *typep,
        vm_offset_t     *addrp)
 {
diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c
index 3a75fef6..c4b1fed6 100644
--- a/ipc/mach_msg.c
+++ b/ipc/mach_msg.c
@@ -93,7 +93,7 @@ mach_msg_send(
        mach_msg_option_t       option,
        mach_msg_size_t         send_size,
        mach_msg_timeout_t      time_out,
-       mach_port_t             notify)
+       mach_port_name_t        notify)
 {
        ipc_space_t space = current_space();
        vm_map_t map = current_map();
@@ -174,9 +174,9 @@ mach_msg_receive(
        mach_msg_header_t       *msg,
        mach_msg_option_t       option,
        mach_msg_size_t         rcv_size,
-       mach_port_t             rcv_name,
+       mach_port_name_t        rcv_name,
        mach_msg_timeout_t      time_out,
-       mach_port_t             notify)
+       mach_port_name_t        notify)
 {
        ipc_thread_t self = current_thread();
        ipc_space_t space = current_space();
@@ -384,9 +384,9 @@ mach_msg_trap(
        mach_msg_option_t       option,
        mach_msg_size_t         send_size,
        mach_msg_size_t         rcv_size,
-       mach_port_t             rcv_name,
+       mach_port_name_t        rcv_name,
        mach_msg_timeout_t      time_out,
-       mach_port_t             notify)
+       mach_port_name_t        notify)
 {
        mach_msg_return_t mr;
 
@@ -482,7 +482,7 @@ mach_msg_trap(
                                        MACH_MSG_TYPE_MAKE_SEND_ONCE): {
                        ipc_port_t reply_port;
                    {
-                       mach_port_t reply_name =
+                       mach_port_name_t reply_name =
                                kmsg->ikm_header.msgh_local_port;
 
                        if (reply_name != rcv_name)
@@ -500,7 +500,7 @@ mach_msg_trap(
                    }
 
                    {
-                       mach_port_t dest_name =
+                       mach_port_name_t dest_name =
                                kmsg->ikm_header.msgh_remote_port;
 
                        ipc_entry_t entry;
@@ -602,7 +602,7 @@ mach_msg_trap(
                        /* sending a reply message */
 
                    {
-                       mach_port_t reply_name =
+                       mach_port_name_t reply_name =
                                kmsg->ikm_header.msgh_local_port;
 
                        if (reply_name != MACH_PORT_NULL)
@@ -614,7 +614,7 @@ mach_msg_trap(
 
                    {
                        ipc_entry_t entry;
-                       mach_port_t dest_name =
+                       mach_port_name_t dest_name =
                                kmsg->ikm_header.msgh_remote_port;
 
                        entry = ipc_entry_lookup (space, dest_name);
@@ -950,7 +950,7 @@ mach_msg_trap(
                                        MACH_MSG_TYPE_PORT_SEND_ONCE): {
                        ipc_port_t reply_port =
                                (ipc_port_t) kmsg->ikm_header.msgh_local_port;
-                       mach_port_t dest_name, reply_name;
+                       mach_port_name_t dest_name, reply_name;
                        unsigned long payload;
 
                        /* receiving a request message */
@@ -1055,7 +1055,7 @@ mach_msg_trap(
                    }
 
                    case MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0): {
-                       mach_port_t dest_name;
+                       mach_port_name_t dest_name;
                        unsigned long payload;
 
                        /* receiving a reply message */
@@ -1100,7 +1100,7 @@ mach_msg_trap(
 
                    case MACH_MSGH_BITS_COMPLEX|
                         MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0): {
-                       mach_port_t dest_name;
+                       mach_port_name_t dest_name;
                        unsigned long payload;
 
                        /* receiving a complex reply message */
diff --git a/ipc/mach_msg.h b/ipc/mach_msg.h
index ce0fe4d4..ee093f8d 100644
--- a/ipc/mach_msg.h
+++ b/ipc/mach_msg.h
@@ -41,12 +41,12 @@
 
 extern mach_msg_return_t
 mach_msg_send(mach_msg_header_t *, mach_msg_option_t,
-             mach_msg_size_t, mach_msg_timeout_t, mach_port_t);
+             mach_msg_size_t, mach_msg_timeout_t, mach_port_name_t);
 
 extern mach_msg_return_t
 mach_msg_receive(mach_msg_header_t *, mach_msg_option_t,
-                mach_msg_size_t, mach_port_t,
-                mach_msg_timeout_t, mach_port_t);
+                mach_msg_size_t, mach_port_name_t,
+                mach_msg_timeout_t, mach_port_name_t);
 
 extern void
 mach_msg_receive_continue(void);
diff --git a/ipc/mach_port.c b/ipc/mach_port.c
index 54e2e09f..dbd24ae7 100644
--- a/ipc/mach_port.c
+++ b/ipc/mach_port.c
@@ -73,7 +73,7 @@ void
 mach_port_names_helper(
        ipc_port_timestamp_t    timestamp,
        ipc_entry_t             entry,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_name_t        *names,
        mach_port_type_t        *types,
        ipc_entry_num_t         *actualp)
@@ -187,7 +187,7 @@ mach_port_names(
                /* upper bound on number of names in the space */
 
                bound = space->is_size;
-               size_needed = round_page(bound * sizeof(mach_port_t));
+               size_needed = round_page(bound * sizeof(mach_port_name_t));
 
                if (size_needed <= size)
                        break;
@@ -254,7 +254,7 @@ mach_port_names(
        } else {
                vm_size_t size_used;
 
-               size_used = round_page(actual * sizeof(mach_port_t));
+               size_used = round_page(actual * sizeof(mach_port_name_t));
 
                /*
                 *      Make used memory pageable and get it into
@@ -327,7 +327,7 @@ mach_port_names(
 kern_return_t
 mach_port_type(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_type_t        *typep)
 {
        mach_port_urefs_t urefs;
@@ -368,9 +368,9 @@ mach_port_type(
 
 kern_return_t
 mach_port_rename(
-       ipc_space_t     space,
-       mach_port_t     oname,
-       mach_port_t     nname)
+       ipc_space_t             space,
+       mach_port_name_t        oname,
+       mach_port_name_t        nname)
 {
        if (space == IS_NULL)
                return KERN_INVALID_TASK;
@@ -416,7 +416,7 @@ kern_return_t
 mach_port_allocate_name(
        ipc_space_t             space,
        mach_port_right_t       right,
-       mach_port_t             name)
+       mach_port_name_t        name)
 {
        kern_return_t kr;
 
@@ -479,7 +479,7 @@ kern_return_t
 mach_port_allocate(
        ipc_space_t             space,
        mach_port_right_t       right,
-       mach_port_t             *namep)
+       mach_port_name_t        *namep)
 {
        kern_return_t kr;
 
@@ -538,8 +538,8 @@ static volatile boolean_t mach_port_deallocate_debug = 
FALSE;
 
 kern_return_t
 mach_port_destroy(
-       ipc_space_t     space,
-       mach_port_t     name)
+       ipc_space_t             space,
+       mach_port_name_t        name)
 {
        ipc_entry_t entry;
        kern_return_t kr;
@@ -582,8 +582,8 @@ mach_port_destroy(
 
 kern_return_t
 mach_port_deallocate(
-       ipc_space_t     space,
-       mach_port_t     name)
+       ipc_space_t             space,
+       mach_port_name_t        name)
 {
        ipc_entry_t entry;
        kern_return_t kr;
@@ -626,7 +626,7 @@ mach_port_deallocate(
 kern_return_t
 mach_port_get_refs(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_right_t       right,
        mach_port_urefs_t       *urefsp)
 {
@@ -700,7 +700,7 @@ mach_port_get_refs(
 kern_return_t
 mach_port_mod_refs(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_right_t       right,
        mach_port_delta_t       delta)
 {
@@ -717,7 +717,7 @@ mach_port_mod_refs(
        if (kr != KERN_SUCCESS) {
                if (MACH_PORT_VALID (name) && space == current_space()) {
                        printf("task %.*s %screasing a bogus port "
-                              "%lu by %d, most probably a bug.\n",
+                              "%u by %d, most probably a bug.\n",
                               (int) (sizeof current_task()->name),
                               current_task()->name,
                               delta < 0 ? "de" : "in", name,
@@ -753,7 +753,7 @@ mach_port_mod_refs(
 kern_return_t
 mach_port_set_qlimit(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_msgcount_t    qlimit)
 {
        ipc_port_t port;
@@ -793,7 +793,7 @@ mach_port_set_qlimit(
 kern_return_t
 mach_port_set_mscount(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_mscount_t     mscount)
 {
        ipc_port_t port;
@@ -830,7 +830,7 @@ mach_port_set_mscount(
 kern_return_t
 mach_port_set_seqno(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_seqno_t       seqno)
 {
        ipc_port_t port;
@@ -861,11 +861,11 @@ mach_port_gst_helper(
        ipc_pset_t              pset,
        ipc_port_t              port,
        ipc_entry_num_t         maxnames,
-       mach_port_t             *names,
+       mach_port_name_t        *names,
        ipc_entry_num_t         *actualp)
 {
        ipc_pset_t ip_pset;
-       mach_port_t name;
+       mach_port_name_t name;
 
        assert(port != IP_NULL);
 
@@ -907,8 +907,8 @@ mach_port_gst_helper(
 kern_return_t
 mach_port_get_set_status(
        ipc_space_t                     space,
-       mach_port_t                     name,
-       mach_port_t                     **members,
+       mach_port_name_t                name,
+       mach_port_name_t                **members,
        mach_msg_type_number_t          *membersCnt)
 {
        ipc_entry_num_t actual;         /* this many members */
@@ -926,7 +926,7 @@ mach_port_get_set_status(
 
        for (;;) {
                ipc_entry_t entry;
-               mach_port_t *names;
+               mach_port_name_t *names;
                ipc_pset_t pset;
 
                kr = vm_allocate(ipc_kernel_map, &addr, size, TRUE);
@@ -958,7 +958,7 @@ mach_port_get_set_status(
                assert(pset != IPS_NULL);
                /* the port set must be active */
 
-               names = (mach_port_t *) addr;
+               names = (mach_port_name_t *) addr;
                maxnames = size / sizeof(mach_port_t);
                actual = 0;
 
@@ -984,7 +984,7 @@ mach_port_get_set_status(
                /* didn't have enough memory; allocate more */
 
                kmem_free(ipc_kernel_map, addr, size);
-               size = round_page(actual * sizeof(mach_port_t)) + PAGE_SIZE;
+               size = round_page(actual * sizeof(mach_port_name_t)) + 
PAGE_SIZE;
        }
 
        if (actual == 0) {
@@ -994,7 +994,7 @@ mach_port_get_set_status(
        } else {
                vm_size_t size_used;
 
-               size_used = round_page(actual * sizeof(mach_port_t));
+               size_used = round_page(actual * sizeof(mach_port_name_t));
 
                /*
                 *      Make used memory pageable and get it into
@@ -1015,7 +1015,7 @@ mach_port_get_set_status(
                                  addr + size_used, size - size_used);
        }
 
-       *members = (mach_port_t *) memory;
+       *members = (mach_port_name_t *) memory;
        *membersCnt = actual;
        return KERN_SUCCESS;
 }
@@ -1044,7 +1044,7 @@ mach_port_get_set_status(
 kern_return_t
 mach_port_move_member(
        ipc_space_t     space,
-       mach_port_t     member,
+       mach_port_name_t        member,
        mach_port_t     after)
 {
        ipc_entry_t entry;
@@ -1138,7 +1138,7 @@ mach_port_move_member(
 kern_return_t
 mach_port_request_notification(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t                name,
        mach_msg_id_t           id,
        mach_port_mscount_t     sync,
        ipc_port_t              notify,
@@ -1222,7 +1222,7 @@ mach_port_request_notification(
 kern_return_t
 mach_port_insert_right(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        ipc_port_t              poly,
        mach_msg_type_name_t    polyPoly)
 {
@@ -1296,7 +1296,7 @@ mach_port_extract_right(
 kern_return_t
 mach_port_get_receive_status(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_status_t      *statusp)
 {
        ipc_port_t port;
@@ -1350,7 +1350,7 @@ mach_port_get_receive_status(
 kern_return_t
 mach_port_set_rpcinfo(
        ipc_space_t     space,
-       mach_port_t     name,
+       mach_port_name_t        name,
        void            *rpc_info,
        unsigned int    rpc_info_count)
 {
@@ -1394,7 +1394,7 @@ void sact_count(void)
 kern_return_t
 mach_port_create_act(
        task_t          task,
-       mach_port_t     name,
+       mach_port_name_t        name,
        vm_offset_t     user_stack,
        vm_offset_t     user_rbuf,
        vm_size_t       user_rbuf_size,
@@ -1467,7 +1467,7 @@ mach_port_create_act(
 kern_return_t
 mach_port_set_syscall_right(
        task_t          task,
-       mach_port_t     name)
+       mach_port_name_t        name)
 {
        ipc_entry_t entry;
        kern_return_t kr;
@@ -1511,7 +1511,7 @@ mach_port_set_syscall_right(
 kern_return_t
 mach_port_set_protected_payload(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        unsigned long           payload)
 {
        ipc_port_t port;
@@ -1548,7 +1548,7 @@ mach_port_set_protected_payload(
 kern_return_t
 mach_port_clear_protected_payload(
        ipc_space_t             space,
-       mach_port_t             name)
+       mach_port_name_t        name)
 {
        ipc_port_t port;
        kern_return_t kr;
diff --git a/ipc/mach_port.h b/ipc/mach_port.h
index 073f7946..83641ae6 100644
--- a/ipc/mach_port.h
+++ b/ipc/mach_port.h
@@ -34,35 +34,35 @@ extern kern_return_t
 mach_port_allocate_name (
     ipc_space_t space,
     mach_port_right_t right,
-    mach_port_t name);
+    mach_port_name_t name);
 
 extern kern_return_t
 mach_port_allocate (
     ipc_space_t space,
     mach_port_right_t right,
-    mach_port_t *namep);
+    mach_port_name_t *namep);
 
 extern kern_return_t
 mach_port_destroy(
     ipc_space_t space,
-    mach_port_t name);
+    mach_port_name_t name);
 
 extern kern_return_t
 mach_port_deallocate(
     ipc_space_t space,
-    mach_port_t name);
+    mach_port_name_t name);
 
 extern kern_return_t
 mach_port_insert_right(
     ipc_space_t     space,
-    mach_port_t     name,
+    mach_port_name_t     name,
     ipc_port_t      poly,
     mach_msg_type_name_t    polyPoly);
 
 kern_return_t
 mach_port_get_receive_status(
        ipc_space_t             space,
-       mach_port_t             name,
+       mach_port_name_t        name,
        mach_port_status_t      *statusp);
 
 #if    MACH_KDB
diff --git a/ipc/mach_rpc.c b/ipc/mach_rpc.c
index 6ca46cc9..7b747f79 100644
--- a/ipc/mach_rpc.c
+++ b/ipc/mach_rpc.c
@@ -105,7 +105,7 @@ mach_port_rpc_copy(
 
        tname = ipc_object_copyin_type(portp->msgt_name);
        if (!IO_VALID(iname)) {
-               portp->name = (mach_port_t) iname;
+               portp->name = (mach_port_name_t) iname;
                portp->msgt_name = tname;
 #ifdef DEBUG_MPRC
                printf("iport %x invalid\n", iname);
@@ -114,7 +114,7 @@ mach_port_rpc_copy(
        }
 
        if (ISKERNELACT(dact)) {
-               portp->name = (mach_port_t) iname;
+               portp->name = (mach_port_name_t) iname;
                kr = KERN_SUCCESS;
        } else {
                kr = ipc_object_copyout(dspace, iname, tname, TRUE,
diff --git a/kern/exception.c b/kern/exception.c
index 6a812490..2ff122f2 100644
--- a/kern/exception.c
+++ b/kern/exception.c
@@ -269,9 +269,9 @@ exception_no_server(void)
 struct mach_exception {
        mach_msg_header_t       Head;
        mach_msg_type_t         threadType;
-       mach_port_t             thread;
+       mach_port_name_t        thread;
        mach_msg_type_t         taskType;
-       mach_port_t             task;
+       mach_port_name_t        task;
        mach_msg_type_t         exceptionType;
        integer_t               exception;
        mach_msg_type_t         codeType;
@@ -607,10 +607,12 @@ exception_raise(
     {
        kern_return_t kr;
        ipc_entry_t entry;
+       mach_port_name_t port_name;
 
-       kr = ipc_entry_get (space, &exc->Head.msgh_remote_port, &entry);
+       kr = ipc_entry_get (space, &port_name, &entry);
        if (kr)
                goto abort_copyout;
+       exc->Head.msgh_remote_port = (mach_port_t) port_name;
     {
        mach_port_gen_t gen;
 
diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
index 22dac420..611ccee9 100644
--- a/kern/ipc_mig.c
+++ b/kern/ipc_mig.c
@@ -145,9 +145,9 @@ mach_msg(
        mach_msg_option_t       option,
        mach_msg_size_t         send_size,
        mach_msg_size_t         rcv_size,
-       mach_port_t             rcv_name,
+       mach_port_name_t        rcv_name,
        mach_msg_timeout_t      time_out,
-       mach_port_t             notify)
+       mach_port_name_t        notify)
 {
        ipc_space_t space = current_space();
        vm_map_t map = current_map();
@@ -230,7 +230,7 @@ mach_msg(
  *             mach_msg() calls which are kernel calls.
  */
 
-mach_port_t
+mach_port_name_t
 mig_get_reply_port(void)
 {
        ipc_thread_t self = current_thread();
@@ -334,7 +334,7 @@ MACRO_BEGIN                                                 
        \
 MACRO_END
 
 device_t
-port_name_to_device(mach_port_t name)
+port_name_to_device(mach_port_name_t name)
 {
        ipc_port_t port;
        device_t device;
@@ -377,7 +377,7 @@ port_name_to_device(mach_port_t name)
 }
 
 thread_t
-port_name_to_thread(mach_port_t name)
+port_name_to_thread(mach_port_name_t name)
 {
        ipc_port_t port;
 
@@ -422,7 +422,7 @@ port_name_to_thread(mach_port_t name)
 }
 
 task_t
-port_name_to_task(mach_port_t name)
+port_name_to_task(mach_port_name_t name)
 {
        ipc_port_t port;
 
@@ -470,7 +470,7 @@ port_name_to_task(mach_port_t name)
 
 vm_map_t
 port_name_to_map(
-       mach_port_t     name)
+       mach_port_name_t        name)
 {
        ipc_port_t port;
 
@@ -517,7 +517,7 @@ port_name_to_map(
 }
 
 ipc_space_t
-port_name_to_space(mach_port_t name)
+port_name_to_space(mach_port_name_t name)
 {
        ipc_port_t port;
 
@@ -573,7 +573,7 @@ port_name_to_space(mach_port_t name)
  */
 
 kern_return_t thread_get_state_KERNEL(
-       mach_port_t     thread_port,    /* port right for thread */
+       mach_port_name_t        thread_port,    /* port right for thread */
        int             flavor,
        thread_state_t  old_state,      /* pointer to OUT array */
        natural_t       *old_state_count)       /* IN/OUT */
@@ -619,12 +619,12 @@ kern_return_t thread_set_state_KERNEL(
 
 kern_return_t
 syscall_vm_map(
-       mach_port_t     target_map,
+       mach_port_name_t        target_map,
        vm_offset_t     *address,
        vm_size_t       size,
        vm_offset_t     mask,
        boolean_t       anywhere,
-       mach_port_t     memory_object,
+       mach_port_name_t        memory_object,
        vm_offset_t     offset,
        boolean_t       copy,
        vm_prot_t       cur_protection,
@@ -665,7 +665,7 @@ syscall_vm_map(
 }
 
 kern_return_t syscall_vm_allocate(
-       mach_port_t             target_map,
+       mach_port_name_t                target_map,
        vm_offset_t             *address,
        vm_size_t               size,
        boolean_t               anywhere)
@@ -688,7 +688,7 @@ kern_return_t syscall_vm_allocate(
 }
 
 kern_return_t syscall_vm_deallocate(
-       mach_port_t             target_map,
+       mach_port_name_t                target_map,
        vm_offset_t             start,
        vm_size_t               size)
 {
@@ -706,13 +706,13 @@ kern_return_t syscall_vm_deallocate(
 }
 
 kern_return_t syscall_task_create(
-       mach_port_t     parent_task,
-       boolean_t       inherit_memory,
-       mach_port_t     *child_task)            /* OUT */
+       mach_port_name_t        parent_task,
+       boolean_t                       inherit_memory,
+       mach_port_name_t        *child_task)            /* OUT */
 {
        task_t          t, c;
        ipc_port_t      port;
-       mach_port_t     name;
+       mach_port_name_t        name;
        kern_return_t   result;
 
        t = port_name_to_task(parent_task);
@@ -726,15 +726,14 @@ kern_return_t syscall_task_create(
                (void) ipc_kmsg_copyout_object(current_space(),
                                               (ipc_object_t) port,
                                               MACH_MSG_TYPE_PORT_SEND, &name);
-               copyout(&name, child_task,
-                       sizeof(mach_port_t));
+               copyout(&name, child_task, sizeof(mach_port_name_t));
        }
        task_deallocate(t);
 
        return result;
 }
 
-kern_return_t syscall_task_terminate(mach_port_t task)
+kern_return_t syscall_task_terminate(mach_port_name_t task)
 {
        task_t          t;
        kern_return_t   result;
@@ -749,7 +748,7 @@ kern_return_t syscall_task_terminate(mach_port_t task)
        return result;
 }
 
-kern_return_t syscall_task_suspend(mach_port_t task)
+kern_return_t syscall_task_suspend(mach_port_name_t task)
 {
        task_t          t;
        kern_return_t   result;
@@ -765,9 +764,9 @@ kern_return_t syscall_task_suspend(mach_port_t task)
 }
 
 kern_return_t syscall_task_set_special_port(
-       mach_port_t     task,
+       mach_port_name_t        task,
        int             which_port,
-       mach_port_t     port_name)
+       mach_port_name_t        port_name)
 {
        task_t          t;
        ipc_port_t      port;
@@ -798,12 +797,12 @@ kern_return_t syscall_task_set_special_port(
 
 kern_return_t
 syscall_mach_port_allocate(
-       mach_port_t             task,
+       mach_port_name_t        task,
        mach_port_right_t       right,
-       mach_port_t             *namep)
+       mach_port_name_t        *namep)
 {
        ipc_space_t space;
-       mach_port_t name;
+       mach_port_name_t name;
        kern_return_t kr;
 
        space = port_name_to_space(task);
@@ -812,7 +811,7 @@ syscall_mach_port_allocate(
 
        kr = mach_port_allocate(space, right, &name);
        if (kr == KERN_SUCCESS)
-               copyout(&name, namep, sizeof(mach_port_t));
+               copyout(&name, namep, sizeof(mach_port_name_t));
        is_release(space);
 
        return kr;
@@ -820,9 +819,9 @@ syscall_mach_port_allocate(
 
 kern_return_t
 syscall_mach_port_allocate_name(
-       mach_port_t             task,
+       mach_port_name_t        task,
        mach_port_right_t       right,
-       mach_port_t             name)
+       mach_port_name_t        name)
 {
        ipc_space_t space;
        kern_return_t kr;
@@ -839,8 +838,8 @@ syscall_mach_port_allocate_name(
 
 kern_return_t
 syscall_mach_port_deallocate(
-       mach_port_t task,
-       mach_port_t name)
+       mach_port_name_t task,
+       mach_port_name_t name)
 {
        ipc_space_t space;
        kern_return_t kr;
@@ -857,9 +856,9 @@ syscall_mach_port_deallocate(
 
 kern_return_t
 syscall_mach_port_insert_right(
-       mach_port_t             task,
-       mach_port_t             name,
-       mach_port_t             right,
+       mach_port_name_t                task,
+       mach_port_name_t                name,
+       mach_port_name_t                right,
        mach_msg_type_name_t    rightType)
 {
        ipc_space_t space;
@@ -895,7 +894,7 @@ syscall_mach_port_insert_right(
        return kr;
 }
 
-kern_return_t syscall_thread_depress_abort(mach_port_t thread)
+kern_return_t syscall_thread_depress_abort(mach_port_name_t thread)
 {
        thread_t        t;
        kern_return_t   result;
@@ -914,8 +913,8 @@ kern_return_t syscall_thread_depress_abort(mach_port_t 
thread)
  * Device traps -- these are way experimental.
  */
 io_return_t
-syscall_device_write_request(mach_port_t       device_name,
-                            mach_port_t        reply_name,
+syscall_device_write_request(mach_port_name_t  device_name,
+                            mach_port_name_t   reply_name,
                             dev_mode_t         mode,
                             recnum_t           recnum,
                             vm_offset_t        data,
@@ -965,8 +964,8 @@ syscall_device_write_request(mach_port_t    device_name,
 }
 
 io_return_t
-syscall_device_writev_request(mach_port_t      device_name,
-                             mach_port_t       reply_name,
+syscall_device_writev_request(mach_port_name_t device_name,
+                             mach_port_name_t  reply_name,
                              dev_mode_t        mode,
                              recnum_t          recnum,
                              io_buf_vec_t      *iovec,
diff --git a/kern/ipc_mig.h b/kern/ipc_mig.h
index 6f063eca..469f629c 100644
--- a/kern/ipc_mig.h
+++ b/kern/ipc_mig.h
@@ -64,12 +64,12 @@ extern mach_msg_return_t mach_msg_rpc_from_kernel(
     mach_msg_size_t reply_size);
 
 extern kern_return_t syscall_vm_map(
-       mach_port_t     target_map,
+       mach_port_name_t        target_map,
        vm_offset_t     *address,
        vm_size_t       size,
        vm_offset_t     mask,
        boolean_t       anywhere,
-       mach_port_t     memory_object,
+       mach_port_name_t        memory_object,
        vm_offset_t     offset,
        boolean_t       copy,
        vm_prot_t       cur_protection,
@@ -77,63 +77,63 @@ extern kern_return_t syscall_vm_map(
        vm_inherit_t    inheritance);
 
 extern kern_return_t syscall_vm_allocate(
-       mach_port_t             target_map,
+       mach_port_name_t        target_map,
        vm_offset_t             *address,
        vm_size_t               size,
        boolean_t               anywhere);
 
 extern kern_return_t syscall_vm_deallocate(
-       mach_port_t             target_map,
+       mach_port_name_t        target_map,
        vm_offset_t             start,
        vm_size_t               size);
 
 extern kern_return_t syscall_task_create(
-       mach_port_t     parent_task,
-       boolean_t       inherit_memory,
-       mach_port_t     *child_task);
+       mach_port_name_t        parent_task,
+       boolean_t               inherit_memory,
+       mach_port_name_t        *child_task);
 
-extern kern_return_t syscall_task_terminate(mach_port_t task);
+extern kern_return_t syscall_task_terminate(mach_port_name_t task);
 
-extern kern_return_t syscall_task_suspend(mach_port_t task);
+extern kern_return_t syscall_task_suspend(mach_port_name_t task);
 
 extern kern_return_t syscall_task_set_special_port(
-       mach_port_t     task,
+       mach_port_name_t        task,
        int             which_port,
-       mach_port_t     port_name);
+       mach_port_name_t        port_name);
 
 extern kern_return_t syscall_mach_port_allocate(
-       mach_port_t             task,
-       mach_port_right_t       right,
-       mach_port_t             *namep);
+       mach_port_name_t                task,
+       mach_port_right_t               right,
+       mach_port_name_t                *namep);
 
 extern kern_return_t syscall_mach_port_deallocate(
-       mach_port_t task,
-       mach_port_t name);
+       mach_port_name_t task,
+       mach_port_name_t name);
 
 extern kern_return_t syscall_mach_port_insert_right(
-       mach_port_t task,
-       mach_port_t name,
-       mach_port_t right,
+       mach_port_name_t task,
+       mach_port_name_t name,
+       mach_port_name_t right,
        mach_msg_type_name_t rightType);
 
 extern kern_return_t syscall_mach_port_allocate_name(
-       mach_port_t             task,
-       mach_port_right_t       right,
-       mach_port_t             name);
+       mach_port_name_t                task,
+       mach_port_right_t               right,
+       mach_port_name_t                name);
 
-extern kern_return_t syscall_thread_depress_abort(mach_port_t thread);
+extern kern_return_t syscall_thread_depress_abort(mach_port_name_t thread);
 
 extern io_return_t syscall_device_write_request(
-                       mach_port_t     device_name,
-                       mach_port_t     reply_name,
-                       dev_mode_t      mode,
-                       recnum_t        recnum,
-                       vm_offset_t     data,
-                       vm_size_t       data_count);
+                       mach_port_name_t        device_name,
+                       mach_port_name_t        reply_name,
+                       dev_mode_t              mode,
+                       recnum_t                recnum,
+                       vm_offset_t             data,
+                       vm_size_t               data_count);
 
 io_return_t syscall_device_writev_request(
-                       mach_port_t     device_name,
-                       mach_port_t     reply_name,
+                       mach_port_name_t        device_name,
+                       mach_port_name_t        reply_name,
                        dev_mode_t      mode,
                        recnum_t        recnum,
                        io_buf_vec_t    *iovec,
diff --git a/kern/ipc_tt.c b/kern/ipc_tt.c
index 04a5a92f..0b10204c 100644
--- a/kern/ipc_tt.c
+++ b/kern/ipc_tt.c
@@ -554,11 +554,11 @@ mach_thread_self(void)
  *             or other errors.
  */
 
-mach_port_t
+mach_port_name_t
 mach_reply_port(void)
 {
        ipc_port_t port;
-       mach_port_t name;
+       mach_port_name_t name;
        kern_return_t kr;
 
        kr = ipc_port_alloc(current_task()->itk_space, &name, &port);
diff --git a/kern/ipc_tt.h b/kern/ipc_tt.h
index 78cb43ad..5c667387 100644
--- a/kern/ipc_tt.h
+++ b/kern/ipc_tt.h
@@ -86,7 +86,7 @@ convert_port_to_space(struct ipc_port *);
 extern void
 space_deallocate(ipc_space_t);
 
-mach_port_t
+mach_port_name_t
 mach_reply_port (void);
 
 #endif /* _KERN_IPC_TT_H_ */
diff --git a/kern/thread.h b/kern/thread.h
index ddf4e1da..da8bd2ed 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -172,7 +172,7 @@ struct thread {
        struct ipc_port *ith_sself;     /* a send right */
        struct ipc_port *ith_exception; /* a send right */
 
-       mach_port_t ith_mig_reply;      /* reply port for mig */
+       mach_port_name_t ith_mig_reply; /* reply port for mig */
        struct ipc_port *ith_rpc_reply; /* reply port for kernel RPCs */
 
        /* State saved when thread's stack is discarded */
@@ -182,7 +182,7 @@ struct thread {
                        mach_msg_option_t option;
                        mach_msg_size_t rcv_size;
                        mach_msg_timeout_t timeout;
-                       mach_port_t notify;
+                       mach_port_name_t notify;
                        struct ipc_object *object;
                        struct ipc_mqueue *mqueue;
                } receive;
-- 
2.37.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]