bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 08/15] use port name type in mach_port_names()


From: Luca Dariz
Subject: [PATCH 08/15] use port name type in mach_port_names()
Date: Tue, 28 Jun 2022 12:10:47 +0200

* ipc/mach_port.c: use mach_port_name_t instead of mach_port_t, since
  they could have different size. Fortunately we can keep the same
  optimization about allocationg memory, since mach_port_type_t has
  the same size as a name.

Signed-off-by: Luca Dariz <luca@orpolo.org>
---
 ipc/mach_port.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ipc/mach_port.c b/ipc/mach_port.c
index 0757bb84..54e2e09f 100644
--- a/ipc/mach_port.c
+++ b/ipc/mach_port.c
@@ -74,7 +74,7 @@ mach_port_names_helper(
        ipc_port_timestamp_t    timestamp,
        ipc_entry_t             entry,
        mach_port_t             name,
-       mach_port_t             *names,
+       mach_port_name_t        *names,
        mach_port_type_t        *types,
        ipc_entry_num_t         *actualp)
 {
@@ -145,14 +145,14 @@ mach_port_names_helper(
 kern_return_t
 mach_port_names(
        ipc_space_t             space,
-       mach_port_t             **namesp,
+       mach_port_name_t        **namesp,
        mach_msg_type_number_t  *namesCnt,
        mach_port_type_t        **typesp,
        mach_msg_type_number_t  *typesCnt)
 {
        ipc_entry_num_t actual; /* this many names */
        ipc_port_timestamp_t timestamp; /* logical time of this operation */
-       mach_port_t *names;
+       mach_port_name_t *names;
        mach_port_type_t *types;
        kern_return_t kr;
 
@@ -163,7 +163,7 @@ mach_port_names(
        vm_map_copy_t memory2;  /* copied-in memory, for types */
 
        /* safe simplifying assumption */
-       assert_static(sizeof(mach_port_t) == sizeof(mach_port_type_t));
+       assert_static(sizeof(mach_port_name_t) == sizeof(mach_port_type_t));
 
        if (space == IS_NULL)
                return KERN_INVALID_TASK;
@@ -225,7 +225,7 @@ mach_port_names(
        }
        /* space is read-locked and active */
 
-       names = (mach_port_t *) addr1;
+       names = (mach_port_name_t *) addr1;
        types = (mach_port_type_t *) addr2;
        actual = 0;
 
@@ -287,7 +287,7 @@ mach_port_names(
                }
        }
 
-       *namesp = (mach_port_t *) memory1;
+       *namesp = (mach_port_name_t *) memory1;
        *namesCnt = actual;
        *typesp = (mach_port_type_t *) memory2;
        *typesCnt = actual;
-- 
2.30.2




reply via email to

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