From fc6bcf785b702e7e8a675ea0fe9856cc1b24b8f6 Mon Sep 17 00:00:00 2001 From: Luca Dariz Date: Mon, 16 Jan 2023 11:58:57 +0100 Subject: replace mach_port_t with mach_port_name_t This is a cleanup following the introduction of mach_port_name_t. The same set of changes is applied to all files: - rename mach_port_t to mach_port_name_t where a port name is used, - use MACH_PORT_NAME_NULL and MACH_PORT_NAME_DEAD where appropriate, - use invalid_port_to_name() and invalid_name_to_port() for conversion where appropriate, - use regular copyout() insted of copyout_port() when we deal with mach_port_name_t already before copyout, - use the new helper ipc_kmsg_copyout_object_to_port() when we really want to place a port name in the space of a mach_port_t. * include/mach/notify.h: Likewise * ipc/ipc_entry.c: Likewise * ipc/ipc_kmsg.c: Likewise * ipc/ipc_kmsg.h: Likewise, and add ipc_kmsg_copyout_object_to_port() * ipc/ipc_marequest.c: Likewise * ipc/ipc_object.c: Likewise * ipc/ipc_port.c: Likewise * ipc/ipc_space.h: Likewise * ipc/mach_msg.c: Likewise * ipc/mach_port.c: Likewise * kern/exception.c: Likewise * kern/ipc_mig.c: Likewise Message-Id: <20230116105857.240210-8-luca@orpolo.org> --- ipc/mach_port.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ipc/mach_port.c') diff --git a/ipc/mach_port.c b/ipc/mach_port.c index 6edf9f88..67713a50 100644 --- a/ipc/mach_port.c +++ b/ipc/mach_port.c @@ -374,7 +374,7 @@ mach_port_rename( if (space == IS_NULL) return KERN_INVALID_TASK; - if (!MACH_PORT_VALID(nname)) + if (!MACH_PORT_NAME_VALID(nname)) return KERN_INVALID_VALUE; return ipc_object_rename(space, oname, nname); @@ -422,7 +422,7 @@ mach_port_allocate_name( if (space == IS_NULL) return KERN_INVALID_TASK; - if (!MACH_PORT_VALID(name)) + if (!MACH_PORT_NAME_VALID(name)) return KERN_INVALID_VALUE; switch (right) { @@ -548,7 +548,7 @@ mach_port_destroy( kr = ipc_right_lookup_write(space, name, &entry); if (kr != KERN_SUCCESS) { - if (MACH_PORT_VALID (name) && space == current_space()) { + if (MACH_PORT_NAME_VALID (name) && space == current_space()) { printf("task %.*s destroying a bogus port %lu, most probably a bug.\n", (int) sizeof current_task()->name, current_task()->name, (unsigned long) name); if (mach_port_deallocate_debug) SoftDebugger("mach_port_deallocate"); @@ -592,7 +592,7 @@ mach_port_deallocate( kr = ipc_right_lookup_write(space, name, &entry); if (kr != KERN_SUCCESS) { - if (MACH_PORT_VALID (name) && space == current_space()) { + if (MACH_PORT_NAME_VALID (name) && space == current_space()) { printf("task %.*s deallocating a bogus port %lu, most probably a bug.\n", (int) sizeof current_task()->name, current_task()->name, (unsigned long) name); if (mach_port_deallocate_debug) SoftDebugger("mach_port_deallocate"); @@ -714,7 +714,7 @@ mach_port_mod_refs( kr = ipc_right_lookup_write(space, name, &entry); if (kr != KERN_SUCCESS) { - if (MACH_PORT_VALID (name) && space == current_space()) { + if (MACH_PORT_NAME_VALID (name) && space == current_space()) { printf("task %.*s %screasing a bogus port " "%u by %d, most probably a bug.\n", (int) (sizeof current_task()->name), @@ -1228,7 +1228,7 @@ mach_port_insert_right( if (space == IS_NULL) return KERN_INVALID_TASK; - if (!MACH_PORT_VALID(name) || + if (!MACH_PORT_NAME_VALID(name) || !MACH_MSG_TYPE_PORT_ANY_RIGHT(polyPoly)) return KERN_INVALID_VALUE; @@ -1323,7 +1323,7 @@ mach_port_get_receive_status( statusp->mps_seqno = port->ip_seqno; imq_unlock(&pset->ips_messages); ips_unlock(pset); - assert(MACH_PORT_VALID(statusp->mps_pset)); + assert(MACH_PORT_NAME_VALID(statusp->mps_pset)); } } else { no_port_set: -- cgit v1.2.3