diff options
Diffstat (limited to 'ipc/ipc_space.h')
-rw-r--r-- | ipc/ipc_space.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/ipc/ipc_space.h b/ipc/ipc_space.h index a2aac40a..96d58942 100644 --- a/ipc/ipc_space.h +++ b/ipc/ipc_space.h @@ -47,7 +47,9 @@ #include <kern/lock.h> #include <kern/rdxtree.h> #include <kern/slab.h> +#include <kern/printf.h> #include <ipc/ipc_entry.h> +#include <ipc/ipc_port.h> #include <ipc/ipc_types.h> /* @@ -142,7 +144,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; @@ -155,6 +157,18 @@ ipc_entry_lookup( return entry; } +extern volatile boolean_t mach_port_deallocate_debug; + +static inline void +ipc_entry_lookup_failed(mach_msg_header_t *msg, mach_port_name_t name) +{ + if (name == MACH_PORT_NAME_NULL || name == MACH_PORT_NAME_DEAD) + return; + printf("task %.*s looked up a bogus port %lu for %d, most probably a bug.\n", (int) sizeof current_task()->name, current_task()->name, (unsigned long) name, msg->msgh_id); + if (mach_port_deallocate_debug) + SoftDebugger("ipc_entry_lookup"); +} + /* * Routine: ipc_entry_get * Purpose: @@ -170,10 +184,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); @@ -208,7 +222,7 @@ ipc_entry_get( * (See comment in ipc/ipc_table.h.) */ - assert(MACH_PORT_VALID(new_name)); + assert(MACH_PORT_NAME_VALID(new_name)); assert(free_entry->ie_object == IO_NULL); space->is_size += 1; @@ -229,7 +243,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); |