1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +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

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