From f8116ac1045bcedfb02dac494feafbcc24c3c904 Mon Sep 17 00:00:00 2001 From: Luca Dariz Date: Tue, 28 Jun 2022 12:10:47 +0200 Subject: use port name type in mach_port_names() * 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 Message-Id: <20220628101054.446126-9-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; -- cgit v1.2.3