diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-16 19:41:14 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-09-16 19:41:36 +0200 |
commit | bb95a72318e747ce8854e161cc590e67ac17f4f9 (patch) | |
tree | 2f0b0af6735b1fc4a90f6a4de6951a3afff0b79f /mach/mach | |
parent | c88b3da93e4b6ff1dd8c6192e358aa60b98114dc (diff) |
Cache the host port like we cache the task port
This way we do not
need to call the kernel just to get the port. Furthermore, we no
longer increase the reference count on every invocation of
`mach_host_self'.
* mach/mach/mach_traps.h (__mach_host_self, mach_host_self):
Protect declarations against the macro expansion.
* mach/mach_init.c (__mach_host_self_): New variable.
(mach_init): Initialize `__mach_host_self_'.
* mach/mach_init.h (__mach_host_self_): New declaration.
(__mach_host_self, mach_host_self): New macros.
* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_start_cleanup):
Release reference.
Diffstat (limited to 'mach/mach')
-rw-r--r-- | mach/mach/mach_traps.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mach/mach/mach_traps.h b/mach/mach/mach_traps.h index 53ec21e2d2..c778caa685 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. */ |