aboutsummaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2024-03-27 19:18:32 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-03-27 19:48:07 +0100
commit6036cc18e6a67a15e2b6d9dff37d05b411c199c3 (patch)
treea406ec4604d78a40db8e3d6a681935fb0ff8d173 /ipc
parentc8998d9d3d0c55f98cc4eb7110f99af9c699ed4b (diff)
downloadgnumach-6036cc18e6a67a15e2b6d9dff37d05b411c199c3.tar.gz
gnumach-6036cc18e6a67a15e2b6d9dff37d05b411c199c3.tar.bz2
gnumach-6036cc18e6a67a15e2b6d9dff37d05b411c199c3.zip
ipc: Turn ipc_entry_lookup_failed() into a macro
ipc_entry_lookup_failed() is used with both mach_msg_user_header_t and mach_msg_header_t arguments, which are different types. Make it into a macro, so it works with both. Message-ID: <20240327161841.95685-9-bugaevc@gmail.com>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_space.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/ipc/ipc_space.h b/ipc/ipc_space.h
index 96d58942..9adbd3f7 100644
--- a/ipc/ipc_space.h
+++ b/ipc/ipc_space.h
@@ -159,15 +159,19 @@ ipc_entry_lookup(
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");
-}
+#define ipc_entry_lookup_failed(msg, port_name) \
+MACRO_BEGIN \
+ if (MACH_PORT_NAME_VALID(port_name)) { \
+ 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) (port_name), \
+ (msg)->msgh_id); \
+ if (mach_port_deallocate_debug) \
+ SoftDebugger("ipc_entry_lookup"); \
+ } \
+MACRO_END
/*
* Routine: ipc_entry_get