]> git.saurik.com Git - apple/libc.git/blob - mach.subproj/panic.c
2411d52de715c37119d66e83483c40c2349880fa
[apple/libc.git] / mach.subproj / panic.c
1 /*
2 * @OSF_COPYRIGHT@
3 */
4
5 /*
6 * Mach Operating System
7 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
8 * All Rights Reserved.
9 *
10 * Permission to use, copy, modify and distribute this software and its
11 * documentation is hereby granted, provided that both the copyright
12 * notice and this permission notice appear in all copies of the
13 * software, derivative works or modified versions, and any portions
14 * thereof, and that both notices appear in supporting documentation.
15 *
16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
18 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie Mellon
28 * the rights to redistribute these changes.
29 */
30
31 #include <mach/mach.h>
32 #include <mach/mach_host.h>
33 #include <stdarg.h>
34 #include <stdio.h>
35
36 static mach_port_t master_host_port;
37
38 void
39 panic_init(mach_port_t port)
40 {
41 master_host_port = port;
42 }
43
44 /*VARARGS1*/
45 void
46 panic(const char *s, ...)
47 {
48 va_list listp;
49
50 printf("panic: ");
51 va_start(listp, s);
52 vprintf(s, listp);
53 va_end(listp);
54 printf("\n");
55
56 #define RB_DEBUGGER 0x1000 /* enter debugger NOW */
57 (void) host_reboot(master_host_port, RB_DEBUGGER);
58 }