]> git.saurik.com Git - apple/libc.git/blob - mach/headers/mach_init.h
396b960b86b0a5903843af4a5ee9bc865ea93753
[apple/libc.git] / mach / headers / mach_init.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987,1986 Carnegie Mellon University
28 * All Rights Reserved.
29 *
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
35 *
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50
51 /*
52 * Items provided by the Mach environment initialization.
53 */
54
55 #ifndef _MACH_INIT_
56 #define _MACH_INIT_ 1
57
58 #include <mach/mach_types.h>
59 #include <stdarg.h>
60
61 #include <sys/cdefs.h>
62
63 __BEGIN_DECLS
64 /*
65 * Kernel-related ports; how a task/thread controls itself
66 */
67
68 extern mach_port_t mach_task_self_;
69
70 extern mach_port_t mach_task_self(void);
71 extern mach_port_t mach_host_self(void);
72 extern mach_port_t mach_thread_self(void);
73
74 #define mach_task_self() mach_task_self_
75
76 #define current_task() mach_task_self()
77
78 #include <mach/mach_traps.h>
79 /*
80 * Other important ports in the Mach user environment
81 */
82
83 extern mach_port_t bootstrap_port;
84 extern mach_port_t name_server_port;
85 extern mach_port_t environment_port;
86 extern mach_port_t service_port;
87
88 /*
89 * Where these ports occur in the "mach_ports_register"
90 * collection... only servers or the runtime library need know.
91 */
92
93 #define NAME_SERVER_SLOT 0
94 #define ENVIRONMENT_SLOT 1
95 #define SERVICE_SLOT 2
96
97 #define MACH_PORTS_SLOTS_USED 3
98
99 /*
100 * Globally interesting numbers.
101 * These macros assume vm_page_size is a power-of-2.
102 */
103
104 extern vm_size_t vm_page_size;
105 extern vm_size_t vm_page_mask;
106 extern int vm_page_shift;
107
108 #define trunc_page(x) ((x) & (~(vm_page_size - 1)))
109 #define round_page(x) trunc_page((x) + (vm_page_size - 1))
110
111 /*
112 * fprintf_stderr uses vprintf_stderr_func to produce
113 * error messages, this can be overridden by a user
114 * application to point to a user-specified output function
115 */
116
117 extern int (*vprintf_stderr_func)(const char *format, va_list ap);
118 __END_DECLS
119
120 #endif /* _MACH_INIT_ */