1/* Standard header for all Mach programs.
2 Copyright (C) 1993-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MACH_H
20
21#define _MACH_H 1
22
23#include <features.h>
24
25/* Get the basic types used by Mach. */
26#include <mach/mach_types.h>
27
28/* This declares the basic variables and macros everything needs. */
29#include <mach_init.h>
30
31/* This declares all the real system call functions. */
32#include <mach/mach_traps.h>
33
34/* These are MiG-generated headers for the kernel interfaces commonly used. */
35#include <mach/mach_interface.h> /* From <mach/mach.defs>. */
36#include <mach/mach_port.h>
37#include <mach/mach_host.h>
38
39/* For the kernel RPCs which have system call shortcut versions,
40 the MiG-generated header in fact declares `CALL_rpc' rather than `CALL'.
41 This file declares the simple `CALL' functions. */
42#include <mach-shortcuts.h>
43
44
45/* Receive RPC request messages on RCV_NAME and pass them to DEMUX, which
46 decodes them and produces reply messages. MAX_SIZE is the maximum size
47 (in bytes) of the request and reply buffers. */
48extern mach_msg_return_t
49__mach_msg_server (boolean_t (*__demux) (mach_msg_header_t *__request,
50 mach_msg_header_t *__reply),
51 mach_msg_size_t __max_size,
52 mach_port_t __rcv_name),
53mach_msg_server (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
58/* Just like `mach_msg_server', but the OPTION and TIMEOUT parameters are
59 passed on to `mach_msg'. */
60extern mach_msg_return_t
61__mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
62 mach_msg_header_t *__reply),
63 mach_msg_size_t __max_size,
64 mach_port_t __rcv_name,
65 mach_msg_option_t __option,
66 mach_msg_timeout_t __timeout),
67mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
68 mach_msg_header_t *__reply),
69 mach_msg_size_t __max_size,
70 mach_port_t __rcv_name,
71 mach_msg_option_t __option,
72 mach_msg_timeout_t __timeout);
73
74
75/* Deallocate all port rights and out-of-line memory in MSG. */
76extern void
77__mach_msg_destroy (mach_msg_header_t *msg),
78mach_msg_destroy (mach_msg_header_t *msg);
79
80#include <bits/types/FILE.h>
81
82/* Open a stream on a Mach device. */
83extern FILE *mach_open_devstream (mach_port_t device_port, const char *mode);
84
85/* Give THREAD a stack and set it to run at PC when resumed.
86 If *STACK_SIZE is nonzero, that size of stack is allocated.
87 If *STACK_BASE is nonzero, that stack location is used.
88 If STACK_BASE is not null it is filled in with the chosen stack base.
89 If STACK_SIZE is not null it is filled in with the chosen stack size.
90 Regardless, an extra page of red zone is allocated off the end; this
91 is not included in *STACK_SIZE. */
92kern_return_t __mach_setup_thread (task_t task, thread_t thread, void *pc,
93 vm_address_t *stack_base,
94 vm_size_t *stack_size);
95kern_return_t mach_setup_thread (task_t task, thread_t thread, void *pc,
96 vm_address_t *stack_base,
97 vm_size_t *stack_size);
98
99/* Give THREAD a TLS area. */
100kern_return_t __mach_setup_tls (thread_t thread);
101kern_return_t mach_setup_tls (thread_t thread);
102
103#endif /* mach.h */
104

source code of glibc/mach/mach.h