1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-09-11 12:10:50 +03:00

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.
This commit is contained in:
Justus Winter
2015-09-16 19:41:14 +02:00
committed by Samuel Thibault
parent c88b3da93e
commit bb95a72318
5 changed files with 28 additions and 3 deletions

View File

@@ -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