mach.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Standard header for all Mach programs.
  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_H
  16. #define _MACH_H 1
  17. #include <features.h>
  18. /* Get the basic types used by Mach. */
  19. #include <mach/mach_types.h>
  20. /* This declares the basic variables and macros everything needs. */
  21. #include <mach_init.h>
  22. /* This declares all the real system call functions. */
  23. #include <mach/mach_traps.h>
  24. /* These are MiG-generated headers for the kernel interfaces commonly used. */
  25. #include <mach/mach_interface.h> /* From <mach/mach.defs>. */
  26. #include <mach/mach_port.h>
  27. #include <mach/mach_host.h>
  28. /* For the kernel RPCs which have system call shortcut versions,
  29. the MiG-generated header in fact declares `CALL_rpc' rather than `CALL'.
  30. This file declares the simple `CALL' functions. */
  31. #include <mach-shortcuts.h>
  32. /* Receive RPC request messages on RCV_NAME and pass them to DEMUX, which
  33. decodes them and produces reply messages. MAX_SIZE is the maximum size
  34. (in bytes) of the request and reply buffers. */
  35. extern mach_msg_return_t
  36. __mach_msg_server (boolean_t (*__demux) (mach_msg_header_t *__request,
  37. mach_msg_header_t *__reply),
  38. mach_msg_size_t __max_size,
  39. mach_port_t __rcv_name),
  40. mach_msg_server (boolean_t (*__demux) (mach_msg_header_t *__request,
  41. mach_msg_header_t *__reply),
  42. mach_msg_size_t __max_size,
  43. mach_port_t __rcv_name);
  44. /* Just like `mach_msg_server', but the OPTION and TIMEOUT parameters are
  45. passed on to `mach_msg'. */
  46. extern mach_msg_return_t
  47. __mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
  48. mach_msg_header_t *__reply),
  49. mach_msg_size_t __max_size,
  50. mach_port_t __rcv_name,
  51. mach_msg_option_t __option,
  52. mach_msg_timeout_t __timeout),
  53. mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
  54. mach_msg_header_t *__reply),
  55. mach_msg_size_t __max_size,
  56. mach_port_t __rcv_name,
  57. mach_msg_option_t __option,
  58. mach_msg_timeout_t __timeout);
  59. /* Deallocate all port rights and out-of-line memory in MSG. */
  60. extern void
  61. __mach_msg_destroy (mach_msg_header_t *msg),
  62. mach_msg_destroy (mach_msg_header_t *msg);
  63. #include <bits/types/FILE.h>
  64. /* Open a stream on a Mach device. */
  65. extern FILE *mach_open_devstream (mach_port_t device_port, const char *mode);
  66. /* Give THREAD a stack and set it to run at PC when resumed.
  67. If *STACK_SIZE is nonzero, that size of stack is allocated.
  68. If *STACK_BASE is nonzero, that stack location is used.
  69. If STACK_BASE is not null it is filled in with the chosen stack base.
  70. If STACK_SIZE is not null it is filled in with the chosen stack size.
  71. Regardless, an extra page of red zone is allocated off the end; this
  72. is not included in *STACK_SIZE.
  73. Mote: this function is unsuitable for setting up the thread to call a
  74. function at PC, since the architecture ABI may impose additional
  75. requirements beyond setting PC and stack. */
  76. kern_return_t __mach_setup_thread (task_t task, thread_t thread, void *pc,
  77. vm_address_t *stack_base,
  78. vm_size_t *stack_size);
  79. kern_return_t mach_setup_thread (task_t task, thread_t thread, void *pc,
  80. vm_address_t *stack_base,
  81. vm_size_t *stack_size);
  82. /* Give THREAD a TLS area. */
  83. kern_return_t __mach_setup_tls (thread_t thread);
  84. kern_return_t mach_setup_tls (thread_t thread);
  85. #endif /* mach.h */