aboutsummaryrefslogtreecommitdiff
path: root/mach
diff options
context:
space:
mode:
Diffstat (limited to 'mach')
-rw-r--r--mach/mach/mach_traps.h7
-rw-r--r--mach/mach_init.c2
-rw-r--r--mach/mach_init.h5
3 files changed, 11 insertions, 3 deletions
diff --git a/mach/mach/mach_traps.h b/mach/mach/mach_traps.h
index 53ec21e..c778caa 100644
--- a/mach/mach/mach_traps.h
+++ b/mach/mach/mach_traps.h
@@ -41,9 +41,10 @@ extern mach_port_t __mach_thread_self (void);
extern mach_port_t (mach_task_self) (void);
extern mach_port_t (__mach_task_self) (void);
-/* Return the host information port for the host of the calling task. */
-extern mach_port_t mach_host_self (void);
-extern mach_port_t __mach_host_self (void);
+/* Return the host information port for the host of the calling task.
+ The parens are needed to protect against the macro in <mach_init.h>. */
+extern mach_port_t (mach_host_self) (void);
+extern mach_port_t (__mach_host_self) (void);
/* Attempt to context switch the current thread off the processor. Returns
true if there are other threads that can be run and false if not. */
diff --git a/mach/mach_init.c b/mach/mach_init.c
index cf8ac3b..8acb71f 100644
--- a/mach/mach_init.c
+++ b/mach/mach_init.c
@@ -20,6 +20,7 @@
#include <unistd.h>
mach_port_t __mach_task_self_;
+mach_port_t __mach_host_self_;
vm_size_t __vm_page_size = 0; /* Must be data not bss for weak alias. */
weak_alias (__vm_page_size, vm_page_size)
@@ -34,6 +35,7 @@ __mach_init (void)
kern_return_t err;
__mach_task_self_ = (__mach_task_self) ();
+ __mach_host_self_ = (__mach_host_self) ();
__mig_init (0);
#ifdef HAVE_HOST_PAGE_SIZE
diff --git a/mach/mach_init.h b/mach/mach_init.h
index 44a7ce2..26b2639 100644
--- a/mach/mach_init.h
+++ b/mach/mach_init.h
@@ -31,6 +31,11 @@ extern mach_port_t __mach_task_self_;
#define __mach_task_self() (__mach_task_self_ + 0) /* Not an lvalue. */
#define mach_task_self() (__mach_task_self ())
+/* This cache is initialized at startup. */
+extern mach_port_t __mach_host_self_;
+#define __mach_host_self() (__mach_host_self_ + 0) /* Not an lvalue. */
+#define mach_host_self() (__mach_host_self ())
+
/* Kernel page size. */
extern vm_size_t __vm_page_size;
extern vm_size_t vm_page_size;