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_init.h | |
parent | c88b3da93e4b6ff1dd8c6192e358aa60b98114dc (diff) | |
download | glibc-bb95a72318e747ce8854e161cc590e67ac17f4f9.tar.gz glibc-bb95a72318e747ce8854e161cc590e67ac17f4f9.tar.xz glibc-bb95a72318e747ce8854e161cc590e67ac17f4f9.zip |
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_init.h')
-rw-r--r-- | mach/mach_init.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mach/mach_init.h b/mach/mach_init.h index 44a7ce2c50..26b2639fd8 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; |