2.9
[glibc/nacl-glibc.git] / mach / mach.h
blobf8fd44bb00b3df90851a46a0dcf4d9ab60e987e6
1 /* Standard header for all Mach programs.
2 Copyright (C) 1993,94,96,97,2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _MACH_H
22 #define _MACH_H 1
24 /* We must include this before using __need_FILE with <stdio.h> below. */
25 #include <features.h>
28 /* Get the basic types used by Mach. */
29 #include <mach/mach_types.h>
31 /* This declares the basic variables and macros everything needs. */
32 #include <mach_init.h>
34 /* This declares all the real system call functions. */
35 #include <mach/mach_traps.h>
37 /* These are MiG-generated headers for the kernel interfaces commonly used. */
38 #include <mach/mach_interface.h> /* From <mach/mach.defs>. */
39 #include <mach/mach_port.h>
40 #include <mach/mach_host.h>
42 /* For the kernel RPCs which have system call shortcut versions,
43 the MiG-generated header in fact declares `CALL_rpc' rather than `CALL'.
44 This file declares the simple `CALL' functions. */
45 #include <mach-shortcuts.h>
48 /* Receive RPC request messages on RCV_NAME and pass them to DEMUX, which
49 decodes them and produces reply messages. MAX_SIZE is the maximum size
50 (in bytes) of the request and reply buffers. */
51 extern mach_msg_return_t
52 __mach_msg_server (boolean_t (*__demux) (mach_msg_header_t *__request,
53 mach_msg_header_t *__reply),
54 mach_msg_size_t __max_size,
55 mach_port_t __rcv_name),
56 mach_msg_server (boolean_t (*__demux) (mach_msg_header_t *__request,
57 mach_msg_header_t *__reply),
58 mach_msg_size_t __max_size,
59 mach_port_t __rcv_name);
61 /* Just like `mach_msg_server', but the OPTION and TIMEOUT parameters are
62 passed on to `mach_msg'. */
63 extern mach_msg_return_t
64 __mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
65 mach_msg_header_t *__reply),
66 mach_msg_size_t __max_size,
67 mach_port_t __rcv_name,
68 mach_msg_option_t __option,
69 mach_msg_timeout_t __timeout),
70 mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
71 mach_msg_header_t *__reply),
72 mach_msg_size_t __max_size,
73 mach_port_t __rcv_name,
74 mach_msg_option_t __option,
75 mach_msg_timeout_t __timeout);
78 /* Deallocate all port rights and out-of-line memory in MSG. */
79 extern void
80 __mach_msg_destroy (mach_msg_header_t *msg),
81 mach_msg_destroy (mach_msg_header_t *msg);
84 #define __need_FILE
85 #include <stdio.h>
87 /* Open a stream on a Mach device. */
88 extern FILE *mach_open_devstream (mach_port_t device_port, const char *mode);
90 /* Give THREAD a stack and set it to run at PC when resumed.
91 If *STACK_SIZE is nonzero, that size of stack is allocated.
92 If *STACK_BASE is nonzero, that stack location is used.
93 If STACK_BASE is not null it is filled in with the chosen stack base.
94 If STACK_SIZE is not null it is filled in with the chosen stack size.
95 Regardless, an extra page of red zone is allocated off the end; this
96 is not included in *STACK_SIZE. */
97 kern_return_t __mach_setup_thread (task_t task, thread_t thread, void *pc,
98 vm_address_t *stack_base,
99 vm_size_t *stack_size);
100 kern_return_t mach_setup_thread (task_t task, thread_t thread, void *pc,
101 vm_address_t *stack_base,
102 vm_size_t *stack_size);
105 #endif /* mach.h */