aboutsummaryrefslogtreecommitdiff
path: root/ipc/ipc_space.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-11-18 21:36:44 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-11-18 21:41:52 +0100
commit383379ae770fd6a74c592006f46986320df9fa30 (patch)
treef4d228438e4f350a21b39cb153eb60b048a8690e /ipc/ipc_space.h
parent2f899c323e850ec9cab35f24315f28ef62021957 (diff)
downloadgnumach-383379ae770fd6a74c592006f46986320df9fa30.tar.gz
gnumach-383379ae770fd6a74c592006f46986320df9fa30.tar.bz2
gnumach-383379ae770fd6a74c592006f46986320df9fa30.zip
ipc_entry_lookup: Generalize warnings about bogus port names
Looking up a bogus port name is generally a sign of a real bug, such as a spurious mach port deallocation.
Diffstat (limited to 'ipc/ipc_space.h')
-rw-r--r--ipc/ipc_space.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/ipc/ipc_space.h b/ipc/ipc_space.h
index b4eb5ba6..22460877 100644
--- a/ipc/ipc_space.h
+++ b/ipc/ipc_space.h
@@ -47,6 +47,7 @@
#include <kern/lock.h>
#include <kern/rdxtree.h>
#include <kern/slab.h>
+#include <kern/printf.h>
#include <ipc/ipc_entry.h>
#include <ipc/ipc_types.h>
@@ -155,6 +156,18 @@ ipc_entry_lookup(
return entry;
}
+extern volatile boolean_t mach_port_deallocate_debug;
+
+static inline void
+ipc_entry_lookup_failed(mach_port_name_t name)
+{
+ if (name == MACH_PORT_NULL || name == MACH_PORT_DEAD)
+ return;
+ printf("task %.*s looked up 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("ipc_entry_lookup");
+}
+
/*
* Routine: ipc_entry_get
* Purpose: