mach_init.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Declarations and macros for the basic Mach things set at startup.
  2. Copyright (C) 1993-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _MACH_INIT_H
  16. #define _MACH_INIT_H 1
  17. #include <mach/mach_types.h>
  18. /* Return the current task's task port. */
  19. extern mach_port_t __mach_task_self (void);
  20. extern mach_port_t mach_task_self (void);
  21. /* This cache is initialized at startup. */
  22. extern mach_port_t __mach_task_self_;
  23. #define __mach_task_self() (__mach_task_self_ + 0) /* Not an lvalue. */
  24. #define mach_task_self() (__mach_task_self ())
  25. /* This cache is initialized at startup. */
  26. extern mach_port_t __mach_host_self_;
  27. #define __mach_host_self() (__mach_host_self_ + 0) /* Not an lvalue. */
  28. #define mach_host_self() (__mach_host_self ())
  29. /* Kernel page size. */
  30. extern vm_size_t __vm_page_size;
  31. extern vm_size_t vm_page_size;
  32. /* Round the address X up to a page boundary. */
  33. #define round_page(x) \
  34. ((((vm_offset_t) (x) + __vm_page_size - 1) / __vm_page_size) * \
  35. __vm_page_size)
  36. /* Truncate the address X down to a page boundary. */
  37. #define trunc_page(x) \
  38. ((((vm_offset_t) (x)) / __vm_page_size) * __vm_page_size)
  39. #endif /* mach_init.h */