]> git.saurik.com Git - apple/xnu.git/blob - osfmk/default_pager/diag.h
e197e2aa87f45834fca05a8822c08f6dc97cf0d5
[apple/xnu.git] / osfmk / default_pager / diag.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * HISTORY
27 * $Log: diag.h,v $
28 * Revision 1.3 2000/01/26 05:56:23 wsanchez
29 * Add APSL
30 *
31 * Revision 1.2 1998/12/01 00:24:42 wsanchez
32 * Merged in CDY_DP1 (chris: default pager)
33 *
34 * Revision 1.1.2.2 1998/11/25 21:32:17 youngwor
35 * fix errant comment format
36 *
37 * Revision 1.1.2.1 1998/11/24 22:39:59 youngwor
38 * Check-in of support for the in-kernel default pager
39 *
40 * Revision 1.1.1.1 1998/03/07 02:26:31 wsanchez
41 * Import of OSF Mach kernel (~mburg)
42 *
43 * Revision 1.1.6.3 1995/04/07 18:51:32 barbou
44 * Changed panic messages format.
45 * [94/10/10 barbou]
46 * [95/03/08 barbou]
47 *
48 * Revision 1.1.6.2 1995/01/11 19:30:28 devrcs
49 * mk6 CR668 - 1.3b26 merge
50 * [1994/11/10 15:31:34 bolinger]
51 *
52 * Insert 1.3 log.
53 *
54 * BEGIN OSC1_3 HISTORY
55 *
56 * Revision 1.1.2.2 1994/04/01 18:45:25 jph
57 * CR10550 -- Add stats macros for info interfaces.
58 * [1994/04/01 18:45:06 jph]
59 *
60 * Revision 1.1.2.1 1994/02/16 14:22:46 jph
61 * CR10554 -- Simple assert and panic macros for diagnostics.
62 * [1994/02/16 14:22:02 jph]
63 *
64 * END OSC1_3 HISTORY
65 * [1994/11/10 15:30:44 bolinger]
66 *
67 * $EndLog$
68 */
69
70 #ifndef MACH_KERNEL
71 #ifdef ASSERTIONS
72 #define assert(cond) \
73 if (!(cond)) panic("%sassertion: %s", my_name, # cond)
74 #endif
75 #ifndef ASSERTIONS
76 #define assert(cond)
77 #endif
78 #endif
79
80 #ifndef MACH_KERNEL
81 #define Panic(aargh) panic("%s[%d]%s: %s", my_name, dp_thread_id(), here, aargh)
82 #else
83 #define Panic(aargh) panic("%s[KERNEL]%s: %s", my_name, here, aargh)
84 #endif
85
86 extern char my_name[];
87
88 #define VSTATS_ACTION(l, stmt) \
89 do { VSTATS_LOCK(l); stmt; VSTATS_UNLOCK(l); } while (0)
90
91 #if !defined(VAGUE_STATS) || (VAGUE_STATS > 0)
92 #define VSTATS_LOCK_DECL(name)
93 #define VSTATS_LOCK(l)
94 #define VSTATS_UNLOCK(l)
95 #define VSTATS_LOCK_INIT(l)
96 #else
97 #define VSTATS_LOCK_DECL(name) struct mutex name;
98 #define VSTATS_LOCK(l) mutex_lock(l)
99 #define VSTATS_UNLOCK(l) mutex_unlock(l)
100 #define VSTATS_LOCK_INIT(l) mutex_init(l)
101 #endif /* VAGUE_STATS */
102