[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/17] ipc: Turn ipc_entry_lookup_failed() into a macro
From: |
Sergey Bugaev |
Subject: |
[PATCH 08/17] ipc: Turn ipc_entry_lookup_failed() into a macro |
Date: |
Wed, 27 Mar 2024 19:18:32 +0300 |
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.
---
ipc/ipc_space.h | 22 +++++++++++++---------
1 file 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
--
2.44.0
- [PATCH 01/17] elf-load: Respect PT_GNU_STACK, (continued)
- [PATCH 01/17] elf-load: Respect PT_GNU_STACK, Sergey Bugaev, 2024/03/27
- [PATCH 04/17] Load 64-bit ELFs on all 64-bit ports, Sergey Bugaev, 2024/03/27
- [PATCH 06/17] kern/syscall_subr.c: Use copyin()/copyout() to access user memory, Sergey Bugaev, 2024/03/27
- [PATCH 03/17] Use the x86_64 message ABI on all 64-bit ports, Sergey Bugaev, 2024/03/27
- [PATCH 02/17] Disable host_kernel_version() everywhere but on i386, Sergey Bugaev, 2024/03/27
- [PATCH 08/17] ipc: Turn ipc_entry_lookup_failed() into a macro,
Sergey Bugaev <=
- [PATCH 11/17] tests: Fix halt(), Sergey Bugaev, 2024/03/27
- [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h, Sergey Bugaev, 2024/03/27
- [PATCH 15/17] tests: Make exception subcode a long, Sergey Bugaev, 2024/03/27
- [PATCH 12/17] tests: Add a more serious mach_msg_server() routine, Sergey Bugaev, 2024/03/27
- [PATCH 07/17] kern/rdxtree: Fix undefined behavior, Sergey Bugaev, 2024/03/27